Merge pull request #3328 from awr1/fix-mingw-priumax

Fix MinGW builds (issues related to pragmas and format strings)
pull/3347/head
Kim Kulling 2020-07-24 11:34:25 +02:00 committed by GitHub
commit 6828cf2f03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 35 deletions

View File

@ -60,10 +60,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <time.h>
#ifdef _WIN32
#if _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4706)
#endif // _WIN32
#endif // _MSC_VER
namespace Assimp {
@ -825,8 +825,8 @@ void DumpSceneToAssbin(
AssbinFileWriter fileWriter(shortened, compressed);
fileWriter.WriteBinaryDump(pFile, cmd, pIOSystem, pScene);
}
#ifdef _WIN32
#if _MSC_VER
#pragma warning(pop)
#endif // _WIN32
#endif // _MSC_VER
} // end of namespace Assimp

View File

@ -8,9 +8,9 @@ For details, see http://sourceforge.net/projects/libb64
#ifndef BASE64_CENCODE_H
#define BASE64_CENCODE_H
#ifdef _WIN32
#ifdef _MSC_VER
#pragma warning(disable : 4127 )
#endif // _WIN32
#endif // _MSC_VER
typedef enum
{

View File

@ -57,10 +57,10 @@ namespace glTF {
namespace {
#ifdef _WIN32
#if _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4706)
#endif // _WIN32
#endif // _MSC_VER
//
// JSON Value reading helpers
@ -372,7 +372,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod
char val[val_size];
ai_snprintf(val, val_size, "%llu", (long long)pOffset);
ai_snprintf(val, val_size, AI_SIZEFMT, pOffset);
throw DeadlyImportError(std::string("GLTF: incorrect offset value (") + val + ") for marking encoded region.");
}
@ -382,7 +382,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod
char val[val_size];
ai_snprintf(val, val_size, "%llu, %llu", (long long)pOffset, (long long)pEncodedData_Length);
ai_snprintf(val, val_size, AI_SIZEFMT "/" AI_SIZEFMT, pOffset, pEncodedData_Length);
throw DeadlyImportError(std::string("GLTF: encoded region with offset/length (") + val + ") is out of range.");
}
@ -1412,8 +1412,8 @@ inline std::string Asset::FindUniqueID(const std::string &str, const char *suffi
return id;
}
#ifdef _WIN32
#if _MSC_VER
# pragma warning(pop)
#endif // WIN32
#endif // _MSC_VER
} // namespace glTF

View File

@ -43,10 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rapidjson/writer.h>
#include <rapidjson/prettywriter.h>
#ifdef _WIN32
#if _MSC_VER
# pragma warning(push)
# pragma warning( disable : 4706)
#endif // _WIN32
#endif // _MSC_VER
namespace glTF {
@ -707,7 +707,7 @@ namespace glTF {
w.WriteObjects(d);
}
#ifdef _WIN32
#if _MSC_VER
# pragma warning(pop)
#endif // _WIN32

View File

@ -190,10 +190,10 @@ inline void CopyValue(const glTFCommon::mat4 &v, aiMatrix4x4 &o) {
o.d4 = v[15];
}
#ifdef _WIN32
#if _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4310)
#endif // _WIN32
#endif // _MSC_VER
inline std::string getCurrentAssetDir(const std::string &pFile) {
std::string path = pFile;
@ -204,9 +204,9 @@ inline std::string getCurrentAssetDir(const std::string &pFile) {
return path;
}
#ifdef _WIN32
#if _MSC_VER
# pragma warning(pop)
#endif // _WIN32
#endif // _MSC_VER
namespace Util {

View File

@ -525,6 +525,12 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
delete[] vertexJointData;
}
#if defined(__has_warning)
#if __has_warning("-Wunused-but-set-variable")
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
#endif
void glTFExporter::ExportMeshes()
{
// Not for
@ -793,6 +799,12 @@ void glTFExporter::ExportMeshes()
}
}
#if defined(__has_warning)
#if __has_warning("-Wunused-but-set-variable")
#pragma GCC diagnostic pop
#endif
#endif
/*
* Export the root node of the node hierarchy.
* Calls ExportNode for all children.

View File

@ -436,7 +436,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod
char val[val_size];
ai_snprintf(val, val_size, "%llu", (long long)pOffset);
ai_snprintf(val, val_size, AI_SIZEFMT, pOffset);
throw DeadlyImportError(std::string("GLTF: incorrect offset value (") + val + ") for marking encoded region.");
}
@ -446,7 +446,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod
char val[val_size];
ai_snprintf(val, val_size, "%llu, %llu", (long long)pOffset, (long long)pEncodedData_Length);
ai_snprintf(val, val_size, AI_SIZEFMT "/" AI_SIZEFMT, pOffset, pEncodedData_Length);
throw DeadlyImportError(std::string("GLTF: encoded region with offset/length (") + val + ") is out of range.");
}
@ -1042,10 +1042,10 @@ inline int Compare(const char *attr, const char (&str)[N]) {
return (strncmp(attr, str, N - 1) == 0) ? N - 1 : 0;
}
#ifdef _WIN32
#if _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4706)
#endif // _WIN32
#endif // _MSC_VER
inline bool GetAttribVector(Mesh::Primitive &p, const char *attr, Mesh::AccessorList *&v, int &pos) {
if ((pos = Compare(attr, "POSITION"))) {
@ -1723,8 +1723,8 @@ inline std::string Asset::FindUniqueID(const std::string &str, const char *suffi
return id;
}
#ifdef _WIN32
#if _MSC_VER
# pragma warning(pop)
#endif // _WIN32
#endif // _MSC_VER
} // namespace glTF2

View File

@ -36,10 +36,10 @@
namespace p2t {
#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning( disable : 4702 )
#endif // _WIN32
#endif // _MSC_VER
// Triangulate simple polygon with holes
void Sweep::Triangulate(SweepContext& tcx)
@ -800,8 +800,8 @@ Sweep::~Sweep() {
}
#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning( pop )
#endif // _WIN32
#endif // _MSC_VER
}

View File

@ -15,9 +15,10 @@
#include <string.h>
#include <sys/types.h>
#ifdef _WIN32
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4127 )
#endif //_WIN32
#endif //_MSC_VER
#ifdef __cplusplus
extern "C" {
@ -319,6 +320,10 @@ extern int zip_extract(const char *zipname, const char *dir,
/** @} */
#ifdef _MSC_VER
#pragma warning(pop)
#endif //_MSC_VER
#ifdef __cplusplus
}
#endif

View File

@ -53,6 +53,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdarg.h>
#include <cstdlib>
#ifdef _MSC_VER
# define AI_SIZEFMT "%Iu"
#else
# define AI_SIZEFMT "%zu"
#endif
/// @fn ai_snprintf
/// @brief The portable version of the function snprintf ( C99 standard ), which works on visual studio compilers 2013 and earlier.
/// @param outBuf The buffer to write in
@ -87,6 +93,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
return count;
}
#elif defined(__MINGW32__)
# define ai_snprintf __mingw_snprintf
#else
# define ai_snprintf snprintf
#endif