From e8c722ba2832e4d0cae6ba3d043e5f06aaadbacd Mon Sep 17 00:00:00 2001 From: Kaleb KEITHLEY Date: Wed, 25 Jan 2012 07:01:48 -0500 Subject: Add format/printf/attribute to log decls This enables compile-time checking of printf-style format checking Reason for doing it this way: N/A Description of test cases: N/A Change-Id: I9e26a5dceef5b545b9434b1d418c3d1193b4ef9a Signed-off-by: Kaleb KEITHLEY Reviewed-on: http://review.gluster.com/2693 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur --- libglusterfs/src/logging.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'libglusterfs/src/logging.h') diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h index 01c454535..cb23cb54f 100644 --- a/libglusterfs/src/logging.h +++ b/libglusterfs/src/logging.h @@ -113,10 +113,14 @@ void gf_log_globals_init (void); int gf_log_init (const char *filename); void gf_log_cleanup (void); -int _gf_log (const char *domain, const char *file, const char *function, - int32_t line, gf_loglevel_t level, const char *fmt, ...); -int _gf_log_callingfn (const char *domain, const char *file, const char *function, - int32_t line, gf_loglevel_t level, const char *fmt, ...); +int _gf_log (const char *domain, const char *file, + const char *function, int32_t line, gf_loglevel_t level, + const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 6, 7))); +int _gf_log_callingfn (const char *domain, const char *file, + const char *function, int32_t line, gf_loglevel_t level, + const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 6, 7))); int _gf_log_nomem (const char *domain, const char *file, const char *function, int line, gf_loglevel_t level, @@ -143,7 +147,8 @@ void gf_log_set_xl_loglevel (void *xl, gf_loglevel_t level); #define GF_ERROR(xl, format, args...) \ gf_log ((xl)->name, GF_LOG_ERROR, format, ##args) -int gf_cmd_log (const char *domain, const char *fmt, ...); +int gf_cmd_log (const char *domain, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); int gf_cmd_log_init (const char *filename); -- cgit