diff --git a/log.h b/log.h index 6dcb0b8d..1be82cb5 100644 --- a/log.h +++ b/log.h @@ -25,7 +25,7 @@ #define REPMGR_SYSLOG 1 #define REPMGR_STDERR 2 -void stderr_log_with_level(const char *level_name, int level, const char *fmt, ...); +void stderr_log_with_level(const char *level_name, int level, const char *fmt, ...) __attribute__ ((format (PG_PRINTF_ATTRIBUTE, 3, 4))); /* Standard error logging */ #define stderr_log_debug(...) stderr_log_with_level("DEBUG", LOG_DEBUG, __VA_ARGS__) diff --git a/strutil.c b/strutil.c index aaa186d3..fb14cb7e 100644 --- a/strutil.c +++ b/strutil.c @@ -25,7 +25,7 @@ #include "log.h" #include "strutil.h" -static int xvsnprintf(char *str, size_t size, const char *format, va_list ap); +static int xvsnprintf(char *str, size_t size, const char *format, va_list ap) __attribute__ ((format (PG_PRINTF_ATTRIBUTE, 3, 0))); /* Add strnlen on platforms that don't have it, like OS X */ #ifndef strnlen diff --git a/strutil.h b/strutil.h index 75eb63a4..cb3ee45e 100644 --- a/strutil.h +++ b/strutil.h @@ -31,9 +31,9 @@ #define MAXCONNINFO 1024 -extern int xsnprintf(char *str, size_t size, const char *format, ...); -extern int sqlquery_snprintf(char *str, const char *format, ...); -extern int maxlen_snprintf(char *str, const char *format, ...); +extern int xsnprintf(char *str, size_t size, const char *format, ...) __attribute__ ((format (PG_PRINTF_ATTRIBUTE, 3, 4))); +extern int sqlquery_snprintf(char *str, const char *format, ...) __attribute__ ((format (PG_PRINTF_ATTRIBUTE, 2, 3))); +extern int maxlen_snprintf(char *str, const char *format, ...) __attribute__ ((format (PG_PRINTF_ATTRIBUTE, 2, 3))); /* Add strnlen on platforms that don't have it, like OS X */ #ifndef strnlen