diff --git a/lib/global.h b/lib/global.h index 14233202a..a13e61019 100644 --- a/lib/global.h +++ b/lib/global.h @@ -64,6 +64,7 @@ #include #include "glibcompat.h" +/* For SMB VFS only */ #ifndef __GNUC__ #define __attribute__(x) #endif diff --git a/lib/logging.c b/lib/logging.c index 16844b320..0e31354cb 100644 --- a/lib/logging.c +++ b/lib/logging.c @@ -110,6 +110,7 @@ get_log_filename (void) /* --------------------------------------------------------------------------------------------- */ static void +G_GNUC_PRINTF (1, 0) mc_va_log (const char *fmt, va_list args) { char *logfilename; diff --git a/lib/logging.h b/lib/logging.h index fa94c57de..effdfb48c 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -22,8 +22,10 @@ /*** declarations of public functions ************************************************************/ -extern void mc_log (const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -extern void mc_always_log (const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +/* *INDENT-OFF* */ +void mc_log (const char *fmt, ...) G_GNUC_PRINTF (1, 2); +void mc_always_log (const char *fmt, ...) G_GNUC_PRINTF (1, 2); +/* *INDENT-ON* */ /*** inline functions ****************************************************************************/ diff --git a/lib/serialize.c b/lib/serialize.c index 662a410d6..c0476e9d7 100644 --- a/lib/serialize.c +++ b/lib/serialize.c @@ -52,6 +52,7 @@ /* --------------------------------------------------------------------------------------------- */ static void +G_GNUC_PRINTF (2, 3) prepend_error_message (GError ** error, const char *format, ...) { char *prepend_str; diff --git a/lib/strutil.h b/lib/strutil.h index a0d5148e8..41125d196 100644 --- a/lib/strutil.h +++ b/lib/strutil.h @@ -217,7 +217,9 @@ estr_t str_vfs_convert_to (GIConv, const char *, int, GString *); /* printf function for str_buffer, append result of printf at the end of buffer */ -void str_printf (GString *, const char *, ...); +/* *INDENT-OFF* */ +void str_printf (GString * buffer, const char *format, ...) G_GNUC_PRINTF (2, 3); +/* *INDENT-ON* */ /* add standard replacement character in terminal encoding */ diff --git a/lib/tty/tty.h b/lib/tty/tty.h index 641f69926..7a40553de 100644 --- a/lib/tty/tty.h +++ b/lib/tty/tty.h @@ -120,7 +120,9 @@ extern void tty_print_char (int c); extern void tty_print_alt_char (int c, gboolean single); extern void tty_print_anychar (int c); extern void tty_print_string (const char *s); -extern void tty_printf (const char *s, ...); +/* *INDENT-OFF* */ +extern void tty_printf (const char *s, ...) G_GNUC_PRINTF (1, 2); +/* *INDENT-ON* */ extern void tty_print_one_vline (gboolean single); extern void tty_print_one_hline (gboolean single); diff --git a/lib/util.h b/lib/util.h index 68d68d623..9c972ed25 100644 --- a/lib/util.h +++ b/lib/util.h @@ -246,8 +246,10 @@ char *guess_message_value (void); char *mc_build_filename (const char *first_element, ...); char *mc_build_filenamev (const char *first_element, va_list args); -void mc_propagate_error (GError ** dest, int code, const char *format, ...); -void mc_replace_error (GError ** dest, int code, const char *format, ...); +/* *INDENT-OFF* */ +void mc_propagate_error (GError ** dest, int code, const char *format, ...) G_GNUC_PRINTF (3, 4); +void mc_replace_error (GError ** dest, int code, const char *format, ...) G_GNUC_PRINTF (3, 4); +/* *INDENT-ON* */ gboolean mc_time_elapsed (guint64 * timestamp, guint64 delay); diff --git a/lib/vfs/vfs.h b/lib/vfs/vfs.h index 037f889b2..097498df0 100644 --- a/lib/vfs/vfs.h +++ b/lib/vfs/vfs.h @@ -256,7 +256,9 @@ void vfs_release_path (const vfs_path_t * vpath); void vfs_fill_names (fill_names_f); -void vfs_print_message (const char *msg, ...) __attribute__ ((format (__printf__, 1, 2))); +/* *INDENT-OFF* */ +void vfs_print_message (const char *msg, ...) G_GNUC_PRINTF (1, 2); +/* *INDENT-ON* */ int vfs_ferrno (struct vfs_class *vfs); diff --git a/lib/widget/label.h b/lib/widget/label.h index 6fe16e246..6d1607fc6 100644 --- a/lib/widget/label.h +++ b/lib/widget/label.h @@ -28,7 +28,9 @@ typedef struct WLabel *label_new (int y, int x, const char *text); void label_set_text (WLabel * label, const char *text); -void label_set_textv (WLabel * label, const char *format, ...); +/* *INDENT-OFF* */ +void label_set_textv (WLabel * label, const char *format, ...) G_GNUC_PRINTF (2, 3); +/* *INDENT-ON* */ /*** inline functions ****************************************************************************/ diff --git a/lib/widget/wtools.h b/lib/widget/wtools.h index 8585eb828..fb17651d9 100644 --- a/lib/widget/wtools.h +++ b/lib/widget/wtools.h @@ -77,12 +77,13 @@ int query_dialog (const char *header, const char *text, int flags, int count, .. void query_set_sel (int new_sel); /* Create message box but don't dismiss it yet, not background safe */ -struct WDialog *create_message (int flags, const char *title, - const char *text, ...) __attribute__ ((format (__printf__, 3, 4))); +/* *INDENT-OFF* */ +struct WDialog *create_message (int flags, const char *title, const char *text, ...) + G_GNUC_PRINTF (3, 4); /* Show message box, background safe */ -void message (int flags, const char *title, const char *text, ...) - __attribute__ ((format (__printf__, 3, 4))); +void message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4); +/* *INDENT-ON* */ gboolean mc_error_message (GError ** mcerror, int *code); diff --git a/m4.include/mc-cflags.m4 b/m4.include/mc-cflags.m4 index 973189d93..1aea9c7a5 100644 --- a/m4.include/mc-cflags.m4 +++ b/m4.include/mc-cflags.m4 @@ -64,6 +64,7 @@ dnl Sorted -W options: MC_CHECK_ONE_CFLAG([-Wmissing-braces]) MC_CHECK_ONE_CFLAG([-Wmissing-declarations]) MC_CHECK_ONE_CFLAG([-Wmissing-field-initializers]) + MC_CHECK_ONE_CFLAG([-Wmissing-format-attribute]) MC_CHECK_ONE_CFLAG([-Wmissing-parameter-type]) MC_CHECK_ONE_CFLAG([-Wmissing-prototypes]) MC_CHECK_ONE_CFLAG([-Wmissing-variable-declarations]) diff --git a/src/vfs/fish/fish.c b/src/vfs/fish/fish.c index 262a5051b..1172f316b 100644 --- a/src/vfs/fish/fish.c +++ b/src/vfs/fish/fish.c @@ -236,6 +236,7 @@ fish_get_reply (struct vfs_class *me, int sock, char *string_buf, int string_len /* --------------------------------------------------------------------------------------------- */ static int +G_GNUC_PRINTF (4, 5) fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, const char *fmt, ...) { va_list ap; diff --git a/src/vfs/ftpfs/ftpfs.c b/src/vfs/ftpfs/ftpfs.c index bbe7228cc..d7c6485dc 100644 --- a/src/vfs/ftpfs/ftpfs.c +++ b/src/vfs/ftpfs/ftpfs.c @@ -264,8 +264,6 @@ static const char *netrcp; static char *ftpfs_get_current_directory (struct vfs_class *me, struct vfs_s_super *super); static int ftpfs_chdir_internal (struct vfs_class *me, struct vfs_s_super *super, const char *remote_path); -static int ftpfs_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, - const char *fmt, ...) __attribute__ ((format (__printf__, 4, 5))); static int ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super); static int ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char *netrcpass); @@ -449,6 +447,7 @@ ftpfs_reconnect (struct vfs_class *me, struct vfs_s_super *super) /* --------------------------------------------------------------------------------------------- */ static int +G_GNUC_PRINTF (4, 5) ftpfs_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, const char *fmt, ...) { diff --git a/tests/lib/vfs/vfs_parse_ls_lga.c b/tests/lib/vfs/vfs_parse_ls_lga.c index 8a07a4cbc..0a4e4cfc3 100644 --- a/tests/lib/vfs/vfs_parse_ls_lga.c +++ b/tests/lib/vfs/vfs_parse_ls_lga.c @@ -43,7 +43,9 @@ struct vfs_s_entry *vfs_root_entry; static struct vfs_s_inode *vfs_root_inode; static struct vfs_s_super *vfs_test_super; -void message (int flags, const char *title, const char *text, ...); +/* *INDENT-OFF* */ +void message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4); +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */