summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/channel.c6
-rw-r--r--src/gui_xim.c4
-rw-r--r--src/if_mzsch.c2
-rw-r--r--src/nbdebug.c2
-rw-r--r--src/nbdebug.h6
-rw-r--r--src/netbeans.c2
-rw-r--r--src/proto.h54
-rw-r--r--src/term.c2
-rw-r--r--src/version.c2
-rw-r--r--src/vim.h17
-rw-r--r--src/vim9execute.c8
11 files changed, 38 insertions, 67 deletions
diff --git a/src/channel.c b/src/channel.c
index 5307792e8c..47c742d830 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -229,11 +229,7 @@ ch_log(channel_T *ch, const char *fmt, ...)
#endif
static void
-ch_error(channel_T *ch, const char *fmt, ...)
-#ifdef USE_PRINTF_FORMAT_ATTRIBUTE
- __attribute__((format(printf, 2, 3)))
-#endif
- ;
+ch_error(channel_T *ch, const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3);
static void
ch_error(channel_T *ch, const char *fmt, ...)
diff --git a/src/gui_xim.c b/src/gui_xim.c
index 2dd6fd9159..2a12412dab 100644
--- a/src/gui_xim.c
+++ b/src/gui_xim.c
@@ -31,7 +31,9 @@
* in the "xim.log" file.
*/
// #define XIM_DEBUG
-#ifdef XIM_DEBUG
+#if defined(XIM_DEBUG) && defined(FEAT_GUI_GTK)
+static void xim_log(char *s, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
+
static void
xim_log(char *s, ...)
{
diff --git a/src/if_mzsch.c b/src/if_mzsch.c
index c8be940bc9..57b593a19e 100644
--- a/src/if_mzsch.c
+++ b/src/if_mzsch.c
@@ -139,7 +139,7 @@ static char *string_to_line(Scheme_Object *obj);
# define OUTPUT_LEN_TYPE long
#endif
static void do_output(char *mesg, OUTPUT_LEN_TYPE len);
-static void do_printf(char *format, ...);
+static void do_printf(char *format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
static void do_flush(void);
static Scheme_Object *_apply_thunk_catch_exceptions(
Scheme_Object *, Scheme_Object **);
diff --git a/src/nbdebug.c b/src/nbdebug.c
index 43bee8d8fd..c79081bea7 100644
--- a/src/nbdebug.c
+++ b/src/nbdebug.c
@@ -32,7 +32,7 @@
FILE *nb_debug = NULL;
u_int nb_dlevel = 0; // nb_debug verbosity level
-void nbdb(char *, ...);
+void nbdb(char *, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
static int lookup(char *);
#ifdef USE_NB_ERRORHANDLER
diff --git a/src/nbdebug.h b/src/nbdebug.h
index e1bb1717ba..9a47c3a890 100644
--- a/src/nbdebug.h
+++ b/src/nbdebug.h
@@ -42,11 +42,7 @@ typedef enum {
} WtWait;
-void nbdbg(char *, ...)
-# ifdef USE_PRINTF_FORMAT_ATTRIBUTE
- __attribute__((format(printf, 1, 2)))
-# endif
-;
+void nbdbg(char *, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
void nbdebug_wait(u_int wait_flags, char *wait_var, u_int wait_secs);
void nbdebug_log_init(char *log_var, char *level_var);
diff --git a/src/netbeans.c b/src/netbeans.c
index 1a565df003..bf47df713c 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -54,7 +54,7 @@ static void special_keys(char_u *args);
static int getConnInfo(char *file, char **host, char **port, char **password);
static void nb_init_graphics(void);
-static void coloncmd(char *cmd, ...);
+static void coloncmd(char *cmd, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
static void nb_set_curbuf(buf_T *buf);
static void nb_parse_cmd(char_u *);
static int nb_do_cmd(int, char_u *, int, int, char_u *);
diff --git a/src/proto.h b/src/proto.h
index 29f8238446..f639ad553b 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -121,52 +121,26 @@ extern int _stricoll(char *a, char *b);
# endif
// These prototypes cannot be produced automatically.
-int smsg(const char *, ...)
-# ifdef USE_PRINTF_FORMAT_ATTRIBUTE
- __attribute__((format(printf, 1, 2)))
-# endif
- ;
+int smsg(const char *, ...) ATTRIBUTE_COLD ATTRIBUTE_FORMAT_PRINTF(1, 2);
-int smsg_attr(int, const char *, ...)
-# ifdef USE_PRINTF_FORMAT_ATTRIBUTE
- __attribute__((format(printf, 2, 3)))
-# endif
- ;
+int smsg_attr(int, const char *, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3);
-int smsg_attr_keep(int, const char *, ...)
-# ifdef USE_PRINTF_FORMAT_ATTRIBUTE
- __attribute__((format(printf, 2, 3)))
-# endif
- ;
+int smsg_attr_keep(int, const char *, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3);
// These prototypes cannot be produced automatically.
-int semsg(const char *, ...)
-# ifdef USE_PRINTF_FORMAT_ATTRIBUTE
- __attribute__((format(printf, 1, 2)))
-# endif
- ;
+int semsg(const char *, ...) ATTRIBUTE_COLD ATTRIBUTE_FORMAT_PRINTF(1, 2);
// These prototypes cannot be produced automatically.
-void siemsg(const char *, ...)
-# ifdef USE_PRINTF_FORMAT_ATTRIBUTE
- __attribute__((format(printf, 1, 2)))
-# endif
- ;
+void siemsg(const char *, ...) ATTRIBUTE_COLD ATTRIBUTE_FORMAT_PRINTF(1, 2);
-int vim_snprintf_add(char *, size_t, const char *, ...)
-# ifdef USE_PRINTF_FORMAT_ATTRIBUTE
- __attribute__((format(printf, 3, 4)))
-# endif
- ;
+int vim_snprintf_add(char *, size_t, const char *, ...) ATTRIBUTE_FORMAT_PRINTF(3, 4);
-int vim_snprintf(char *, size_t, const char *, ...)
-# ifdef USE_PRINTF_FORMAT_ATTRIBUTE
- __attribute__((format(printf, 3, 4)))
-# endif
- ;
+int vim_snprintf(char *, size_t, const char *, ...) ATTRIBUTE_FORMAT_PRINTF(3, 4);
-int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap);
-int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, typval_T *tvs);
+int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap)
+ ATTRIBUTE_FORMAT_PRINTF(3, 0);
+int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, typval_T *tvs)
+ ATTRIBUTE_FORMAT_PRINTF(3, 0);
# include "message.pro"
# include "misc1.pro"
@@ -284,11 +258,7 @@ void mbyte_im_set_active(int active_arg);
# include "channel.pro"
// Not generated automatically, to add extra attribute.
-void ch_log(channel_T *ch, const char *fmt, ...)
-# ifdef USE_PRINTF_FORMAT_ATTRIBUTE
- __attribute__((format(printf, 2, 3)))
-# endif
- ;
+void ch_log(channel_T *ch, const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3);
# endif
diff --git a/src/term.c b/src/term.c
index a13959b1c3..b61667de8c 100644
--- a/src/term.c
+++ b/src/term.c
@@ -100,7 +100,7 @@ char *tgetstr(char *, char **);
// Change this to "if 1" to debug what happens with termresponse.
# if 0
# define DEBUG_TERMRESPONSE
-static void log_tr(const char *fmt, ...);
+static void log_tr(const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
# define LOG_TR(msg) log_tr msg
# else
# define LOG_TR(msg) do { /**/ } while (0)
diff --git a/src/version.c b/src/version.c
index b15034ecf3..34e4ceb49e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3274,
+/**/
3273,
/**/
3272,
diff --git a/src/vim.h b/src/vim.h
index 7d23986713..b9105b5d1d 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 {
diff --git a/src/vim9execute.c b/src/vim9execute.c
index f944fd7093..11f190c0d4 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -22,14 +22,6 @@
#include "vim9.h"
-#if defined(__GNUC__) || defined(__clang__)
-# define likely(x) __builtin_expect((x), 1)
-# define unlikely(x) __builtin_expect((x), 0)
-#else
-# define unlikely(x) (x)
-# define likely(x) (x)
-#endif
-
// Structure put on ec_trystack when ISN_TRY is encountered.
typedef struct {
int tcd_frame_idx; // ec_frame_idx at ISN_TRY