From 976091a6f6afb567fabefb666dd10c8661a68035 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 15 Mar 2020 11:47:05 +0100 Subject: [PATCH] ix compiler warning for pragma statements. --- code/3DS/3DSHelper.h | 4 +++- code/Assbin/AssbinFileWriter.cpp | 14 +++++++++----- code/Common/SpatialSort.cpp | 4 +++- code/M3D/m3d.h | 10 +++++++--- code/PostProcessing/ArmaturePopulate.cpp | 2 +- code/glTF/glTFAsset.inl | 10 +++++++--- code/glTF/glTFAssetWriter.inl | 10 +++++++--- code/glTF/glTFCommon.h | 11 ++++++++--- code/glTF2/glTF2Asset.inl | 14 ++++++++++---- contrib/Open3DGC/o3dgcSC3DMCDecoder.inl | 10 +++++++--- contrib/Open3DGC/o3dgcSC3DMCEncoder.inl | 10 +++++++--- contrib/poly2tri/poly2tri/sweep/sweep.cc | 11 ++++++++--- contrib/unzip/ioapi.c | 12 +++++++----- contrib/unzip/unzip.c | 11 +++++++---- 14 files changed, 91 insertions(+), 42 deletions(-) diff --git a/code/3DS/3DSHelper.h b/code/3DS/3DSHelper.h index 1448fe609..fbc167caa 100644 --- a/code/3DS/3DSHelper.h +++ b/code/3DS/3DSHelper.h @@ -321,7 +321,9 @@ public: struct Face : public FaceWithSmoothingGroup { }; -#pragma warning(disable : 4315) +#ifdef _WIN32 +# pragma warning(disable : 4315) +#endif // --------------------------------------------------------------------------- /** Helper structure representing a texture */ diff --git a/code/Assbin/AssbinFileWriter.cpp b/code/Assbin/AssbinFileWriter.cpp index 8f302b919..7fceaa1ad 100644 --- a/code/Assbin/AssbinFileWriter.cpp +++ b/code/Assbin/AssbinFileWriter.cpp @@ -54,15 +54,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #ifdef ASSIMP_BUILD_NO_OWN_ZLIB -#include +# include #else -#include "../contrib/zlib/zlib.h" +# include "../contrib/zlib/zlib.h" #endif #include -#pragma warning(push) -#pragma warning(disable : 4706) +#ifdef _WIN32 +# pragma warning(push) +# pragma warning(disable : 4706) +#endif // _WIN32 namespace Assimp { @@ -824,6 +826,8 @@ void DumpSceneToAssbin( AssbinFileWriter fileWriter(shortened, compressed); fileWriter.WriteBinaryDump(pFile, cmd, pIOSystem, pScene); } -#pragma warning(pop) +#ifdef _WIN32 +# pragma warning(pop) +#endif // _WIN32 } // end of namespace Assimp diff --git a/code/Common/SpatialSort.cpp b/code/Common/SpatialSort.cpp index 6d1a0133f..a32ff5f90 100644 --- a/code/Common/SpatialSort.cpp +++ b/code/Common/SpatialSort.cpp @@ -53,7 +53,9 @@ using namespace Assimp; # define CHAR_BIT 8 #endif -#pragma warning(disable : 4127) +#ifdef _WIN32 +# pragma warning(disable : 4127) +#endif // _WIN32 // ------------------------------------------------------------------------------------------------ // Constructs a spatially sorted representation from the given position array. diff --git a/code/M3D/m3d.h b/code/M3D/m3d.h index 761d35d36..86574d58c 100644 --- a/code/M3D/m3d.h +++ b/code/M3D/m3d.h @@ -99,8 +99,10 @@ typedef uint16_t M3D_INDEX; #define _register #endif -#pragma warning(push) -#pragma warning(disable : 4127 5573 4505 4244 4403 5744 4701 4703) +#ifdef _WIN32 +# pragma warning(push) +# pragma warning(disable : 4127 5573 4505 4244 4403 5744 4701 4703) +#endif // _WIN32 /*** File format structures ***/ @@ -6134,7 +6136,9 @@ public: #endif /* impl */ } // namespace M3D -#pragma warning(pop <) +#ifdef _WIN32 +# pragma warning(pop) +#endif // _WIN32 #endif diff --git a/code/PostProcessing/ArmaturePopulate.cpp b/code/PostProcessing/ArmaturePopulate.cpp index ce1401d39..9065177b6 100644 --- a/code/PostProcessing/ArmaturePopulate.cpp +++ b/code/PostProcessing/ArmaturePopulate.cpp @@ -164,7 +164,7 @@ void ArmaturePopulate::BuildNodeList(const aiNode *current_node, // duplicate names :) void ArmaturePopulate::BuildBoneStack(aiNode *, const aiNode *root_node, - const aiScene *scene, + const aiScene*, const std::vector &bones, std::map &bone_stack, std::vector &node_stack) { diff --git a/code/glTF/glTFAsset.inl b/code/glTF/glTFAsset.inl index 0a4b4b24c..116f76535 100644 --- a/code/glTF/glTFAsset.inl +++ b/code/glTF/glTFAsset.inl @@ -57,8 +57,10 @@ namespace glTF { namespace { -#pragma warning(push) -#pragma warning(disable : 4706) +#ifdef _WIN32 +# pragma warning(push) +# pragma warning(disable : 4706) +#endif // _WIN32 // // JSON Value reading helpers @@ -1410,6 +1412,8 @@ inline std::string Asset::FindUniqueID(const std::string &str, const char *suffi return id; } -#pragma warning(pop) +#ifdef _WIN32 +# pragma warning(pop) +#endif // WIN32 } // namespace glTF diff --git a/code/glTF/glTFAssetWriter.inl b/code/glTF/glTFAssetWriter.inl index 652412138..5e4416ee9 100644 --- a/code/glTF/glTFAssetWriter.inl +++ b/code/glTF/glTFAssetWriter.inl @@ -43,8 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#pragma warning(push) -#pragma warning( disable : 4706) +#ifdef _WIN32 +# pragma warning(push) +# pragma warning( disable : 4706) +#endif // _WIN32 namespace glTF { @@ -701,6 +703,8 @@ namespace glTF { w.WriteObjects(d); } -#pragma warning(pop) +#ifdef _WIN32 +# pragma warning(pop) +#endif // _WIN32 } diff --git a/code/glTF/glTFCommon.h b/code/glTF/glTFCommon.h index 5d04822a2..d161e8cd6 100644 --- a/code/glTF/glTFCommon.h +++ b/code/glTF/glTFCommon.h @@ -189,8 +189,11 @@ inline void CopyValue(const glTFCommon::mat4 &v, aiMatrix4x4 &o) { o.d4 = v[15]; } -#pragma warning(push) -#pragma warning(disable : 4310) +#ifdef _WIN32 +# pragma warning(push) +# pragma warning(disable : 4310) +#endif // _WIN32 + inline std::string getCurrentAssetDir(const std::string &pFile) { std::string path = pFile; int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\'))); @@ -200,7 +203,9 @@ inline std::string getCurrentAssetDir(const std::string &pFile) { return path; } -#pragma warning(pop) +#ifdef _WIN32 +# pragma warning(pop) +#endif // _WIN32 namespace Util { diff --git a/code/glTF2/glTF2Asset.inl b/code/glTF2/glTF2Asset.inl index 97aa12e34..f9c3aa805 100644 --- a/code/glTF2/glTF2Asset.inl +++ b/code/glTF2/glTF2Asset.inl @@ -901,8 +901,11 @@ inline int Compare(const char *attr, const char (&str)[N]) { return (strncmp(attr, str, N - 1) == 0) ? N - 1 : 0; } -#pragma warning(push) -#pragma warning(disable : 4706) +#ifdef _WIN32 +# pragma warning(push) +# pragma warning(disable : 4706) +#endif // _WIN32 + inline bool GetAttribVector(Mesh::Primitive &p, const char *attr, Mesh::AccessorList *&v, int &pos) { if ((pos = Compare(attr, "POSITION"))) { v = &(p.attributes.position); @@ -1504,8 +1507,9 @@ inline std::string Asset::FindUniqueID(const std::string &str, const char *suffi id += suffix; Asset::IdMap::iterator it = mUsedIds.find(id); - if (it == mUsedIds.end()) + if (it == mUsedIds.end()) { return id; + } std::vector buffer; buffer.resize(id.size() + 16); @@ -1519,6 +1523,8 @@ inline std::string Asset::FindUniqueID(const std::string &str, const char *suffi return id; } -#pragma warning(pop) +#ifdef _WIN32 +# pragma warning(pop) +#endif // _WIN32 } // namespace glTF2 diff --git a/contrib/Open3DGC/o3dgcSC3DMCDecoder.inl b/contrib/Open3DGC/o3dgcSC3DMCDecoder.inl index 5570fd39e..326297426 100644 --- a/contrib/Open3DGC/o3dgcSC3DMCDecoder.inl +++ b/contrib/Open3DGC/o3dgcSC3DMCDecoder.inl @@ -27,8 +27,10 @@ THE SOFTWARE. #include "o3dgcArithmeticCodec.h" #include "o3dgcTimer.h" -#pragma warning(push) -#pragma warning( disable : 4456) +#ifdef _WIN32 +# pragma warning(push) +# pragma warning( disable : 4456) +#endif // _WIN32 //#define DEBUG_VERBOSE @@ -847,7 +849,9 @@ namespace o3dgc } } // namespace o3dgc -#pragma warning( pop ) +#ifdef _WIN32 +# pragma warning( pop ) +#endif // _WIN32 #endif // O3DGC_SC3DMC_DECODER_INL diff --git a/contrib/Open3DGC/o3dgcSC3DMCEncoder.inl b/contrib/Open3DGC/o3dgcSC3DMCEncoder.inl index 607fa3bfc..78d4b3e78 100644 --- a/contrib/Open3DGC/o3dgcSC3DMCEncoder.inl +++ b/contrib/Open3DGC/o3dgcSC3DMCEncoder.inl @@ -32,8 +32,10 @@ THE SOFTWARE. //#define DEBUG_VERBOSE -#pragma warning(push) -#pragma warning(disable : 4456) +#ifdef _WIN32 +# pragma warning(push) +# pragma warning(disable : 4456) +#endif // _WIN32 namespace o3dgc { @@ -925,7 +927,9 @@ namespace o3dgc } } // namespace o3dgc -#pragma warning(pop) +#ifdef _WIN32 +# pragma warning(pop) +#endif // _WIN32 #endif // O3DGC_SC3DMC_ENCODER_INL diff --git a/contrib/poly2tri/poly2tri/sweep/sweep.cc b/contrib/poly2tri/poly2tri/sweep/sweep.cc index a27d8e26f..9e3666001 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep.cc @@ -36,8 +36,11 @@ namespace p2t { -#pragma warning(push) -#pragma warning( disable : 4702 ) +#ifdef _WIN32 +# pragma warning(push) +# pragma warning( disable : 4702 ) +#endif // _WIN32 + // Triangulate simple polygon with holes void Sweep::Triangulate(SweepContext& tcx) { @@ -797,6 +800,8 @@ Sweep::~Sweep() { } -#pragma warning( pop ) +#ifdef _WIN32 +# pragma warning( pop ) +#endif // _WIN32 } diff --git a/contrib/unzip/ioapi.c b/contrib/unzip/ioapi.c index b614bccc4..e1ef46088 100644 --- a/contrib/unzip/ioapi.c +++ b/contrib/unzip/ioapi.c @@ -13,10 +13,10 @@ #include "zlib.h" #include "ioapi.h" -#pragma warning(push) -#pragma warning(disable : 4131 4100) - - +#ifdef _WIN32 +# pragma warning(push) +# pragma warning(disable : 4131 4100) +#endif // _WIN32 /* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ @@ -179,4 +179,6 @@ void fill_fopen_filefunc (pzlib_filefunc_def) pzlib_filefunc_def->opaque = NULL; } -#pragma warning(pop) \ No newline at end of file +#ifdef _WIN32 +# pragma warning(pop) +#endif // _WIN32 diff --git a/contrib/unzip/unzip.c b/contrib/unzip/unzip.c index 5c9df1c19..3937f821e 100644 --- a/contrib/unzip/unzip.c +++ b/contrib/unzip/unzip.c @@ -89,9 +89,10 @@ typedef unsigned long z_crc_t; #define SIZEZIPLOCALHEADER (0x1e) -#pragma warning(push) -#pragma warning(disable : 4131 4244 4189 4245) - +#ifdef _WIN32 +# pragma warning(push) +# pragma warning(disable : 4131 4244 4189 4245) +#endif // _WIN32 const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; @@ -1616,4 +1617,6 @@ extern int ZEXPORT unzSetOffset (file, pos) return err; } -#pragma warning(pop) \ No newline at end of file +#ifdef _WIN32 +# pragma warning(pop) +#endif // _WIN32