From 216bf86aee4c7a1f3392051a457e7e5933f40fbd Mon Sep 17 00:00:00 2001 From: David Gow Date: Mon, 20 Oct 2014 22:10:46 +0800 Subject: [PATCH] Tell the compiler that Fatal() doesn't return. This reduces the number of false positives returned by the clang static analyser. --- src/log.cpp | 1 - src/log.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) 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 -- 2.20.1