diff --git a/code/AssetLib/AMF/AMFImporter.hpp b/code/AssetLib/AMF/AMFImporter.hpp index 601eae4e4..27f733043 100644 --- a/code/AssetLib/AMF/AMFImporter.hpp +++ b/code/AssetLib/AMF/AMFImporter.hpp @@ -282,11 +282,11 @@ public: bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const; bool Find_ConvertedNode(const std::string &pID, NodeArray &nodeArray, aiNode **pNode) const; bool Find_ConvertedMaterial(const std::string &pID, const SPP_Material **pConvertedMaterial) const; - void Throw_CloseNotFound(const std::string &nodeName); - void Throw_IncorrectAttr(const std::string &nodeName, const std::string &pAttrName); - void Throw_IncorrectAttrValue(const std::string &nodeName, const std::string &pAttrName); - void Throw_MoreThanOnceDefined(const std::string &nodeName, const std::string &pNodeType, const std::string &pDescription); - void Throw_ID_NotFound(const std::string &pID) const; + AI_WONT_RETURN void Throw_CloseNotFound(const std::string &nodeName) AI_WONT_RETURN_SUFFIX; + AI_WONT_RETURN void Throw_IncorrectAttr(const std::string &nodeName, const std::string &pAttrName) AI_WONT_RETURN_SUFFIX; + AI_WONT_RETURN void Throw_IncorrectAttrValue(const std::string &nodeName, const std::string &pAttrName) AI_WONT_RETURN_SUFFIX; + AI_WONT_RETURN void Throw_MoreThanOnceDefined(const std::string &nodeName, const std::string &pNodeType, const std::string &pDescription) AI_WONT_RETURN_SUFFIX; + AI_WONT_RETURN void Throw_ID_NotFound(const std::string &pID) const AI_WONT_RETURN_SUFFIX; void XML_CheckNode_MustHaveChildren(pugi::xml_node &node); bool XML_SearchNode(const std::string &nodeName); void ParseHelper_FixTruncatedFloatString(const char *pInStr, std::string &pOutString); diff --git a/code/AssetLib/FBX/FBXBinaryTokenizer.cpp b/code/AssetLib/FBX/FBXBinaryTokenizer.cpp index 8fb700179..4ab73f681 100644 --- a/code/AssetLib/FBX/FBXBinaryTokenizer.cpp +++ b/code/AssetLib/FBX/FBXBinaryTokenizer.cpp @@ -139,6 +139,7 @@ size_t Offset(const char* begin, const char* cursor) { } // ------------------------------------------------------------------------------------------------ +AI_WONT_RETURN void TokenizeError(const std::string& message, const char* begin, const char* cursor) AI_WONT_RETURN_SUFFIX; void TokenizeError(const std::string& message, const char* begin, const char* cursor) { TokenizeError(message, Offset(begin, cursor)); } diff --git a/code/AssetLib/FBX/FBXParser.cpp b/code/AssetLib/FBX/FBXParser.cpp index d71321452..c85841f8b 100644 --- a/code/AssetLib/FBX/FBXParser.cpp +++ b/code/AssetLib/FBX/FBXParser.cpp @@ -88,6 +88,7 @@ namespace { // ------------------------------------------------------------------------------------------------ + AI_WONT_RETURN void ParseError(const std::string& message, TokenPtr token) AI_WONT_RETURN_SUFFIX; void ParseError(const std::string& message, TokenPtr token) { if(token) { diff --git a/code/AssetLib/HMP/HMPLoader.h b/code/AssetLib/HMP/HMPLoader.h index 95ce0a9eb..4d5f5f22f 100644 --- a/code/AssetLib/HMP/HMPLoader.h +++ b/code/AssetLib/HMP/HMPLoader.h @@ -86,7 +86,7 @@ protected: // ------------------------------------------------------------------- /** Import a HMP4 file */ - void InternReadFile_HMP4(); + AI_WONT_RETURN void InternReadFile_HMP4() AI_WONT_RETURN_SUFFIX; // ------------------------------------------------------------------- /** Import a HMP5 file diff --git a/code/AssetLib/MD5/MD5Parser.h b/code/AssetLib/MD5/MD5Parser.h index bb4843cf9..ad7367e2a 100644 --- a/code/AssetLib/MD5/MD5Parser.h +++ b/code/AssetLib/MD5/MD5Parser.h @@ -365,9 +365,7 @@ public: static void ReportWarning (const char* warn, unsigned int line); - void ReportError (const char* error) { - return ReportError(error, lineNumber); - } + AI_WONT_RETURN void ReportError (const char* error) AI_WONT_RETURN_SUFFIX; void ReportWarning (const char* warn) { return ReportWarning(warn, lineNumber); @@ -404,6 +402,9 @@ private: unsigned int lineNumber; }; +inline void MD5Parser::ReportError(const char* error) { + ReportError(error, lineNumber); +} // ------------------------------------------------------------------- inline bool MD5Parser::SkipLine(const char* in, const char** out) { ++lineNumber; diff --git a/code/AssetLib/MDL/MDLLoader.h b/code/AssetLib/MDL/MDLLoader.h index b7d87e88d..433100938 100644 --- a/code/AssetLib/MDL/MDLLoader.h +++ b/code/AssetLib/MDL/MDLLoader.h @@ -139,7 +139,7 @@ protected: // ------------------------------------------------------------------- /** Import a CS:S/HL2 MDL file (not fully implemented) */ - void InternReadFile_HL2( ); + AI_WONT_RETURN void InternReadFile_HL2( ) AI_WONT_RETURN_SUFFIX; // ------------------------------------------------------------------- /** Check whether a given position is inside the valid range diff --git a/code/AssetLib/MMD/MMDPmxParser.h b/code/AssetLib/MMD/MMDPmxParser.h index f2e387975..424fc725a 100644 --- a/code/AssetLib/MMD/MMDPmxParser.h +++ b/code/AssetLib/MMD/MMDPmxParser.h @@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "MMDCpp14.h" namespace pmx @@ -730,7 +731,7 @@ namespace pmx std::unique_ptr anchers; int pin_vertex_count; std::unique_ptr pin_vertices; - void Read(std::istream *stream, PmxSetting *setting); + AI_WONT_RETURN void Read(std::istream *stream, PmxSetting *setting) AI_WONT_RETURN_SUFFIX; }; class PmxModel diff --git a/code/AssetLib/X3D/X3DImporter.hpp b/code/AssetLib/X3D/X3DImporter.hpp index 8852b71ec..705a2472e 100644 --- a/code/AssetLib/X3D/X3DImporter.hpp +++ b/code/AssetLib/X3D/X3DImporter.hpp @@ -55,6 +55,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include namespace Assimp { +AI_WONT_RETURN inline void Throw_ArgOutOfRange(const std::string &argument) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_CloseNotFound(const std::string &node) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_ConvertFail_Str2ArrF(const std::string &nodeName, const std::string &pAttrValue) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_ConvertFail_Str2ArrD(const std::string &nodeName, const std::string &pAttrValue) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_ConvertFail_Str2ArrB(const std::string &nodeName, const std::string &pAttrValue) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_ConvertFail_Str2ArrI(const std::string &nodeName, const std::string &pAttrValue) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_DEF_And_USE(const std::string &nodeName) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_IncorrectAttr(const std::string &nodeName, const std::string &pAttrName) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_IncorrectAttrValue(const std::string &nodeName, const std::string &pAttrName) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_MoreThanOnceDefined(const std::string &nodeName, const std::string &pNodeType, const std::string &pDescription) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_TagCountIncorrect(const std::string &pNode) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN inline void Throw_USE_NotFound(const std::string &nodeName, const std::string &pAttrValue) AI_WONT_RETURN_SUFFIX; inline void Throw_ArgOutOfRange(const std::string &argument) { throw DeadlyImportError("Argument value is out of range for: \"" + argument + "\"."); diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index fd3b1cb88..f13eadbdf 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1236,7 +1236,6 @@ IF (ASSIMP_WARNINGS_AS_ERRORS) -Wno-header-hygiene -Wno-tautological-value-range-compare -Wno-tautological-type-limit-compare - -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-extra-semi -Wno-nonportable-system-include-path diff --git a/contrib/Open3DGC/o3dgcArithmeticCodec.cpp b/contrib/Open3DGC/o3dgcArithmeticCodec.cpp index 2ae70fa2e..c1935822d 100644 --- a/contrib/Open3DGC/o3dgcArithmeticCodec.cpp +++ b/contrib/Open3DGC/o3dgcArithmeticCodec.cpp @@ -92,6 +92,7 @@ namespace o3dgc // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - Static functions - - - - - - - - - - - - - - - - - - - - - - - - - - - + AI_WONT_RETURN static void AC_Error(const char * msg) AI_WONT_RETURN_SUFFIX; static void AC_Error(const char * msg) { fprintf(stderr, "\n\n -> Arithmetic coding error: "); diff --git a/include/assimp/AssertHandler.h b/include/assimp/AssertHandler.h index 365a924b0..1247ff490 100644 --- a/include/assimp/AssertHandler.h +++ b/include/assimp/AssertHandler.h @@ -66,7 +66,7 @@ ASSIMP_API void setAiAssertHandler(AiAssertHandler handler); * * @brief This issues a message to stderr and calls abort. */ -ASSIMP_API void defaultAiAssertHandler(const char* failedExpression, const char* file, int line); +AI_WONT_RETURN ASSIMP_API void defaultAiAssertHandler(const char* failedExpression, const char* file, int line) AI_WONT_RETURN_SUFFIX; // --------------------------------------------------------------------------- /** diff --git a/include/assimp/defs.h b/include/assimp/defs.h index ddb209bec..34121e385 100644 --- a/include/assimp/defs.h +++ b/include/assimp/defs.h @@ -184,6 +184,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifdef __GNUC__ # define AI_WONT_RETURN_SUFFIX __attribute__((noreturn)) +#elif _MSC_VER +#if defined(__clang__) +# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn)) +#else +# define AI_WONT_RETURN_SUFFIX +#endif #else # define AI_WONT_RETURN_SUFFIX #endif // (defined __clang__)