summaryrefslogtreecommitdiff
path: root/include/asterisk/compiler.h
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2016-07-18 23:46:19 -0400
committerCorey Farrell <git@cfware.com>2016-07-19 23:35:41 -0400
commit7fdf7c3d4cf1124a3a9bbed86c9490e0a0b2d125 (patch)
treee8dd9723ab8e3558b186f2a86c6f0c286f50b3ee /include/asterisk/compiler.h
parent5f24874ebb8686eb73817084385bb23727c19e85 (diff)
Add conditional support for noreturn functions.
This adds support for tagging functions with the noreturn attribute. If DO_CRASH is enabled then ast_do_crash never returns. If AST_DEVMODE and DO_CRASH are enabled then failed assertions never return. This can resolve a large number of false positives with static analyzers. ASTERISK-26220 #close Change-Id: Icfb61e5fe54574eced4c3e88b317244f467ec753
Diffstat (limited to 'include/asterisk/compiler.h')
-rw-r--r--include/asterisk/compiler.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/asterisk/compiler.h b/include/asterisk/compiler.h
index 77b5de40e..6ceaa5f77 100644
--- a/include/asterisk/compiler.h
+++ b/include/asterisk/compiler.h
@@ -77,6 +77,12 @@
#define attribute_may_alias
#endif
+#ifdef HAVE_ATTRIBUTE_noreturn
+#define attribute_noreturn __attribute__((noreturn))
+#else
+#define attribute_noreturn
+#endif
+
/* Some older version of GNU gcc (3.3.5 on OpenBSD 4.3 for example) dont like 'NULL' as sentinel */
#define SENTINEL ((char *)NULL)