diff --git a/CMakeLists.txt b/CMakeLists.txt index c2ea0cb6..2fb0b506 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,27 +63,16 @@ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") set(CMAKE_CXX_FLAGS "-std=c++98") - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - # GLM is using GCC 64 bits integer extension - add_definitions(-Wno-long-long) - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - add_definitions(-Wno-c++11-long-long) - endif() endif() endif() -option(GLM_TEST_ENABLE_MS_EXTENSIONS "Enable MS extensions" OFF) +option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF) -if(GLM_TEST_ENABLE_MS_EXTENSIONS) - if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")) - add_definitions(-Wgnu-anonymous-struct) - add_definitions(-Wnested-anon-types) - endif() -else() +if(NOT GLM_TEST_ENABLE_LANG_EXTENSIONS) if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND WIN32)) add_definitions(/Za) -# elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")) -# add_definitions(-pedantic) + elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")) + add_definitions(-pedantic) endif() endif() diff --git a/glm/detail/type_int.hpp b/glm/detail/type_int.hpp index d1608a1a..6148b1f9 100644 --- a/glm/detail/type_int.hpp +++ b/glm/detail/type_int.hpp @@ -29,12 +29,29 @@ namespace detail # if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available typedef int64_t sint64; typedef uint64_t uint64; + # elif GLM_COMPILER & GLM_COMPILER_VC typedef signed __int64 sint64; typedef unsigned __int64 uint64; + # elif GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wno-long-long" + __extension__ typedef signed long long sint64; __extension__ typedef unsigned long long uint64; + +# pragma GCC diagnostic pop + +# elif GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wno-c++11-long-long" + + typedef signed long long sint64; + typedef unsigned long long uint64; + +# pragma clang diagnostic pop + # else//unknown compiler typedef signed long long sint64; typedef unsigned long long uint64; diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index c8aefb77..e23b8294 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -28,6 +28,16 @@ namespace glm // -- Data -- # if GLM_HAS_UNRESTRICTED_UNIONS +# if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +# endif +# if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wgnu-anonymous-struct" +# pragma clang diagnostic ignored "-Wnested-anon-types" +# endif + union { T x; @@ -46,6 +56,13 @@ namespace glm _GLM_SWIZZLE1_4_MEMBERS(T, P, tvec4, s) # endif//GLM_SWIZZLE*/ }; + +# if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +# endif +# if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic pop +# endif # else union {T x, r, s;}; /* diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 4922b0c2..e2be2486 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -27,6 +27,16 @@ namespace glm // -- Data -- # if GLM_HAS_UNRESTRICTED_UNIONS +# if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +# endif +# if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wgnu-anonymous-struct" +# pragma clang diagnostic ignored "-Wnested-anon-types" +# endif + union { struct{ T x, y; }; @@ -46,6 +56,13 @@ namespace glm # endif//GLM_SWIZZLE }; + +# if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +# endif +# if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic pop +# endif # else union {T x, r, s;}; union {T y, g, t;}; diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index dbbcc019..213b619d 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -27,6 +27,16 @@ namespace glm // -- Data -- # if GLM_HAS_UNRESTRICTED_UNIONS +# if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +# endif +# if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wgnu-anonymous-struct" +# pragma clang diagnostic ignored "-Wnested-anon-types" +# endif + union { struct{ T x, y, z; }; @@ -45,6 +55,13 @@ namespace glm _GLM_SWIZZLE3_4_MEMBERS(T, P, glm::tvec4, s, t, p) # endif//GLM_SWIZZLE }; + +# if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +# endif +# if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic pop +# endif # else union { T x, r, s; }; union { T y, g, t; }; diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 995e9db6..f52792a2 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -28,6 +28,16 @@ namespace glm // -- Data -- # if GLM_HAS_UNRESTRICTED_UNIONS +# if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +# endif +# if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wgnu-anonymous-struct" +# pragma clang diagnostic ignored "-Wnested-anon-types" +# endif + union { struct { T x, y, z, w;}; @@ -48,6 +58,13 @@ namespace glm _GLM_SWIZZLE4_4_MEMBERS(T, P, glm::tvec4, s, t, p, q) # endif//GLM_SWIZZLE }; + +# if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +# endif +# if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic pop +# endif # else union { T x, r, s; }; union { T y, g, t; };