[PATCH 4/5] Annotate internal_error with the attribute noreturn
Justus Winter
4winter at informatik.uni-hamburg.de
Mon Sep 24 03:31:56 PDT 2012
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 at informatik.uni-hamburg.de>
---
util/error_util.c | 4 +---
util/error_util.h | 4 ++--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/util/error_util.c b/util/error_util.c
index 630d228..d6e60fc 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 27e119f..d4d4584 100644
--- a/util/error_util.h
+++ b/util/error_util.h
@@ -53,8 +53,8 @@
*
* 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
--
1.7.10.4
More information about the notmuch
mailing list