Signed-off-by: Mark Rustad <mark.d.rus...@intel.com> --- Makefile.am | 2 +- fcnsq.c | 2 ++ fcping.c | 2 ++ include/fcoemon_utils.h | 7 +++++-- 4 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 15d2182..98fbe12 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ sbin_PROGRAMS = fcoeadm fcoemon fcping fipvlan fcnsq fcrls AM_CPPFLAGS = -I${srcdir}/include -I${builddir}/include ## pass the sysconfdir into the C proprocessor AM_CPPFLAGS += -DSYSCONFDIR="\"${sysconfdir}\"" -AM_CFLAGS = -Wall -Werror +AM_CFLAGS = -Wall -Werror -Wformat=2 ## rules for building fcoeadm fcoeadm_SOURCES = fcoeadm.c fcoeadm_display.c diff --git a/fcnsq.c b/fcnsq.c index e5abeb9..1d52f85 100644 --- a/fcnsq.c +++ b/fcnsq.c @@ -45,6 +45,7 @@ typedef __u64 u64; static bool quiet = false; +__attribute__((__format__(__printf__, 2, 3))) static int print_result(const char *prefix, const char *format, ...) { va_list ap; @@ -58,6 +59,7 @@ static int print_result(const char *prefix, const char *format, ...) return rc; } +__attribute__((__format__(__printf__, 1, 2))) static int print_err(const char *format, ...) { va_list ap; diff --git a/fcping.c b/fcping.c index 0b93012..bc51d5f 100644 --- a/fcping.c +++ b/fcping.c @@ -158,7 +158,9 @@ static struct fp_stats fp_stats; p[7] = (u_char) (v) & 0xFF; \ } while (0) +__attribute__((__format__(__printf__, 2, 3))) static void sa_log_func(const char *func, const char *format, ...); +__attribute__((__format__(__printf__, 3, 4))) static void sa_log_err(int, const char *func, const char *format, ...); static void sa_log_output(const char *buf); diff --git a/include/fcoemon_utils.h b/include/fcoemon_utils.h index 3bdb377..2657a11 100644 --- a/include/fcoemon_utils.h +++ b/include/fcoemon_utils.h @@ -42,8 +42,11 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +__attribute__((__format__(__printf__, 1, 2))) void sa_log(const char *format, ...); +__attribute__((__format__(__printf__, 1, 2))) void sa_log_debug(const char *format, ...); +__attribute__((__format__(__printf__, 3, 4))) void sa_log_err(int, const char *func, const char *format, ...); /* @@ -65,8 +68,8 @@ extern u_int sa_log_flags; /* timestamp and other option flags */ extern int sa_log_time_delta_min; /* minimum diff to print in millisec */ extern char *sa_log_prefix; /* string to print before any message */ -extern void assert_failed(const char *s, ...) - __attribute__ ((format(printf, 1, 2))); +__attribute__((__format__(__printf__, 1, 2))) +extern void assert_failed(const char *s, ...); #ifndef UNLIKELY #define UNLIKELY(_x) (_x) _______________________________________________ devel mailing list devel@open-fcoe.org https://lists.open-fcoe.org/mailman/listinfo/devel