diff --git a/.travis.yml b/.travis.yml index 47ef58f..dfea1fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,5 +42,5 @@ script: - export CC="${CC}-${COMPILER_VERSION}" - export CXX="${CXX}-${COMPILER_VERSION}" - ${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 diff --git a/Makefile b/Makefile index 0ceb93c..3b227bd 100644 --- a/Makefile +++ b/Makefile @@ -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: - 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: ./cpplint.py tiny_gltf_loader.h diff --git a/tiny_gltf_loader.h b/tiny_gltf_loader.h index 90babeb..c1e63a6 100644 --- a/tiny_gltf_loader.h +++ b/tiny_gltf_loader.h @@ -281,6 +281,7 @@ class TinyGLTFLoader { #include #include +#ifdef TINYGLTF_APPLY_CLANG_WEVERYTHING // Disable some warnings for external files. #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wfloat-equal" @@ -292,10 +293,13 @@ class TinyGLTFLoader { #pragma clang diagnostic ignored "-Wreserved-id-macro" #pragma clang diagnostic ignored "-Wdisabled-macro-expansion" #pragma clang diagnostic ignored "-Wpadded" +#endif #include "./picojson.h" #include "./stb_image.h" +#ifdef TINYGLTF_APPLY_CLANG_WEVERYTHING #pragma clang diagnostic pop +#endif #ifdef _WIN32 #include @@ -465,11 +469,13 @@ std::string base64_decode(std::string const &s); */ +#ifdef TINYGLTF_APPLY_CLANG_WEVERYTHING #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wexit-time-destructors" #pragma clang diagnostic ignored "-Wglobal-constructors" #pragma clang diagnostic ignored "-Wsign-conversion" #pragma clang diagnostic ignored "-Wconversion" +#endif static const std::string base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" @@ -524,7 +530,9 @@ std::string base64_decode(std::string const &encoded_string) { return ret; } +#ifdef TINYGLTF_APPLY_CLANG_WEVERYTHING #pragma clang diagnostic pop +#endif static bool LoadExternalFile(std::vector *out, std::string *err, const std::string &filename,