Skip to content

Commit

Permalink
Disable warnings by default
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lunarg committed Jan 10, 2024
1 parent ec79055 commit f1680d8
Show file tree
Hide file tree
Showing 25 changed files with 448 additions and 137 deletions.
6 changes: 3 additions & 3 deletions glm/detail/setup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,10 +877,10 @@ namespace detail
///////////////////////////////////////////////////////////////////////////////////
// Silent warnings

#ifdef GLM_FORCE_SILENT_WARNINGS
# define GLM_SILENT_WARNINGS GLM_ENABLE
#else
#ifdef GLM_FORCE_WARNINGS
# define GLM_SILENT_WARNINGS GLM_DISABLE
#else
# define GLM_SILENT_WARNINGS GLM_ENABLE
#endif

///////////////////////////////////////////////////////////////////////////////////
Expand Down
40 changes: 20 additions & 20 deletions glm/detail/type_quat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@

namespace glm
{
template<typename T, qualifier Q>
struct qua
{
// -- Implementation detail --

typedef qua<T, Q> type;
typedef T value_type;

// -- Data --

# if GLM_SILENT_WARNINGS == GLM_ENABLE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
Expand All @@ -39,6 +29,16 @@ namespace glm
# endif
# endif

template<typename T, qualifier Q>
struct qua
{
// -- Implementation detail --

typedef qua<T, Q> type;
typedef T value_type;

// -- Data --

# if GLM_LANG & GLM_LANG_CXXMS_FLAG
union
{
Expand All @@ -56,16 +56,6 @@ namespace glm
# else
T x, y, z, w;
# 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 --
Expand Down Expand Up @@ -139,6 +129,16 @@ namespace glm
GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q>& operator/=(U s);
};

# 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

// -- Unary bit operators --

template<typename T, qualifier Q>
Expand Down
10 changes: 8 additions & 2 deletions glm/ext/scalar_ulp.inl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
#include <cmath>
#include <cfloat>

#if(GLM_COMPILER & GLM_COMPILER_VC)
#if GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(push)
# pragma warning(disable : 4127)
#elif GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wsign-conversion"
# pragma clang diagnostic ignored "-Wpadded"
#endif

typedef union
Expand Down Expand Up @@ -182,8 +186,10 @@ namespace detail
}//namespace detail
}//namespace glm

#if(GLM_COMPILER & GLM_COMPILER_VC)
#if GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(pop)
#elif GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
#endif

namespace glm
Expand Down
13 changes: 13 additions & 0 deletions glm/gtc/packing.inl
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ namespace detail
// return ((floatTo11bit(x) & ((1 << 11) - 1)) << 0) | ((floatTo11bit(y) & ((1 << 11) - 1)) << 11) | ((floatTo10bit(z) & ((1 << 10) - 1)) << 22);
// }

#if GLM_SILENT_WARNINGS == GLM_ENABLE
# if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wpadded"
# endif
#endif

union u3u3u2
{
struct Data
Expand Down Expand Up @@ -235,6 +242,12 @@ namespace detail
uint16 pack;
};

#if GLM_SILENT_WARNINGS == GLM_ENABLE
# if defined(__clang__)
# pragma clang diagnostic pop
# endif
#endif

union u10u10u10u2
{
struct Data
Expand Down
9 changes: 9 additions & 0 deletions test/bug/bug_ms_vec_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@ struct vec2
x(0), y(0)
{}

#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
#endif

union
{
struct { float x, y; };
struct { _swizzle xx; };
};

#if defined(_MSC_VER)
# pragma warning(pop)
#endif
};
#endif

Expand Down
23 changes: 23 additions & 0 deletions test/core/core_force_compiler_unknown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,32 @@
# define GLM_FORCE_COMPILER_UNKNOWN
#endif

#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# pragma clang diagnostic ignored "-Wsign-conversion"
# pragma clang diagnostic ignored "-Wpadded"
# pragma clang diagnostic ignored "-Wc++11-long-long"
#elif defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
#elif defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
#endif

#include <glm/glm.hpp>
#include <glm/ext.hpp>

#if defined(__clang__)
# pragma clang diagnostic pop
#elif defined(__GNUC__)
# pragma GCC diagnostic pop
#elif defined(_MSC_VER)
# pragma warning(pop)
#endif

int main()
{
int Error = 0;
Expand Down
54 changes: 36 additions & 18 deletions test/core/core_func_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ namespace min_
return Error;
}

int min_tern(int a, int b)
static int min_tern(int a, int b)
{
return a < b ? a : b;
}

int min_int(int x, int y)
static int min_int(int x, int y)
{
return y ^ ((x ^ y) & -(x < y));
}
Expand Down Expand Up @@ -397,6 +397,11 @@ namespace clamp_

namespace mix_
{
#if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wpadded"
#endif

template<typename T, typename B>
struct entry
{
Expand All @@ -406,31 +411,40 @@ namespace mix_
T Result;
};

entry<float, bool> const TestBool[] =
#if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
#endif

#if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wglobal-constructors"
#endif

static entry<float, bool> const TestBool[] =
{
{0.0f, 1.0f, false, 0.0f},
{0.0f, 1.0f, true, 1.0f},
{-1.0f, 1.0f, false, -1.0f},
{-1.0f, 1.0f, true, 1.0f}
};

entry<float, float> const TestFloat[] =
static entry<float, float> const TestFloat[] =
{
{0.0f, 1.0f, 0.0f, 0.0f},
{0.0f, 1.0f, 1.0f, 1.0f},
{-1.0f, 1.0f, 0.0f, -1.0f},
{-1.0f, 1.0f, 1.0f, 1.0f}
};

entry<glm::vec2, bool> const TestVec2Bool[] =
static entry<glm::vec2, bool> const TestVec2Bool[] =
{
{glm::vec2(0.0f), glm::vec2(1.0f), false, glm::vec2(0.0f)},
{glm::vec2(0.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)},
{glm::vec2(-1.0f), glm::vec2(1.0f), false, glm::vec2(-1.0f)},
{glm::vec2(-1.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)}
};

entry<glm::vec2, glm::bvec2> const TestBVec2[] =
static entry<glm::vec2, glm::bvec2> const TestBVec2[] =
{
{glm::vec2(0.0f), glm::vec2(1.0f), glm::bvec2(false), glm::vec2(0.0f)},
{glm::vec2(0.0f), glm::vec2(1.0f), glm::bvec2(true), glm::vec2(1.0f)},
Expand All @@ -439,15 +453,15 @@ namespace mix_
{glm::vec2(-1.0f), glm::vec2(1.0f), glm::bvec2(true, false), glm::vec2(1.0f, -1.0f)}
};

entry<glm::vec3, bool> const TestVec3Bool[] =
static entry<glm::vec3, bool> const TestVec3Bool[] =
{
{glm::vec3(0.0f), glm::vec3(1.0f), false, glm::vec3(0.0f)},
{glm::vec3(0.0f), glm::vec3(1.0f), true, glm::vec3(1.0f)},
{glm::vec3(-1.0f), glm::vec3(1.0f), false, glm::vec3(-1.0f)},
{glm::vec3(-1.0f), glm::vec3(1.0f), true, glm::vec3(1.0f)}
};

entry<glm::vec3, glm::bvec3> const TestBVec3[] =
static entry<glm::vec3, glm::bvec3> const TestBVec3[] =
{
{glm::vec3(0.0f), glm::vec3(1.0f), glm::bvec3(false), glm::vec3(0.0f)},
{glm::vec3(0.0f), glm::vec3(1.0f), glm::bvec3(true), glm::vec3(1.0f)},
Expand All @@ -456,15 +470,15 @@ namespace mix_
{glm::vec3(1.0f, 2.0f, 3.0f), glm::vec3(4.0f, 5.0f, 6.0f), glm::bvec3(true, false, true), glm::vec3(4.0f, 2.0f, 6.0f)}
};

entry<glm::vec4, bool> const TestVec4Bool[] =
static entry<glm::vec4, bool> const TestVec4Bool[] =
{
{glm::vec4(0.0f), glm::vec4(1.0f), false, glm::vec4(0.0f)},
{glm::vec4(0.0f), glm::vec4(1.0f), true, glm::vec4(1.0f)},
{glm::vec4(-1.0f), glm::vec4(1.0f), false, glm::vec4(-1.0f)},
{glm::vec4(-1.0f), glm::vec4(1.0f), true, glm::vec4(1.0f)}
};

entry<glm::vec4, glm::bvec4> const TestBVec4[] =
static entry<glm::vec4, glm::bvec4> const TestBVec4[] =
{
{glm::vec4(0.0f, 0.0f, 1.0f, 1.0f), glm::vec4(2.0f, 2.0f, 3.0f, 3.0f), glm::bvec4(false, true, false, true), glm::vec4(0.0f, 2.0f, 1.0f, 3.0f)},
{glm::vec4(0.0f), glm::vec4(1.0f), glm::bvec4(true), glm::vec4(1.0f)},
Expand All @@ -473,6 +487,10 @@ namespace mix_
{glm::vec4(1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(5.0f, 6.0f, 7.0f, 8.0f), glm::bvec4(true, false, true, false), glm::vec4(5.0f, 2.0f, 7.0f, 4.0f)}
};

#if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
#endif

static int test()
{
int Error = 0;
Expand Down Expand Up @@ -575,14 +593,14 @@ namespace step_
VEC result;
};

entry<float, glm::vec4> TestVec4Scalar [] =
static const entry<float, glm::vec4> TestVec4Scalar [] =
{
{ 1.0f, glm::vec4(1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(1.0f) },
{ 0.0f, glm::vec4(1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(1.0f) },
{ 0.0f, glm::vec4(-1.0f, -2.0f, -3.0f, -4.0f), glm::vec4(0.0f) }
};

entry<glm::vec4, glm::vec4> TestVec4Vector [] =
static const entry<glm::vec4, glm::vec4> TestVec4Vector [] =
{
{ glm::vec4(-1.0f, -2.0f, -3.0f, -4.0f), glm::vec4(-2.0f, -3.0f, -4.0f, -5.0f), glm::vec4(0.0f) },
{ glm::vec4( 0.0f, 1.0f, 2.0f, 3.0f), glm::vec4( 1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(1.0f) },
Expand Down Expand Up @@ -954,7 +972,7 @@ namespace sign
genType Return;
};

int test_int32()
static int test_int32()
{
type<glm::int32> const Data[] =
{
Expand Down Expand Up @@ -1004,7 +1022,7 @@ namespace sign
return Error;
}

int test_i32vec4()
static int test_i32vec4()
{
type<glm::ivec4> const Data[] =
{
Expand All @@ -1028,7 +1046,7 @@ namespace sign
return Error;
}

int test_f32vec4()
static int test_f32vec4()
{
type<glm::vec4> const Data[] =
{
Expand Down Expand Up @@ -1063,7 +1081,7 @@ namespace sign
return Error;
}

int perf_rand(std::size_t Samples)
static int perf_rand(std::size_t Samples)
{
int Error = 0;

Expand Down Expand Up @@ -1116,7 +1134,7 @@ namespace sign
return Error;
}

int perf_linear(std::size_t Samples)
static int perf_linear(std::size_t Samples)
{
int Error = 0;

Expand Down Expand Up @@ -1163,7 +1181,7 @@ namespace sign
return Error;
}

int perf_linear_cal(std::size_t Samples)
static int perf_linear_cal(std::size_t Samples)
{
int Error = 0;

Expand Down
9 changes: 9 additions & 0 deletions test/core/core_func_integer_bit_count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ void error(int x, int y)
std::printf("Error for x = %08x, got %08x\n", x, y);
}

#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4389) // nonstandard extension used : nameless struct/union
#endif

int main()
{
# ifdef NDEBUG
Expand Down Expand Up @@ -289,3 +294,7 @@ int main()

# endif//NDEBUG
}

#if defined(_MSC_VER)
# pragma warning(pop)
#endif
Loading

0 comments on commit f1680d8

Please sign in to comment.