summaryrefslogtreecommitdiff
path: root/main/utils.c
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 /main/utils.c
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 'main/utils.c')
-rw-r--r--main/utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main/utils.c b/main/utils.c
index 95eda1102..bd74ee24d 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -2425,7 +2425,7 @@ char *ast_utils_which(const char *binary, char *fullpath, size_t fullpath_size)
return NULL;
}
-void ast_do_crash(void)
+void DO_CRASH_NORETURN ast_do_crash(void)
{
#if defined(DO_CRASH)
abort();
@@ -2438,7 +2438,7 @@ void ast_do_crash(void)
}
#if defined(AST_DEVMODE)
-void __ast_assert_failed(int condition, const char *condition_str, const char *file, int line, const char *function)
+void DO_CRASH_NORETURN __ast_assert_failed(int condition, const char *condition_str, const char *file, int line, const char *function)
{
/*
* Attempt to put it into the logger, but hope that at least