Make C++11 static_assert work without warning by using C99 _Pragma() as well. ---
NOTE: this patch is probably whitespace damaged, because I'm pasting it in via Google's web interface. I declared this patch as RFC because I'm unsure how clang behaves on it. Index: systemd-test/src/shared/macro.h =================================================================== --- systemd-test.orig/src/shared/macro.h 2014-02-20 10:09:53.300892884 +0100 +++ systemd-test/src/shared/macro.h 2014-02-20 10:20:25.656892808 +0100 @@ -156,7 +156,12 @@ static inline size_t ALIGN_TO(size_t l, #if defined(static_assert) #define assert_cc(expr) static_assert(expr, #expr) #else -#define assert_cc(expr) struct UNIQUE(_assert_struct_) { char x[(expr) ? 0 : -1]; }; +//#define assert_cc(expr) struct UNIQUE(_assert_struct_) { char x[(expr) ? 0 : -1]; }; +#define assert_cc(expr) \ + _Pragma("GCC diagnostic push"); \ + _Pragma("GCC diagnostic ignored \"-Wdeclaration-after-statement\""); \ + struct UNIQUE(_assert_struct_) { char x[(expr) ? 0 : -1]; }; \ + _Pragma("GCC diagnostic pop"); #endif #define assert_return(expr, r) \ _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel