build: explicitly allow anonymous structs

This commit is contained in:
Danny Robson 2016-05-12 18:06:12 +10:00
parent 950c5ba0d4
commit c2310d5d50
4 changed files with 1 additions and 33 deletions

View File

@ -24,15 +24,6 @@
#include <cstdlib>
namespace util { namespace coord {
///////////////////////////////////////////////////////////////////////
// Disable GCC warnings about validity of anonymous structures in
// unions. Push comes to shove I'll manually redsign everything to
// keep this syntax anyway.
#if defined(COMPILER_CLANG)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wgnu-anonymous-struct"
#endif
///////////////////////////////////////////////////////////////////////////
// Coordinate storage class.
//
@ -177,10 +168,6 @@ namespace util { namespace coord {
struct { T w,h,d; };
};
};
#if defined(COMPILER_CLANG)
#pragma GCC diagnostic pop
#endif
} }
#endif

View File

@ -55,6 +55,7 @@ AC_DEFUN([NC_WARNINGS],[
#AX_APPEND_COMPILE_FLAGS([-Wno-c99-extensions], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Wno-vla-extension], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-vla], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-anonymous-struct])
AS_IF([test "x$ax_cv_cxx_compiler_vendor" != "xgnu"], [
AX_APPEND_COMPILE_FLAGS([-Wno-c99-extensions], [], [-Werror])

View File

@ -27,25 +27,12 @@ namespace util {
template <typename T>
struct quaternion {
///////////////////////////////////////////////////////////////////////
// Disable GCC warnings about validity of anonyous structures in
// unions. Push comes to shove I'll manually redsign everything to
// keep this syntax anyway.
#pragma GCC diagnostic push
#if defined(COMPILER_GCC)
#pragma GCC diagnostic ignored "-pedantic"
#endif
#if defined(COMPILER_CLANG)
#pragma GCC diagnostic ignored "-Wgnu"
#endif
union {
struct { T w, x, y, z; };
struct { T a, b, c, d; };
T data[4];
};
#pragma GCC diagnostic pop
static const quaternion IDENTITY;
static quaternion rotation (T radians, vector<3,T> axis);

View File

@ -43,10 +43,6 @@ namespace util {
static constexpr size_t dimension = S;
static constexpr size_t elements = extent_t::elements + point_t::elements;
#if defined(COMPILER_CLANG)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wgnu-anonymous-struct"
#endif
union {
struct {
point_t p;
@ -57,9 +53,6 @@ namespace util {
T w, h;
};
};
#if defined(COMPILER_CLANG)
#pragma GCC diagnostic pop
#endif
//---------------------------------------------------------------------
region () = default;