From 84a9514d4b41849fcdfffbe706ab70200852740a Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 13 Feb 2015 12:14:39 +0200 Subject: [PATCH 1/8] Fix warning about possibly uninitialized variable It might be better to move FindEmptyUVChannel call earlier --- code/ComputeUVMappingProcess.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ComputeUVMappingProcess.cpp b/code/ComputeUVMappingProcess.cpp index 16b9bbfb0..2f037edb1 100644 --- a/code/ComputeUVMappingProcess.cpp +++ b/code/ComputeUVMappingProcess.cpp @@ -454,7 +454,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene) for (unsigned int m = 0; m < pScene->mNumMeshes;++m) { aiMesh* mesh = pScene->mMeshes[m]; - unsigned int outIdx; + unsigned int outIdx = 0; if ( mesh->mMaterialIndex != i || ( outIdx = FindEmptyUVChannel(mesh) ) == UINT_MAX || !mesh->mNumVertices) { From f708d0b122bde569482f3dceb9e0774adcecf2a8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 13 Feb 2015 12:21:59 +0200 Subject: [PATCH 2/8] Silence some uninitialized variable warnings These are false positives but the compiler isn't smart enough to see that. Also it might make more sense to use switch here. --- code/TextureTransform.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/TextureTransform.cpp b/code/TextureTransform.cpp index 1c27863e3..ca4f4ce73 100644 --- a/code/TextureTransform.cpp +++ b/code/TextureTransform.cpp @@ -120,7 +120,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info) * offset 2 and 3) */ if ((rounded = (int)info.mTranslation.x)) { - float out; + float out = 0.0f; szTemp[0] = 0; if (aiTextureMapMode_Wrap == info.mapU) { // Wrap - simple take the fraction of the field @@ -153,7 +153,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info) * offset 2 and 3) */ if ((rounded = (int)info.mTranslation.y)) { - float out; + float out = 0.0f; szTemp[0] = 0; if (aiTextureMapMode_Wrap == info.mapV) { // Wrap - simple take the fraction of the field From 570d02ff6e93e30b5d45d48231e7f7cba5f85162 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 13 Feb 2015 12:37:40 +0200 Subject: [PATCH 3/8] Silence more uninitialized variable warnings These are false positives since aiMaterial::Get will have written to output if it returns AI_SUCCESS but the compiler can't see that. --- code/3DSExporter.cpp | 2 +- code/ColladaExporter.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/3DSExporter.cpp b/code/3DSExporter.cpp index 8ad367058..1b870181c 100644 --- a/code/3DSExporter.cpp +++ b/code/3DSExporter.cpp @@ -294,7 +294,7 @@ void Discreet3DSExporter::WriteMaterials() WriteColor(color); } - aiShadingMode shading_mode; + aiShadingMode shading_mode = aiShadingMode_Flat; if (mat.Get(AI_MATKEY_SHADING_MODEL, shading_mode) == AI_SUCCESS) { ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_SHADING); diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp index d2e85a015..db76e38a9 100644 --- a/code/ColladaExporter.cpp +++ b/code/ColladaExporter.cpp @@ -452,7 +452,7 @@ void ColladaExporter::WriteMaterials() } } - aiShadingMode shading; + aiShadingMode shading = aiShadingMode_Flat; materials[a].shading_model = "phong"; if(mat->Get( AI_MATKEY_SHADING_MODEL, shading) == aiReturn_SUCCESS) { if(shading == aiShadingMode_Phong) { From e8bcad0840d84899d3c9e323dbe1efcaa4423d0b Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 13 Feb 2015 13:17:47 +0200 Subject: [PATCH 4/8] Silence a warning and add an assertion Another false positive uninitialized variable. Actually it's only false if ToOutputVertexIndex does't return NULL which should only happen if index is out of bounds. Add assertion to make sure of that. --- code/FBXConverter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index 9ad6a2f16..7bd15736f 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -1256,8 +1256,11 @@ private: // taking notes so we don't need to do it twice. BOOST_FOREACH(WeightIndexArray::value_type index, indices) { - unsigned int count; + unsigned int count = 0; const unsigned int* const out_idx = geo.ToOutputVertexIndex(index, count); + // ToOutputVertexIndex only returns NULL if index is out of bounds + // which should never happen + ai_assert(out_idx != NULL); index_out_indices.push_back(no_index_sentinel); count_out_indices.push_back(0); From 308884f144b0f6648e7ae21e75427cf666befcff Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 13 Feb 2015 13:54:06 +0200 Subject: [PATCH 5/8] Remove unnecessary semicolons after function definition Picked up by clang -Wextra-semi --- code/AssbinExporter.cpp | 10 +++++----- code/irrXMLWrapper.h | 2 +- include/assimp/Importer.hpp | 4 ++-- include/assimp/ProgressHandler.hpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/code/AssbinExporter.cpp b/code/AssbinExporter.cpp index b1999d2b1..6b4da3e30 100644 --- a/code/AssbinExporter.cpp +++ b/code/AssbinExporter.cpp @@ -273,13 +273,13 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) if (buffer) delete[] buffer; } - void * GetBufferPointer() { return buffer; }; + void * GetBufferPointer() { return buffer; } // ------------------------------------------------------------------- - virtual size_t Read(void* /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) { return 0; }; - virtual aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) { return aiReturn_FAILURE; }; - virtual size_t Tell() const { return cursor; }; - virtual void Flush() { }; + virtual size_t Read(void* /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) { return 0; } + virtual aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) { return aiReturn_FAILURE; } + virtual size_t Tell() const { return cursor; } + virtual void Flush() { } virtual size_t FileSize() const { diff --git a/code/irrXMLWrapper.h b/code/irrXMLWrapper.h index 569347e2b..134c2f8dd 100644 --- a/code/irrXMLWrapper.h +++ b/code/irrXMLWrapper.h @@ -102,7 +102,7 @@ public: // ---------------------------------------------------------------------------------- //! Virtual destructor - virtual ~CIrrXML_IOStreamReader() {}; + virtual ~CIrrXML_IOStreamReader() {} // ---------------------------------------------------------------------------------- //! Reads an amount of bytes from the file. diff --git a/include/assimp/Importer.hpp b/include/assimp/Importer.hpp index 5e7797b99..7138ddc7d 100644 --- a/include/assimp/Importer.hpp +++ b/include/assimp/Importer.hpp @@ -624,8 +624,8 @@ public: // ------------------------------------------------------------------- /** Private, do not use. */ - ImporterPimpl* Pimpl() { return pimpl; }; - const ImporterPimpl* Pimpl() const { return pimpl; }; + ImporterPimpl* Pimpl() { return pimpl; } + const ImporterPimpl* Pimpl() const { return pimpl; } protected: diff --git a/include/assimp/ProgressHandler.hpp b/include/assimp/ProgressHandler.hpp index 3ab1e489b..be1dbd75e 100644 --- a/include/assimp/ProgressHandler.hpp +++ b/include/assimp/ProgressHandler.hpp @@ -99,7 +99,7 @@ public: virtual void UpdateFileRead(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) { float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f; Update( f * 0.5f ); - }; + } // ------------------------------------------------------------------- /** @brief Progress callback for post-processing steps @@ -113,7 +113,7 @@ public: virtual void UpdatePostProcess(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) { float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f; Update( f * 0.5f + 0.5f ); - }; + } }; // !class ProgressHandler // ------------------------------------------------------------------------------------ From dfd171be6d5e2c13bef14cd6752a6ef344210d48 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 13 Feb 2015 13:54:43 +0200 Subject: [PATCH 6/8] Remove unnecessary semicolons after FBXDocument property declarations --- code/FBXDocument.h | 240 ++++++++++++++++++++++----------------------- 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/code/FBXDocument.h b/code/FBXDocument.h index 8cf8202a1..b4099550b 100644 --- a/code/FBXDocument.h +++ b/code/FBXDocument.h @@ -242,20 +242,20 @@ public: public: - fbx_simple_property(Position, aiVector3D, aiVector3D(0,0,0)); - fbx_simple_property(UpVector, aiVector3D, aiVector3D(0,1,0)); - fbx_simple_property(InterestPosition, aiVector3D, aiVector3D(0,0,0)); + fbx_simple_property(Position, aiVector3D, aiVector3D(0,0,0)) + fbx_simple_property(UpVector, aiVector3D, aiVector3D(0,1,0)) + fbx_simple_property(InterestPosition, aiVector3D, aiVector3D(0,0,0)) - fbx_simple_property(AspectWidth, float, 1.0f); - fbx_simple_property(AspectHeight, float, 1.0f); - fbx_simple_property(FilmWidth, float, 1.0f); - fbx_simple_property(FilmHeight, float, 1.0f); + fbx_simple_property(AspectWidth, float, 1.0f) + fbx_simple_property(AspectHeight, float, 1.0f) + fbx_simple_property(FilmWidth, float, 1.0f) + fbx_simple_property(FilmHeight, float, 1.0f) - fbx_simple_property(FilmAspectRatio, float, 1.0f); - fbx_simple_property(ApertureMode, int, 0); + fbx_simple_property(FilmAspectRatio, float, 1.0f) + fbx_simple_property(ApertureMode, int, 0) - fbx_simple_property(FieldOfView, float, 1.0f); - fbx_simple_property(FocalLength, float, 1.0f); + fbx_simple_property(FieldOfView, float, 1.0f) + fbx_simple_property(FocalLength, float, 1.0f) private: }; @@ -314,37 +314,37 @@ public: public: - fbx_simple_property(Color, aiVector3D, aiVector3D(1,1,1)); - fbx_simple_enum_property(LightType, Type, 0); - fbx_simple_property(CastLightOnObject, bool, false); - fbx_simple_property(DrawVolumetricLight, bool, true); - fbx_simple_property(DrawGroundProjection, bool, true); - fbx_simple_property(DrawFrontFacingVolumetricLight, bool, false); - fbx_simple_property(Intensity, float, 1.0f); - fbx_simple_property(InnerAngle, float, 0.0f); - fbx_simple_property(OuterAngle, float, 45.0f); - fbx_simple_property(Fog, int, 50); - fbx_simple_enum_property(DecayType, Decay, 0); - fbx_simple_property(DecayStart, int, 0); - fbx_simple_property(FileName, std::string, ""); + fbx_simple_property(Color, aiVector3D, aiVector3D(1,1,1)) + fbx_simple_enum_property(LightType, Type, 0) + fbx_simple_property(CastLightOnObject, bool, false) + fbx_simple_property(DrawVolumetricLight, bool, true) + fbx_simple_property(DrawGroundProjection, bool, true) + fbx_simple_property(DrawFrontFacingVolumetricLight, bool, false) + fbx_simple_property(Intensity, float, 1.0f) + fbx_simple_property(InnerAngle, float, 0.0f) + fbx_simple_property(OuterAngle, float, 45.0f) + fbx_simple_property(Fog, int, 50) + fbx_simple_enum_property(DecayType, Decay, 0) + fbx_simple_property(DecayStart, int, 0) + fbx_simple_property(FileName, std::string, "") - fbx_simple_property(EnableNearAttenuation, bool, false); - fbx_simple_property(NearAttenuationStart, float, 0.0f); - fbx_simple_property(NearAttenuationEnd, float, 0.0f); - fbx_simple_property(EnableFarAttenuation, bool, false); - fbx_simple_property(FarAttenuationStart, float, 0.0f); - fbx_simple_property(FarAttenuationEnd, float, 0.0f); + fbx_simple_property(EnableNearAttenuation, bool, false) + fbx_simple_property(NearAttenuationStart, float, 0.0f) + fbx_simple_property(NearAttenuationEnd, float, 0.0f) + fbx_simple_property(EnableFarAttenuation, bool, false) + fbx_simple_property(FarAttenuationStart, float, 0.0f) + fbx_simple_property(FarAttenuationEnd, float, 0.0f) - fbx_simple_property(CastShadows, bool, true); - fbx_simple_property(ShadowColor, aiVector3D, aiVector3D(0,0,0)); + fbx_simple_property(CastShadows, bool, true) + fbx_simple_property(ShadowColor, aiVector3D, aiVector3D(0,0,0)) - fbx_simple_property(AreaLightShape, int, 0); + fbx_simple_property(AreaLightShape, int, 0) - fbx_simple_property(LeftBarnDoor, float, 20.0f); - fbx_simple_property(RightBarnDoor, float, 20.0f); - fbx_simple_property(TopBarnDoor, float, 20.0f); - fbx_simple_property(BottomBarnDoor, float, 20.0f); - fbx_simple_property(EnableBarnDoor, bool, true); + fbx_simple_property(LeftBarnDoor, float, 20.0f) + fbx_simple_property(RightBarnDoor, float, 20.0f) + fbx_simple_property(TopBarnDoor, float, 20.0f) + fbx_simple_property(BottomBarnDoor, float, 20.0f) + fbx_simple_property(EnableBarnDoor, bool, true) private: @@ -387,81 +387,81 @@ public: public: - fbx_simple_property(QuaternionInterpolate, int, 0); + fbx_simple_property(QuaternionInterpolate, int, 0) - fbx_simple_property(RotationOffset, aiVector3D, aiVector3D()); - fbx_simple_property(RotationPivot, aiVector3D, aiVector3D()); - fbx_simple_property(ScalingOffset, aiVector3D, aiVector3D()); - fbx_simple_property(ScalingPivot, aiVector3D, aiVector3D()); - fbx_simple_property(TranslationActive, bool, false); + fbx_simple_property(RotationOffset, aiVector3D, aiVector3D()) + fbx_simple_property(RotationPivot, aiVector3D, aiVector3D()) + fbx_simple_property(ScalingOffset, aiVector3D, aiVector3D()) + fbx_simple_property(ScalingPivot, aiVector3D, aiVector3D()) + fbx_simple_property(TranslationActive, bool, false) - fbx_simple_property(TranslationMin, aiVector3D, aiVector3D()); - fbx_simple_property(TranslationMax, aiVector3D, aiVector3D()); + fbx_simple_property(TranslationMin, aiVector3D, aiVector3D()) + fbx_simple_property(TranslationMax, aiVector3D, aiVector3D()) - fbx_simple_property(TranslationMinX, bool, false); - fbx_simple_property(TranslationMaxX, bool, false); - fbx_simple_property(TranslationMinY, bool, false); - fbx_simple_property(TranslationMaxY, bool, false); - fbx_simple_property(TranslationMinZ, bool, false); - fbx_simple_property(TranslationMaxZ, bool, false); + fbx_simple_property(TranslationMinX, bool, false) + fbx_simple_property(TranslationMaxX, bool, false) + fbx_simple_property(TranslationMinY, bool, false) + fbx_simple_property(TranslationMaxY, bool, false) + fbx_simple_property(TranslationMinZ, bool, false) + fbx_simple_property(TranslationMaxZ, bool, false) - fbx_simple_enum_property(RotationOrder, RotOrder, 0); - fbx_simple_property(RotationSpaceForLimitOnly, bool, false); - fbx_simple_property(RotationStiffnessX, float, 0.0f); - fbx_simple_property(RotationStiffnessY, float, 0.0f); - fbx_simple_property(RotationStiffnessZ, float, 0.0f); - fbx_simple_property(AxisLen, float, 0.0f); + fbx_simple_enum_property(RotationOrder, RotOrder, 0) + fbx_simple_property(RotationSpaceForLimitOnly, bool, false) + fbx_simple_property(RotationStiffnessX, float, 0.0f) + fbx_simple_property(RotationStiffnessY, float, 0.0f) + fbx_simple_property(RotationStiffnessZ, float, 0.0f) + fbx_simple_property(AxisLen, float, 0.0f) - fbx_simple_property(PreRotation, aiVector3D, aiVector3D()); - fbx_simple_property(PostRotation, aiVector3D, aiVector3D()); - fbx_simple_property(RotationActive, bool, false); + fbx_simple_property(PreRotation, aiVector3D, aiVector3D()) + fbx_simple_property(PostRotation, aiVector3D, aiVector3D()) + fbx_simple_property(RotationActive, bool, false) - fbx_simple_property(RotationMin, aiVector3D, aiVector3D()); - fbx_simple_property(RotationMax, aiVector3D, aiVector3D()); + fbx_simple_property(RotationMin, aiVector3D, aiVector3D()) + fbx_simple_property(RotationMax, aiVector3D, aiVector3D()) - fbx_simple_property(RotationMinX, bool, false); - fbx_simple_property(RotationMaxX, bool, false); - fbx_simple_property(RotationMinY, bool, false); - fbx_simple_property(RotationMaxY, bool, false); - fbx_simple_property(RotationMinZ, bool, false); - fbx_simple_property(RotationMaxZ, bool, false); - fbx_simple_enum_property(InheritType, TransformInheritance, 0); + fbx_simple_property(RotationMinX, bool, false) + fbx_simple_property(RotationMaxX, bool, false) + fbx_simple_property(RotationMinY, bool, false) + fbx_simple_property(RotationMaxY, bool, false) + fbx_simple_property(RotationMinZ, bool, false) + fbx_simple_property(RotationMaxZ, bool, false) + fbx_simple_enum_property(InheritType, TransformInheritance, 0) - fbx_simple_property(ScalingActive, bool, false); - fbx_simple_property(ScalingMin, aiVector3D, aiVector3D()); - fbx_simple_property(ScalingMax, aiVector3D, aiVector3D(1.f,1.f,1.f)); - fbx_simple_property(ScalingMinX, bool, false); - fbx_simple_property(ScalingMaxX, bool, false); - fbx_simple_property(ScalingMinY, bool, false); - fbx_simple_property(ScalingMaxY, bool, false); - fbx_simple_property(ScalingMinZ, bool, false); - fbx_simple_property(ScalingMaxZ, bool, false); + fbx_simple_property(ScalingActive, bool, false) + fbx_simple_property(ScalingMin, aiVector3D, aiVector3D()) + fbx_simple_property(ScalingMax, aiVector3D, aiVector3D(1.f,1.f,1.f)) + fbx_simple_property(ScalingMinX, bool, false) + fbx_simple_property(ScalingMaxX, bool, false) + fbx_simple_property(ScalingMinY, bool, false) + fbx_simple_property(ScalingMaxY, bool, false) + fbx_simple_property(ScalingMinZ, bool, false) + fbx_simple_property(ScalingMaxZ, bool, false) - fbx_simple_property(GeometricTranslation, aiVector3D, aiVector3D()); - fbx_simple_property(GeometricRotation, aiVector3D, aiVector3D()); - fbx_simple_property(GeometricScaling, aiVector3D, aiVector3D(1.f, 1.f, 1.f)); + fbx_simple_property(GeometricTranslation, aiVector3D, aiVector3D()) + fbx_simple_property(GeometricRotation, aiVector3D, aiVector3D()) + fbx_simple_property(GeometricScaling, aiVector3D, aiVector3D(1.f, 1.f, 1.f)) - fbx_simple_property(MinDampRangeX, float, 0.0f); - fbx_simple_property(MinDampRangeY, float, 0.0f); - fbx_simple_property(MinDampRangeZ, float, 0.0f); - fbx_simple_property(MaxDampRangeX, float, 0.0f); - fbx_simple_property(MaxDampRangeY, float, 0.0f); - fbx_simple_property(MaxDampRangeZ, float, 0.0f); + fbx_simple_property(MinDampRangeX, float, 0.0f) + fbx_simple_property(MinDampRangeY, float, 0.0f) + fbx_simple_property(MinDampRangeZ, float, 0.0f) + fbx_simple_property(MaxDampRangeX, float, 0.0f) + fbx_simple_property(MaxDampRangeY, float, 0.0f) + fbx_simple_property(MaxDampRangeZ, float, 0.0f) - fbx_simple_property(MinDampStrengthX, float, 0.0f); - fbx_simple_property(MinDampStrengthY, float, 0.0f); - fbx_simple_property(MinDampStrengthZ, float, 0.0f); - fbx_simple_property(MaxDampStrengthX, float, 0.0f); - fbx_simple_property(MaxDampStrengthY, float, 0.0f); - fbx_simple_property(MaxDampStrengthZ, float, 0.0f); + fbx_simple_property(MinDampStrengthX, float, 0.0f) + fbx_simple_property(MinDampStrengthY, float, 0.0f) + fbx_simple_property(MinDampStrengthZ, float, 0.0f) + fbx_simple_property(MaxDampStrengthX, float, 0.0f) + fbx_simple_property(MaxDampStrengthY, float, 0.0f) + fbx_simple_property(MaxDampStrengthZ, float, 0.0f) - fbx_simple_property(PreferredAngleX, float, 0.0f); - fbx_simple_property(PreferredAngleY, float, 0.0f); - fbx_simple_property(PreferredAngleZ, float, 0.0f); + fbx_simple_property(PreferredAngleX, float, 0.0f) + fbx_simple_property(PreferredAngleY, float, 0.0f) + fbx_simple_property(PreferredAngleZ, float, 0.0f) - fbx_simple_property(Show, bool, true); - fbx_simple_property(LODBox, bool, false); - fbx_simple_property(Freeze, bool, false); + fbx_simple_property(Show, bool, true) + fbx_simple_property(LODBox, bool, false) + fbx_simple_property(Freeze, bool, false) public: @@ -1015,10 +1015,10 @@ public: public: - fbx_simple_property(LocalStart, uint64_t, 0L); - fbx_simple_property(LocalStop, uint64_t, 0L); - fbx_simple_property(ReferenceStart, uint64_t, 0L); - fbx_simple_property(ReferenceStop, uint64_t, 0L); + fbx_simple_property(LocalStart, uint64_t, 0L) + fbx_simple_property(LocalStop, uint64_t, 0L) + fbx_simple_property(ReferenceStart, uint64_t, 0L) + fbx_simple_property(ReferenceStop, uint64_t, 0L) @@ -1227,18 +1227,18 @@ public: } - fbx_simple_property(UpAxis, int, 1); - fbx_simple_property(UpAxisSign, int, 1); - fbx_simple_property(FrontAxis, int, 2); - fbx_simple_property(FrontAxisSign, int, 1); - fbx_simple_property(CoordAxis, int, 0); - fbx_simple_property(CoordAxisSign, int, 1); - fbx_simple_property(OriginalUpAxis, int, 0); - fbx_simple_property(OriginalUpAxisSign, int, 1); - fbx_simple_property(UnitScaleFactor, double, 1); - fbx_simple_property(OriginalUnitScaleFactor, double, 1); - fbx_simple_property(AmbientColor, aiVector3D, aiVector3D(0,0,0)); - fbx_simple_property(DefaultCamera, std::string, ""); + fbx_simple_property(UpAxis, int, 1) + fbx_simple_property(UpAxisSign, int, 1) + fbx_simple_property(FrontAxis, int, 2) + fbx_simple_property(FrontAxisSign, int, 1) + fbx_simple_property(CoordAxis, int, 0) + fbx_simple_property(CoordAxisSign, int, 1) + fbx_simple_property(OriginalUpAxis, int, 0) + fbx_simple_property(OriginalUpAxisSign, int, 1) + fbx_simple_property(UnitScaleFactor, double, 1) + fbx_simple_property(OriginalUnitScaleFactor, double, 1) + fbx_simple_property(AmbientColor, aiVector3D, aiVector3D(0,0,0)) + fbx_simple_property(DefaultCamera, std::string, "") enum FrameRate { @@ -1261,10 +1261,10 @@ public: FrameRate_MAX// end-of-enum sentinel }; - fbx_simple_enum_property(TimeMode, FrameRate, FrameRate_DEFAULT); - fbx_simple_property(TimeSpanStart, uint64_t, 0L); - fbx_simple_property(TimeSpanStop, uint64_t, 0L); - fbx_simple_property(CustomFrameRate, float, -1.0f); + fbx_simple_enum_property(TimeMode, FrameRate, FrameRate_DEFAULT) + fbx_simple_property(TimeSpanStart, uint64_t, 0L) + fbx_simple_property(TimeSpanStop, uint64_t, 0L) + fbx_simple_property(CustomFrameRate, float, -1.0f) private: From db6d8a4dc5b938b6349da378735d231e5fb31fb7 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 13 Feb 2015 14:21:09 +0200 Subject: [PATCH 7/8] Use attribute noreturn on both GCC and Clang Both GCC and Clang define __GNUC__ and both also understand attribute noreturn. --- include/assimp/defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/assimp/defs.h b/include/assimp/defs.h index e0019f893..70bb7e570 100644 --- a/include/assimp/defs.h +++ b/include/assimp/defs.h @@ -162,8 +162,8 @@ 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)) +#ifdef __GNUC__ +# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn)) #else # define AI_WONT_RETURN_SUFFIX #endif // (defined __clang__) From 5a74e07f5f1d8639bd9c662644e1d06c846cb425 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 13 Feb 2015 14:45:36 +0200 Subject: [PATCH 8/8] Mark some more functions with AI_WONT_RETURN --- code/ASEParser.cpp | 2 +- code/ASEParser.h | 2 +- code/B3DImporter.cpp | 4 ++-- code/B3DImporter.h | 4 ++-- code/BVHLoader.cpp | 2 +- code/BVHLoader.h | 2 +- code/COBLoader.cpp | 2 +- code/COBLoader.h | 2 +- code/ColladaParser.cpp | 2 +- code/ColladaParser.h | 2 +- code/FBXBinaryTokenizer.cpp | 3 ++- code/FBXParser.cpp | 6 ++++-- code/FBXTokenizer.cpp | 3 ++- code/MD5Parser.cpp | 2 +- code/MD5Parser.h | 2 +- code/OgreXmlSerializer.cpp | 3 ++- code/XFileParser.cpp | 2 +- code/XFileParser.h | 2 +- tools/assimp_cmd/CompareDump.cpp | 2 +- 19 files changed, 27 insertions(+), 22 deletions(-) diff --git a/code/ASEParser.cpp b/code/ASEParser.cpp index cba206d72..98dd30457 100644 --- a/code/ASEParser.cpp +++ b/code/ASEParser.cpp @@ -168,7 +168,7 @@ void Parser::LogInfo(const char* szWarn) } // ------------------------------------------------------------------------------------------------ -void Parser::LogError(const char* szWarn) +AI_WONT_RETURN void Parser::LogError(const char* szWarn) { ai_assert(NULL != szWarn); diff --git a/code/ASEParser.h b/code/ASEParser.h index 84192e5c9..e7a01c9da 100644 --- a/code/ASEParser.h +++ b/code/ASEParser.h @@ -602,7 +602,7 @@ private: // ------------------------------------------------------------------- //! Output an error to the logger //! \param szWarn Error message - void LogError(const char* szWarn); + AI_WONT_RETURN void LogError(const char* szWarn) AI_WONT_RETURN_SUFFIX; // ------------------------------------------------------------------- //! Parse a string, enclosed in double quotation marks diff --git a/code/B3DImporter.cpp b/code/B3DImporter.cpp index 20e4cff94..aa862a1fe 100644 --- a/code/B3DImporter.cpp +++ b/code/B3DImporter.cpp @@ -127,12 +127,12 @@ void B3DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS } // ------------------------------------------------------------------------------------------------ -void B3DImporter::Oops(){ +AI_WONT_RETURN void B3DImporter::Oops(){ throw DeadlyImportError( "B3D Importer - INTERNAL ERROR" ); } // ------------------------------------------------------------------------------------------------ -void B3DImporter::Fail( string str ){ +AI_WONT_RETURN void B3DImporter::Fail( string str ){ #ifdef DEBUG_B3D cout<<"Error in B3D file data: "<KeyToken()); diff --git a/code/FBXTokenizer.cpp b/code/FBXTokenizer.cpp index caa80c191..88ac1257d 100644 --- a/code/FBXTokenizer.cpp +++ b/code/FBXTokenizer.cpp @@ -86,7 +86,8 @@ namespace { // ------------------------------------------------------------------------------------------------ // signal tokenization error, this is always unrecoverable. Throws DeadlyImportError. -void TokenizeError(const std::string& message, unsigned int line, unsigned int column) +AI_WONT_RETURN void TokenizeError(const std::string& message, unsigned int line, unsigned int column) AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN void TokenizeError(const std::string& message, unsigned int line, unsigned int column) { throw DeadlyImportError(Util::AddLineAndColumn("FBX-Tokenize",message,line,column)); } diff --git a/code/MD5Parser.cpp b/code/MD5Parser.cpp index cf3590b62..2ca348b64 100644 --- a/code/MD5Parser.cpp +++ b/code/MD5Parser.cpp @@ -88,7 +88,7 @@ MD5Parser::MD5Parser(char* _buffer, unsigned int _fileSize ) // ------------------------------------------------------------------------------------------------ // Report error to the log stream -/*static*/ void MD5Parser::ReportError (const char* error, unsigned int line) +/*static*/ AI_WONT_RETURN void MD5Parser::ReportError (const char* error, unsigned int line) { char szBuffer[1024]; ::sprintf(szBuffer,"[MD5] Line %i: %s",line,error); diff --git a/code/MD5Parser.h b/code/MD5Parser.h index 844a783bb..31b0e2038 100644 --- a/code/MD5Parser.h +++ b/code/MD5Parser.h @@ -367,7 +367,7 @@ public: * @param error Error message to be reported * @param line Index of the line where the error occured */ - static void ReportError (const char* error, unsigned int line); + AI_WONT_RETURN static void ReportError (const char* error, unsigned int line) AI_WONT_RETURN_SUFFIX; // ------------------------------------------------------------------- /** Report a specific warning diff --git a/code/OgreXmlSerializer.cpp b/code/OgreXmlSerializer.cpp index 733e36c03..ffda7967e 100644 --- a/code/OgreXmlSerializer.cpp +++ b/code/OgreXmlSerializer.cpp @@ -54,7 +54,8 @@ namespace Assimp namespace Ogre { -void ThrowAttibuteError(const XmlReader* reader, const std::string &name, const std::string &error = "") +AI_WONT_RETURN void ThrowAttibuteError(const XmlReader* reader, const std::string &name, const std::string &error = "") AI_WONT_RETURN_SUFFIX; +AI_WONT_RETURN void ThrowAttibuteError(const XmlReader* reader, const std::string &name, const std::string &error) { if (!error.empty()) { diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index a62aef414..96fb89cae 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -1432,7 +1432,7 @@ aiColor3D XFileParser::ReadRGB() // ------------------------------------------------------------------------------------------------ // Throws an exception with a line number and the given text. -void XFileParser::ThrowException( const std::string& pText) +AI_WONT_RETURN void XFileParser::ThrowException( const std::string& pText) { if( mIsBinaryFormat) throw DeadlyImportError( pText); diff --git a/code/XFileParser.h b/code/XFileParser.h index 900555f32..d6144e822 100644 --- a/code/XFileParser.h +++ b/code/XFileParser.h @@ -134,7 +134,7 @@ protected: aiColor4D ReadRGBA(); /** Throws an exception with a line number and the given text. */ - void ThrowException( const std::string& pText); + AI_WONT_RETURN void ThrowException( const std::string& pText) AI_WONT_RETURN_SUFFIX; /** Filters the imported hierarchy for some degenerated cases that some exporters produce. * @param pData The sub-hierarchy to filter diff --git a/tools/assimp_cmd/CompareDump.cpp b/tools/assimp_cmd/CompareDump.cpp index b46407fe8..33db0eb3d 100644 --- a/tools/assimp_cmd/CompareDump.cpp +++ b/tools/assimp_cmd/CompareDump.cpp @@ -221,7 +221,7 @@ public: private: /* Report failure */ - void failure(const std::string& err, const std::string& name) { + AI_WONT_RETURN void failure(const std::string& err, const std::string& name) AI_WONT_RETURN_SUFFIX { std::stringstream ss; throw compare_fails_exception((ss << "Files are different at "