summaryrefslogtreecommitdiff
path: root/src/vim.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vim.h')
-rw-r--r--src/vim.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/vim.h b/src/vim.h
index 7d2398671..b9105b5d1 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -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 {