diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-08-02 18:07:18 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-08-02 18:07:18 +0200 |
commit | 952d9d827e5bfc66a6b1d39956e4e5596b09e2bd (patch) | |
tree | 0b2581eeaec39b6bad25b58f537d8ea1e893b79c /src/vim.h | |
parent | 1321257317b7d28228a6a9a0d612f81f70290b4c (diff) | |
download | vim-git-952d9d827e5bfc66a6b1d39956e4e5596b09e2bd.tar.gz |
patch 8.2.3274: macro for printf format check can be simplifiedv8.2.3274
Problem: Macro for printf format check can be simplified.
Solution: Add ATTRIBUTE_FORMAT_PRINTF(). (Dominique Pellé, issue #8635)
Diffstat (limited to 'src/vim.h')
-rw-r--r-- | src/vim.h | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -2132,8 +2132,21 @@ typedef struct _stat64 stat_T; typedef struct stat stat_T; #endif -#if defined(__GNUC__) && !defined(__MINGW32__) -# define USE_PRINTF_FORMAT_ATTRIBUTE +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__MINGW32__) +# define ATTRIBUTE_FORMAT_PRINTF(fmt_idx, arg_idx) \ + __attribute__((format(printf, fmt_idx, arg_idx))) +#else +# define ATTRIBUTE_FORMAT_PRINTF(fmt_idx, arg_idx) +#endif + +#if defined(__GNUC__) || defined(__clang__) +# define likely(x) __builtin_expect((x), 1) +# define unlikely(x) __builtin_expect((x), 0) +# define ATTRIBUTE_COLD __attribute__((cold)) +#else +# define unlikely(x) (x) +# define likely(x) (x) +# define ATTRIBUTE_COLD #endif typedef enum { |