diff options
Diffstat (limited to 'src/nvim/assert.h')
-rw-r--r-- | src/nvim/assert.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/nvim/assert.h b/src/nvim/assert.h index 1361879876..fc1a4be164 100644 --- a/src/nvim/assert.h +++ b/src/nvim/assert.h @@ -49,11 +49,11 @@ #define STATIC_ASSERT_PRAGMA_START #define STATIC_ASSERT_PRAGMA_END #define STATIC_ASSERT(cond, msg) \ - do { \ - STATIC_ASSERT_PRAGMA_START \ - STATIC_ASSERT_STATEMENT(cond, msg); \ - STATIC_ASSERT_PRAGMA_END \ - } while (0) + do { \ + STATIC_ASSERT_PRAGMA_START \ + STATIC_ASSERT_STATEMENT(cond, msg); \ + STATIC_ASSERT_PRAGMA_END \ + } while (0) // the easiest case, when the mode is C11 (generic compiler) or Clang // advertises explicit support for c_static_assert, meaning it won't warn. @@ -68,19 +68,19 @@ # undef STATIC_ASSERT_PRAGMA_START -#if __GNUC__ >= 6 -# define STATIC_ASSERT_PRAGMA_START \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wpedantic\"") -#else -# define STATIC_ASSERT_PRAGMA_START \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-pedantic\"") -#endif +# if __GNUC__ >= 6 +# define STATIC_ASSERT_PRAGMA_START \ + _Pragma("GCC diagnostic push")\ + _Pragma("GCC diagnostic ignored \"-Wpedantic\"") +# else +# define STATIC_ASSERT_PRAGMA_START \ + _Pragma("GCC diagnostic push")\ + _Pragma("GCC diagnostic ignored \"-pedantic\"") +# endif # undef STATIC_ASSERT_PRAGMA_END # define STATIC_ASSERT_PRAGMA_END \ - _Pragma("GCC diagnostic pop") + _Pragma("GCC diagnostic pop") // the same goes for clang in C99 mode, but we suppress a different warning #elif defined(__clang__) && __has_extension(c_static_assert) @@ -89,12 +89,12 @@ # undef STATIC_ASSERT_PRAGMA_START # define STATIC_ASSERT_PRAGMA_START \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wc11-extensions\"") + _Pragma("clang diagnostic push")\ + _Pragma("clang diagnostic ignored \"-Wc11-extensions\"") # undef STATIC_ASSERT_PRAGMA_END # define STATIC_ASSERT_PRAGMA_END \ - _Pragma("clang diagnostic pop") + _Pragma("clang diagnostic pop") // TODO(aktau): verify that this works, don't have MSVC on hand. #elif _MSC_VER >= 1600 @@ -113,14 +113,14 @@ // These can't be used after statements in c89. #ifdef __COUNTER__ # define STATIC_ASSERT_EXPR(e, m) \ - ((enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1/(!!(e)) }) 0) + ((enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1/(!!(e)) }) 0) #else // This can't be used twice on the same line so ensure if using in headers // that the headers are not included twice (by wrapping in #ifndef...#endif) // Note it doesn't cause an issue when used on same line of separate modules // compiled with gcc -combine -fwhole-program. # define STATIC_ASSERT_EXPR(e, m) \ - ((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)) }) 0) + ((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)) }) 0) #endif /// @def STRICT_ADD |