aboutsummaryrefslogtreecommitdiffhomepage
path: root/util
diff options
context:
space:
mode:
authorGravatar Justus Winter <4winter@informatik.uni-hamburg.de>2012-09-24 17:21:19 +0200
committerGravatar David Bremner <bremner@debian.org>2012-09-27 12:52:06 -0300
commit2f40ca28a4d63df941525801735d05b5b2b86f91 (patch)
tree73ade8c258fb20d1bc845e0f8c605054d826a5ac /util
parentfaf6ede3ef7b09df0d61264cb7a907860d69abbb (diff)
Annotate internal_error with the attribute noreturn
Annotating functions that do not return with the noreturn attribute (which is understood by both gcc and clang) prevents static analyzers from generating false positives (internal_error is used to terminate the process and is used extensively in error handling code paths). Remove the return statement that was placed there to appease the compiler. Functions annotated with noreturn are not supposed to return any values. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Diffstat (limited to 'util')
-rw-r--r--util/error_util.c4
-rw-r--r--util/error_util.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/util/error_util.c b/util/error_util.c
index 630d2281..d6e60fc9 100644
--- a/util/error_util.c
+++ b/util/error_util.c
@@ -24,7 +24,7 @@
#include "error_util.h"
-int
+void
_internal_error (const char *format, ...)
{
va_list va_args;
@@ -35,7 +35,5 @@ _internal_error (const char *format, ...)
vfprintf (stderr, format, va_args);
exit (1);
-
- return 1;
}
diff --git a/util/error_util.h b/util/error_util.h
index bb158220..17c8727d 100644
--- a/util/error_util.h
+++ b/util/error_util.h
@@ -23,14 +23,16 @@
#include <talloc.h>
+#include "function-attributes.h"
+
/* There's no point in continuing when we've detected that we've done
* something wrong internally (as opposed to the user passing in a
* bogus value).
*
* Note that PRINTF_ATTRIBUTE comes from talloc.h
*/
-int
-_internal_error (const char *format, ...) PRINTF_ATTRIBUTE (1, 2);
+void
+_internal_error (const char *format, ...) PRINTF_ATTRIBUTE (1, 2) NORETURN_ATTRIBUTE;
/* There's no point in continuing when we've detected that we've done
* something wrong internally (as opposed to the user passing in a