diff options
-rw-r--r-- | src/nvim/assert.h | 6 | ||||
-rw-r--r-- | src/nvim/eval.c | 6 | ||||
-rw-r--r-- | src/nvim/macros.h | 21 |
3 files changed, 26 insertions, 7 deletions
diff --git a/src/nvim/assert.h b/src/nvim/assert.h index 6e8e57c183..34734f294d 100644 --- a/src/nvim/assert.h +++ b/src/nvim/assert.h @@ -80,7 +80,7 @@ # 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) @@ -90,11 +90,11 @@ # undef STATIC_ASSERT_PRAGMA_START # define STATIC_ASSERT_PRAGMA_START \ _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wc11-extensions\"") \ + _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 diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 8ca764ba68..4ab699cdb7 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5958,11 +5958,9 @@ static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate) #pragma function (floor) #endif -// silence -Wmissing-prototypes for funcs.generated.h -const VimLFuncDef *find_internal_func_gperf(register const char *str, - register size_t len); - +PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES # include "funcs.generated.h" +PRAGMA_DIAG_POP #endif /* diff --git a/src/nvim/macros.h b/src/nvim/macros.h index d447bff765..61009528a8 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -198,4 +198,25 @@ # define IO_COUNT(x) (x) #endif +/// +/// PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES +/// +#if defined(__clang__) && __clang__ == 1 +# define PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wmissing-prototypes\"") +# define PRAGMA_DIAG_POP \ + _Pragma("clang diagnostic pop") +#elif defined(__GNUC__) +# define PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wmissing-prototypes\"") +# define PRAGMA_DIAG_POP \ + _Pragma("GCC diagnostic pop") +#else +# define PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES +# define PRAGMA_DIAG_POP +#endif + + #endif // NVIM_MACROS_H |