From: David Gow Date: Mon, 20 Oct 2014 14:10:46 +0000 (+0800) Subject: Tell the compiler that Fatal() doesn't return. X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=commitdiff_plain;h=216bf86aee4c7a1f3392051a457e7e5933f40fbd;ds=sidebyside Tell the compiler that Fatal() doesn't return. This reduces the number of false positives returned by the clang static analyser. --- diff --git a/src/log.cpp b/src/log.cpp index a695b0e..88c47b7 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -120,7 +120,6 @@ void FatalEx(const char * funct, const char * file, int line, ...) // Fatal error in the Fatal function. // (This really shouldn't happen unless someone does something insanely stupid) Fatal("Format string is NULL"); - return; // Should never get here } vsnprintf(buffer, BUFSIZ, fmt,va); diff --git a/src/log.h b/src/log.h index d49c149..8a5882c 100644 --- a/src/log.h +++ b/src/log.h @@ -41,7 +41,7 @@ extern void Backtrace(int size=10); extern void LogEx(int level, const char * funct, const char * file, int line, ...); // General function for printing log messages to stderr -extern void FatalEx(const char * funct, const char * file, int line, ...); // Function that deals with a fatal error (prints a message, then exits the program). +extern void FatalEx(const char * funct, const char * file, int line, ...) __attribute__((__noreturn__)); // Function that deals with a fatal error (prints a message, then exits the program). #endif //_LOG_H