Tell the compiler that Fatal() doesn't return.
authorDavid Gow <[email protected]>
Mon, 20 Oct 2014 14:10:46 +0000 (22:10 +0800)
committerDavid Gow <[email protected]>
Mon, 20 Oct 2014 14:10:46 +0000 (22:10 +0800)
This reduces the number of false positives returned by the
clang static analyser.

src/log.cpp
src/log.h

index a695b0e..88c47b7 100644 (file)
@@ -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");
                // 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);
        }
 
        vsnprintf(buffer, BUFSIZ, fmt,va);
index d49c149..8a5882c 100644 (file)
--- 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 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
 
 
 #endif //_LOG_H
 

UCC git Repository :: git.ucc.asn.au