From 5e01eac10e915568324aff81b51d3af558757042 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 12 Dec 2014 18:52:05 -0800 Subject: [PATCH] dmx: Add _X_ATTRIBUTE_PRINTF to dmxConfigLog() & dmxConfigOutput() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gets rid of gcc 4.8 warnings: dmxparse.c: In function ‘dmxConfigLog’: dmxparse.c:61:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] vprintf(format, args); /* RATS: All calls to dmxConfigLog from ^ dmxprint.c: In function ‘dmxConfigOutput’: dmxprint.c:149:9: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] pos += vfprintf(str, format, args); /* assumes no newlines! */ Signed-off-by: Alan Coopersmith Reviewed-by: Rémi Cardona Reviewed-by: Keith Packard --- hw/dmx/config/dmxparse.h | 3 ++- hw/dmx/config/dmxprint.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/dmx/config/dmxparse.h b/hw/dmx/config/dmxparse.h index 7d31b6309..cc2f0eb71 100644 --- a/hw/dmx/config/dmxparse.h +++ b/hw/dmx/config/dmxparse.h @@ -38,6 +38,7 @@ #define _DMXPARSE_H_ #include /* For FILE */ +#include /* For _X_ATTRIBUTE_PRINTF */ /** Stores tokens not stored in other structures (e.g., keywords and ;) */ typedef struct _DMXConfigToken { @@ -203,7 +204,7 @@ extern int yylex(void); extern int yydebug; extern void yyerror(const char *message); -extern void dmxConfigLog(const char *format, ...); +extern void dmxConfigLog(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,0); extern void *dmxConfigAlloc(unsigned long bytes); extern void *dmxConfigRealloc(void *orig, unsigned long orig_bytes, unsigned long bytes); diff --git a/hw/dmx/config/dmxprint.c b/hw/dmx/config/dmxprint.c index 9dec52b5c..536d92bfe 100644 --- a/hw/dmx/config/dmxprint.c +++ b/hw/dmx/config/dmxprint.c @@ -130,7 +130,7 @@ dmxConfigPopState(void) dmxConfigNewline(); } -static void +static void _X_ATTRIBUTE_PRINTF(4, 5) dmxConfigOutput(int addSpace, int doNewline, const char *comment, const char *format, ...) {