From 0d57e659cbaba6c5e6dd47748be0502f090c4f94 Mon Sep 17 00:00:00 2001 From: Sherief Farouk Date: Sun, 4 Aug 2013 10:10:21 -0400 Subject: [PATCH 1/3] Added AI_WONT_RETURN_SUFFIX mainly for Clang's static analyzer. --- include/assimp/defs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/assimp/defs.h b/include/assimp/defs.h index 1b777a5f2..aeae0778f 100644 --- a/include/assimp/defs.h +++ b/include/assimp/defs.h @@ -162,6 +162,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # define AI_FORCE_INLINE inline #endif // (defined _MSC_VER) +#ifdef __clang__ +# define AI_WONT_RETURN_SUFFIX __attribute__((analyzer_noreturn)) +#else +# define AI_WONT_RETURN_SUFFIX +#endif // (defined __clang__) + #ifdef __cplusplus /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up * in doxydocs. From 32b694d4f63a10e6368d444e8eace7dde6d9f1df Mon Sep 17 00:00:00 2001 From: Sherief Farouk Date: Sun, 4 Aug 2013 10:10:41 -0400 Subject: [PATCH 2/3] Added AI_WONT_RETURN_SUFFIX to ReportError(). --- code/ValidateDataStructure.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ValidateDataStructure.h b/code/ValidateDataStructure.h index e33bb5b82..4a3ec86d2 100644 --- a/code/ValidateDataStructure.h +++ b/code/ValidateDataStructure.h @@ -82,7 +82,7 @@ protected: /** Report a validation error. This will throw an exception, * control won't return. * @param msg Format string for sprintf().*/ - AI_WONT_RETURN void ReportError(const char* msg,...); + AI_WONT_RETURN void ReportError(const char* msg,...) AI_WONT_RETURN_SUFFIX; // ------------------------------------------------------------------- From ace5b763c3aef3cfbfcb8e364fb329b3e705661b Mon Sep 17 00:00:00 2001 From: Sherief Farouk Date: Sun, 4 Aug 2013 10:11:02 -0400 Subject: [PATCH 3/3] Added AI_WONT_RETURN and AI_WONT_RETURN_SUFFIX to DOMError. --- code/FBXDocumentUtil.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/FBXDocumentUtil.h b/code/FBXDocumentUtil.h index 7ff71937c..6f150b6d5 100644 --- a/code/FBXDocumentUtil.h +++ b/code/FBXDocumentUtil.h @@ -50,8 +50,8 @@ namespace Util { /* DOM/Parse error reporting - does not return */ -void DOMError(const std::string& message, const Token& token); -void DOMError(const std::string& message, const Element* element = NULL); +AI_WONT_RETURN void DOMError(const std::string& message, const Token& token) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN void DOMError(const std::string& message, const Element* element = NULL) AI_WONT_RETURN_SUFFIX; // does return void DOMWarning(const std::string& message, const Token& token);