From c2310d5d50350caffb4224067b1c63b53a952b57 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 12 May 2016 18:06:12 +1000 Subject: [PATCH] build: explicitly allow anonymous structs --- coord/store.hpp | 13 ------------- m4/nc_warnings.m4 | 1 + quaternion.hpp | 13 ------------- region.hpp | 7 ------- 4 files changed, 1 insertion(+), 33 deletions(-) diff --git a/coord/store.hpp b/coord/store.hpp index 4d5073a4..be14ad57 100644 --- a/coord/store.hpp +++ b/coord/store.hpp @@ -24,15 +24,6 @@ #include 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 diff --git a/m4/nc_warnings.m4 b/m4/nc_warnings.m4 index 0b8fc229..029f7a74 100644 --- a/m4/nc_warnings.m4 +++ b/m4/nc_warnings.m4 @@ -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]) diff --git a/quaternion.hpp b/quaternion.hpp index 239d4f48..c0b47c0c 100644 --- a/quaternion.hpp +++ b/quaternion.hpp @@ -27,25 +27,12 @@ namespace util { template 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); diff --git a/region.hpp b/region.hpp index 95dc4ae2..8aa99816 100644 --- a/region.hpp +++ b/region.hpp @@ -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;