unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] Annotate internal_error with the attribute noreturn
@ 2012-09-21 12:50 Justus Winter
  2012-09-21 12:50 ` [PATCH 2/2] Avoid potentially dereferencing a NULL pointer Justus Winter
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Justus Winter @ 2012-09-21 12:50 UTC (permalink / raw)
  To: notmuch

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>
---
 util/error_util.c |    2 --
 util/error_util.h |    2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/util/error_util.c b/util/error_util.c
index 630d228..3cf353a 100644
--- a/util/error_util.c
+++ b/util/error_util.c
@@ -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 bb15822..24a644b 100644
--- a/util/error_util.h
+++ b/util/error_util.h
@@ -30,7 +30,7 @@
  * Note that PRINTF_ATTRIBUTE comes from talloc.h
  */
 int
-_internal_error (const char *format, ...) PRINTF_ATTRIBUTE (1, 2);
+_internal_error (const char *format, ...) PRINTF_ATTRIBUTE (1, 2) __attribute__ ((noreturn));
 
 /* 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

^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2012-09-27 15:57 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21 12:50 [PATCH 1/2] Annotate internal_error with the attribute noreturn Justus Winter
2012-09-21 12:50 ` [PATCH 2/2] Avoid potentially dereferencing a NULL pointer Justus Winter
2012-09-22 16:19   ` Austin Clements
2012-09-24 12:55     ` Justus Winter
2012-09-21 20:31 ` [PATCH 1/2] Annotate internal_error with the attribute noreturn David Bremner
2012-09-22 16:12 ` Austin Clements
2012-09-22 20:03   ` Tomi Ollila
2012-09-24 10:31   ` RFC: Annotate internal_error with the attribute noreturn 2nd patchset Justus Winter
2012-09-24 10:31     ` [PATCH 1/5] RFC: Provide a __has_attribute compatibility macro Justus Winter
2012-09-24 10:31     ` [PATCH 2/5] RFC: Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE Justus Winter
2012-09-24 10:31     ` [PATCH 3/5] Fix the COERCE_STATUS macro Justus Winter
2012-09-24 10:31     ` [PATCH 4/5] Annotate internal_error with the attribute noreturn Justus Winter
2012-09-24 10:31     ` [PATCH 5/5] Avoid potentially dereferencing a NULL pointer Justus Winter
2012-09-24 10:44     ` RFC: Annotate internal_error with the attribute noreturn 2nd patchset David Bremner
2012-09-24 12:50       ` Justus Winter
2012-09-24 14:41         ` David Bremner
2012-09-24 15:21           ` [PATCH 1/6] Provide a __has_attribute compatibility macro Justus Winter
2012-09-24 15:21             ` [PATCH 2/6] Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE Justus Winter
2012-09-24 15:21             ` [PATCH 3/6] Extend compat/README Justus Winter
2012-09-24 15:21             ` [PATCH 4/6] Fix the COERCE_STATUS macro Justus Winter
2012-09-24 17:44               ` Austin Clements
2012-09-25  8:55                 ` Tomi Ollila
2012-09-24 15:21             ` [PATCH 5/6] Annotate internal_error with the attribute noreturn Justus Winter
2012-09-24 15:21             ` [PATCH 6/6] Avoid potentially dereferencing a NULL pointer Justus Winter
2012-09-27 15:57             ` [PATCH 1/6] Provide a __has_attribute compatibility macro David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).