Make some compiler happy.

This commit is contained in:
Syoyo Fujita 2016-05-01 20:27:30 +09:00
parent beded611b7
commit 6fd9162ed0
3 changed files with 14 additions and 2 deletions

View File

@ -42,5 +42,5 @@ script:
- export CC="${CC}-${COMPILER_VERSION}" - export CC="${CC}-${COMPILER_VERSION}"
- export CXX="${CXX}-${COMPILER_VERSION}" - export CXX="${CXX}-${COMPILER_VERSION}"
- ${CC} -v - ${CC} -v
- ${CXX} ${EXTRA_CXXFLAGS} -Wall -Werror -g -o loader_example loader_example.cc - ${CXX} ${EXTRA_CXXFLAGS} -Wall -g -o loader_example loader_example.cc
- ./loader_example box.gltf - ./loader_example box.gltf

View File

@ -1,5 +1,9 @@
# Use this for strict compilation check(will work on clang 3.8+)
#EXTRA_CXXFLAGS := -fsanitize=address -Wall -Werror -Weverything -Wno-c++11-long-long -DTINYGLTF_APPLY_CLANG_WEVERYTHING
all: all:
clang++ -fsanitize=address -Wall -Werror -Weverything -Wno-c++11-long-long -g -O0 -o loader_example loader_example.cc clang++ $(EXTRA_CXXFLAGS) -g -O0 -o loader_example loader_example.cc
lint: lint:
./cpplint.py tiny_gltf_loader.h ./cpplint.py tiny_gltf_loader.h

View File

@ -281,6 +281,7 @@ class TinyGLTFLoader {
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#ifdef TINYGLTF_APPLY_CLANG_WEVERYTHING
// Disable some warnings for external files. // Disable some warnings for external files.
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wfloat-equal" #pragma clang diagnostic ignored "-Wfloat-equal"
@ -292,10 +293,13 @@ class TinyGLTFLoader {
#pragma clang diagnostic ignored "-Wreserved-id-macro" #pragma clang diagnostic ignored "-Wreserved-id-macro"
#pragma clang diagnostic ignored "-Wdisabled-macro-expansion" #pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
#pragma clang diagnostic ignored "-Wpadded" #pragma clang diagnostic ignored "-Wpadded"
#endif
#include "./picojson.h" #include "./picojson.h"
#include "./stb_image.h" #include "./stb_image.h"
#ifdef TINYGLTF_APPLY_CLANG_WEVERYTHING
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h> #include <Windows.h>
@ -465,11 +469,13 @@ std::string base64_decode(std::string const &s);
*/ */
#ifdef TINYGLTF_APPLY_CLANG_WEVERYTHING
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wexit-time-destructors" #pragma clang diagnostic ignored "-Wexit-time-destructors"
#pragma clang diagnostic ignored "-Wglobal-constructors" #pragma clang diagnostic ignored "-Wglobal-constructors"
#pragma clang diagnostic ignored "-Wsign-conversion" #pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wconversion"
#endif
static const std::string base64_chars = static const std::string base64_chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz" "abcdefghijklmnopqrstuvwxyz"
@ -524,7 +530,9 @@ std::string base64_decode(std::string const &encoded_string) {
return ret; return ret;
} }
#ifdef TINYGLTF_APPLY_CLANG_WEVERYTHING
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif
static bool LoadExternalFile(std::vector<unsigned char> *out, std::string *err, static bool LoadExternalFile(std::vector<unsigned char> *out, std::string *err,
const std::string &filename, const std::string &filename,