Added GLM_FORCE_SILENT_WARNINGS to silent GLM warnings when using language extensions but using W4 or Wpedantic warnings #814 #775

This commit is contained in:
Christophe Riccio
2018-09-18 22:35:28 +02:00
parent b2a7f1093c
commit 635ff4ef2d
11 changed files with 219 additions and 18 deletions

View File

@@ -764,6 +764,15 @@ namespace detail
# define GLM_CONFIG_ANONYMOUS_STRUCT GLM_DISABLE
#endif
///////////////////////////////////////////////////////////////////////////////////
// Silent warnings
#ifdef GLM_FORCE_SILENT_WARNINGS
# define GLM_SILENT_WARNINGS GLM_ENABLE
#else
# define GLM_SILENT_WARNINGS GLM_DISABLE
#endif
///////////////////////////////////////////////////////////////////////////////////
// Precision
@@ -1003,6 +1012,12 @@ namespace detail
# pragma message("GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is undefined. Follows strictly GLSL on valid function genTypes.")
# endif
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# pragma message("GLM: GLM_FORCE_SILENT_WARNINGS is defined. Ignores C++ warnings from using C++ language extensions.")
# else
# pragma message("GLM: GLM_FORCE_SILENT_WARNINGS is undefined. Shows C++ warnings from using C++ language extensions.")
# endif
# ifdef GLM_FORCE_SINGLE_ONLY
# pragma message("GLM: GLM_FORCE_SINGLE_ONLY is defined. Using only single precision floating-point types")
# endif

View File

@@ -38,6 +38,20 @@ namespace glm
// -- Data --
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
# elif GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(push)
# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
# endif
# endif
# if GLM_LANG & GLM_LANG_CXXMS_FLAG
union
{
@@ -49,6 +63,16 @@ namespace glm
T x, y, z, w;
# endif
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# elif GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic pop
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(pop)
# endif
# endif
// -- Component accesses --
typedef length_t length_type;

View File

@@ -24,6 +24,20 @@ namespace glm
// -- Data --
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
# elif GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(push)
# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
# endif
# endif
# if GLM_CONFIG_XYZW_ONLY
T x;
# elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
@@ -55,6 +69,16 @@ namespace glm
GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, Q)
# endif
*/
# endif
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# elif GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic pop
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(pop)
# endif
# endif
// -- Component accesses --

View File

@@ -24,6 +24,20 @@ namespace glm
// -- Data --
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
# elif GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(push)
# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
# endif
# endif
# if GLM_CONFIG_XYZW_ONLY
T x, y;
# elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
@@ -54,6 +68,16 @@ namespace glm
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, Q)
# endif//GLM_CONFIG_SWIZZLE
# endif
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# elif GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic pop
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(pop)
# endif
# endif
// -- Component accesses --

View File

@@ -24,6 +24,20 @@ namespace glm
// -- Data --
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
# elif GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(push)
# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
# endif
# endif
# if GLM_CONFIG_XYZW_ONLY
T x, y, z;
# elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
@@ -57,6 +71,16 @@ namespace glm
# endif//GLM_CONFIG_SWIZZLE
# endif//GLM_LANG
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# elif GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic pop
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(pop)
# endif
# endif
// -- Component accesses --
/// Return the count of components of the vector

View File

@@ -24,6 +24,20 @@ namespace glm
// -- Data --
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
# elif GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(push)
# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
# endif
# endif
# if GLM_CONFIG_XYZW_ONLY
T x, y, z, w;
# elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
@@ -56,6 +70,16 @@ namespace glm
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, Q)
# endif
# endif
# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# elif GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic pop
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(pop)
# endif
# endif
// -- Component accesses --