Merge branch 'master' into msvc-clang-missing-variable-declarations

pull/5070/head
Kim Kulling 2023-04-26 11:15:32 +02:00 committed by GitHub
commit 230bee2e34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 55 additions and 39 deletions

View File

@ -138,7 +138,7 @@ IF (WIN32)
ELSE() ELSE()
OPTION( ASSIMP_BUILD_ZLIB OPTION( ASSIMP_BUILD_ZLIB
"Build your own zlib" "Build your own zlib"
OFF ON
) )
ENDIF() ENDIF()

View File

@ -68,7 +68,7 @@ using namespace D3DS;
class Discreet3DSImporter : public BaseImporter { class Discreet3DSImporter : public BaseImporter {
public: public:
Discreet3DSImporter(); Discreet3DSImporter();
~Discreet3DSImporter(); ~Discreet3DSImporter() override;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.

View File

@ -93,7 +93,7 @@ public:
// empty // empty
} }
~EmbeddedTexture() = default; ~EmbeddedTexture() override = default;
ResourceType getType() const override { ResourceType getType() const override {
return ResourceType::RT_EmbeddedTexture2D; return ResourceType::RT_EmbeddedTexture2D;
@ -110,7 +110,7 @@ public:
// empty // empty
} }
~Texture2DGroup() = default; ~Texture2DGroup() override = default;
ResourceType getType() const override { ResourceType getType() const override {
return ResourceType::RT_Texture2DGroup; return ResourceType::RT_Texture2DGroup;
@ -127,7 +127,7 @@ public:
// empty // empty
} }
~BaseMaterials() = default; ~BaseMaterials() override = default;
ResourceType getType() const override { ResourceType getType() const override {
return ResourceType::RT_BaseMaterials; return ResourceType::RT_BaseMaterials;
@ -152,7 +152,7 @@ public:
// empty // empty
} }
~Object() = default; ~Object() override = default;
ResourceType getType() const override { ResourceType getType() const override {
return ResourceType::RT_Object; return ResourceType::RT_Object;

View File

@ -282,11 +282,11 @@ public:
bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const; 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_ConvertedNode(const std::string &pID, NodeArray &nodeArray, aiNode **pNode) const;
bool Find_ConvertedMaterial(const std::string &pID, const SPP_Material **pConvertedMaterial) const; bool Find_ConvertedMaterial(const std::string &pID, const SPP_Material **pConvertedMaterial) const;
void Throw_CloseNotFound(const std::string &nodeName); AI_WONT_RETURN void Throw_CloseNotFound(const std::string &nodeName) AI_WONT_RETURN_SUFFIX;
void Throw_IncorrectAttr(const std::string &nodeName, const std::string &pAttrName); AI_WONT_RETURN void Throw_IncorrectAttr(const std::string &nodeName, const std::string &pAttrName) AI_WONT_RETURN_SUFFIX;
void Throw_IncorrectAttrValue(const std::string &nodeName, const std::string &pAttrName); AI_WONT_RETURN void Throw_IncorrectAttrValue(const std::string &nodeName, const std::string &pAttrName) AI_WONT_RETURN_SUFFIX;
void Throw_MoreThanOnceDefined(const std::string &nodeName, const std::string &pNodeType, const std::string &pDescription); AI_WONT_RETURN void Throw_MoreThanOnceDefined(const std::string &nodeName, const std::string &pNodeType, const std::string &pDescription) AI_WONT_RETURN_SUFFIX;
void Throw_ID_NotFound(const std::string &pID) const; AI_WONT_RETURN void Throw_ID_NotFound(const std::string &pID) const AI_WONT_RETURN_SUFFIX;
void XML_CheckNode_MustHaveChildren(pugi::xml_node &node); void XML_CheckNode_MustHaveChildren(pugi::xml_node &node);
bool XML_SearchNode(const std::string &nodeName); bool XML_SearchNode(const std::string &nodeName);
void ParseHelper_FixTruncatedFloatString(const char *pInStr, std::string &pOutString); void ParseHelper_FixTruncatedFloatString(const char *pInStr, std::string &pOutString);

View File

@ -1855,7 +1855,6 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
default: default:
// LineStrip is not supported due to expected index unmangling // LineStrip is not supported due to expected index unmangling
throw DeadlyImportError("Unsupported primitive type."); throw DeadlyImportError("Unsupported primitive type.");
break;
} }
// store the face size to later reconstruct the face from // store the face size to later reconstruct the face from

View File

@ -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) { void TokenizeError(const std::string& message, const char* begin, const char* cursor) {
TokenizeError(message, Offset(begin, cursor)); TokenizeError(message, Offset(begin, cursor));
} }

View File

@ -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) void ParseError(const std::string& message, TokenPtr token)
{ {
if(token) { if(token) {

View File

@ -86,7 +86,7 @@ protected:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Import a HMP4 file /** Import a HMP4 file
*/ */
void InternReadFile_HMP4(); AI_WONT_RETURN void InternReadFile_HMP4() AI_WONT_RETURN_SUFFIX;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Import a HMP5 file /** Import a HMP5 file

View File

@ -65,7 +65,6 @@ void LWOImporter::LoadLWOBFile()
if (mFileBuffer + head.length > end) if (mFileBuffer + head.length > end)
{ {
throw DeadlyImportError("LWOB: Invalid chunk length"); throw DeadlyImportError("LWOB: Invalid chunk length");
break;
} }
uint8_t* const next = mFileBuffer+head.length; uint8_t* const next = mFileBuffer+head.length;
switch (head.type) switch (head.type)

View File

@ -1486,7 +1486,6 @@ void LWOImporter::LoadLWO2File() {
if (mFileBuffer + head.length > end) { if (mFileBuffer + head.length > end) {
throw DeadlyImportError("LWO2: Chunk length points behind the file"); throw DeadlyImportError("LWO2: Chunk length points behind the file");
break;
} }
uint8_t *const next = mFileBuffer + head.length; uint8_t *const next = mFileBuffer + head.length;
mFileBuffer += bufOffset; mFileBuffer += bufOffset;

View File

@ -365,9 +365,7 @@ public:
static void ReportWarning (const char* warn, unsigned int line); static void ReportWarning (const char* warn, unsigned int line);
void ReportError (const char* error) { AI_WONT_RETURN void ReportError (const char* error) AI_WONT_RETURN_SUFFIX;
return ReportError(error, lineNumber);
}
void ReportWarning (const char* warn) { void ReportWarning (const char* warn) {
return ReportWarning(warn, lineNumber); return ReportWarning(warn, lineNumber);
@ -404,6 +402,9 @@ private:
unsigned int lineNumber; unsigned int lineNumber;
}; };
inline void MD5Parser::ReportError(const char* error) {
ReportError(error, lineNumber);
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
inline bool MD5Parser::SkipLine(const char* in, const char** out) { inline bool MD5Parser::SkipLine(const char* in, const char** out) {
++lineNumber; ++lineNumber;

View File

@ -139,7 +139,7 @@ protected:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Import a CS:S/HL2 MDL file (not fully implemented) /** 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 /** Check whether a given position is inside the valid range

View File

@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <memory> #include <memory>
#include <assimp/types.h>
#include "MMDCpp14.h" #include "MMDCpp14.h"
namespace pmx namespace pmx
@ -730,7 +731,7 @@ namespace pmx
std::unique_ptr<PmxAncherRigidBody []> anchers; std::unique_ptr<PmxAncherRigidBody []> anchers;
int pin_vertex_count; int pin_vertex_count;
std::unique_ptr<int []> pin_vertices; std::unique_ptr<int []> 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 class PmxModel

View File

@ -236,7 +236,7 @@ void ObjFileParser::parseFile(IOStreamBuffer<char> &streamBuffer) {
getNameNoSpace(m_DataIt, m_DataItEnd, name); getNameNoSpace(m_DataIt, m_DataItEnd, name);
insideCstype = name == "cstype"; insideCstype = name == "cstype";
goto pf_skip_line; goto pf_skip_line;
} break; }
default: { default: {
pf_skip_line: pf_skip_line:

View File

@ -382,11 +382,10 @@ void Q3DImporter::InternReadFile(const std::string &pFile,
// TODO // TODO
goto outer; goto outer;
} break; }
default: default:
throw DeadlyImportError("Quick3D: Unknown chunk"); throw DeadlyImportError("Quick3D: Unknown chunk");
break;
}; };
} }
outer: outer:

View File

@ -58,7 +58,7 @@ namespace Assimp {
class RAWImporter : public BaseImporter { class RAWImporter : public BaseImporter {
public: public:
RAWImporter(); RAWImporter();
~RAWImporter(); ~RAWImporter() override;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.

View File

@ -56,7 +56,7 @@ namespace Assimp {
class UnrealImporter : public BaseImporter { class UnrealImporter : public BaseImporter {
public: public:
UnrealImporter(); UnrealImporter();
~UnrealImporter(); ~UnrealImporter() override;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** @brief Returns whether we can handle the format of the given file /** @brief Returns whether we can handle the format of the given file

View File

@ -839,7 +839,6 @@ void XFileParser::ParseDataObjectAnimationKey(AnimBone *pAnimBone) {
default: default:
ThrowException("Unknown key type ", keyType, " in animation."); ThrowException("Unknown key type ", keyType, " in animation.");
break;
} // end switch } // end switch
// key separator // key separator

View File

@ -55,6 +55,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string> #include <string>
namespace Assimp { 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) { inline void Throw_ArgOutOfRange(const std::string &argument) {
throw DeadlyImportError("Argument value is out of range for: \"" + argument + "\"."); throw DeadlyImportError("Argument value is out of range for: \"" + argument + "\".");

View File

@ -483,7 +483,7 @@ private:
public: public:
Buffer(); Buffer();
~Buffer(); ~Buffer() override;
void Read(Value &obj, Asset &r); void Read(Value &obj, Asset &r);

View File

@ -1211,7 +1211,6 @@ IF (ASSIMP_WARNINGS_AS_ERRORS)
-Wno-undef -Wno-undef
-Wno-suggest-destructor-override -Wno-suggest-destructor-override
-Wno-suggest-override -Wno-suggest-override
-Wno-inconsistent-missing-destructor-override
-Wno-zero-as-null-pointer-constant -Wno-zero-as-null-pointer-constant
-Wno-global-constructors -Wno-global-constructors
-Wno-exit-time-destructors -Wno-exit-time-destructors
@ -1236,6 +1235,7 @@ IF (ASSIMP_WARNINGS_AS_ERRORS)
-Wno-tautological-value-range-compare -Wno-tautological-value-range-compare
-Wno-tautological-type-limit-compare -Wno-tautological-type-limit-compare
-Wno-missing-noreturn -Wno-missing-noreturn
-Wno-missing-variable-declarations
-Wno-extra-semi -Wno-extra-semi
-Wno-nonportable-system-include-path -Wno-nonportable-system-include-path
-Wno-undefined-reinterpret-cast -Wno-undefined-reinterpret-cast
@ -1245,7 +1245,6 @@ IF (ASSIMP_WARNINGS_AS_ERRORS)
-Wno-deprecated -Wno-deprecated
-Wno-format-nonliteral -Wno-format-nonliteral
-Wno-comma -Wno-comma
-Wno-unreachable-code-break
-Wno-implicit-fallthrough -Wno-implicit-fallthrough
-Wno-unused-template -Wno-unused-template
-Wno-undefined-func-template -Wno-undefined-func-template

View File

@ -68,7 +68,7 @@ class ZipFile : public IOStream {
public: public:
std::string m_Filename; std::string m_Filename;
virtual ~ZipFile(); virtual ~ZipFile() override;
// IOStream interface // IOStream interface
size_t Read(void *pvBuffer, size_t pSize, size_t pCount) override; size_t Read(void *pvBuffer, size_t pSize, size_t pCount) override;

View File

@ -290,7 +290,6 @@ void ValidateDSProcess::Validate(const aiMesh *pMesh) {
switch (face.mNumIndices) { switch (face.mNumIndices) {
case 0: case 0:
ReportError("aiMesh::mFaces[%i].mNumIndices is 0", i); ReportError("aiMesh::mFaces[%i].mNumIndices is 0", i);
break;
case 1: case 1:
if (0 == (pMesh->mPrimitiveTypes & aiPrimitiveType_POINT)) { if (0 == (pMesh->mPrimitiveTypes & aiPrimitiveType_POINT)) {
ReportError("aiMesh::mFaces[%i] is a POINT but aiMesh::mPrimitiveTypes " ReportError("aiMesh::mFaces[%i] is a POINT but aiMesh::mPrimitiveTypes "

View File

@ -92,6 +92,7 @@ namespace o3dgc
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - Static functions - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - Static functions - - - - - - - - - - - - - - - - - - - - - - - - - - -
AI_WONT_RETURN static void AC_Error(const char * msg) AI_WONT_RETURN_SUFFIX;
static void AC_Error(const char * msg) static void AC_Error(const char * msg)
{ {
fprintf(stderr, "\n\n -> Arithmetic coding error: "); fprintf(stderr, "\n\n -> Arithmetic coding error: ");

View File

@ -66,7 +66,7 @@ ASSIMP_API void setAiAssertHandler(AiAssertHandler handler);
* *
* @brief This issues a message to stderr and calls abort. * @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;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** /**

View File

@ -84,7 +84,7 @@ protected:
public: public:
/** Destructor public to allow simple deletion to close the file. */ /** Destructor public to allow simple deletion to close the file. */
~DefaultIOStream (); ~DefaultIOStream () override;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/// Read from stream /// Read from stream

View File

@ -145,7 +145,7 @@ public:
} }
/// @brief Destructor. /// @brief Destructor.
~MemoryIOSystem() = default; ~MemoryIOSystem() override = default;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/// @brief Tests for the existence of a file at the given path. /// @brief Tests for the existence of a file at the given path.

View File

@ -63,7 +63,7 @@ public:
//! Open a Zip using the proffered IOSystem //! Open a Zip using the proffered IOSystem
ZipArchiveIOSystem(IOSystem* pIOHandler, const char *pFilename, const char* pMode = "r"); ZipArchiveIOSystem(IOSystem* pIOHandler, const char *pFilename, const char* pMode = "r");
ZipArchiveIOSystem(IOSystem* pIOHandler, const std::string& rFilename, const char* pMode = "r"); ZipArchiveIOSystem(IOSystem* pIOHandler, const std::string& rFilename, const char* pMode = "r");
virtual ~ZipArchiveIOSystem(); virtual ~ZipArchiveIOSystem() override;
bool Exists(const char* pFilename) const override; bool Exists(const char* pFilename) const override;
char getOsSeparator() const override; char getOsSeparator() const override;
IOStream* Open(const char* pFilename, const char* pMode = "rb") override; IOStream* Open(const char* pFilename, const char* pMode = "rb") override;

View File

@ -184,6 +184,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef __GNUC__ #ifdef __GNUC__
# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn)) # 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 #else
# define AI_WONT_RETURN_SUFFIX # define AI_WONT_RETURN_SUFFIX
#endif // (defined __clang__) #endif // (defined __clang__)