Skip to content

Commit

Permalink
readline: Add missing GCC_FMT_ATTR
Browse files Browse the repository at this point in the history
This fixes a compiler warning with -Werror=missing-format-attribute
and allows improved compiler checks for variable argument lists.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
stweil authored and Michael Tokarev committed Feb 1, 2014
1 parent c6830cd commit d5d1507
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/qemu/readline.h
Expand Up @@ -5,7 +5,8 @@
#define READLINE_MAX_CMDS 64
#define READLINE_MAX_COMPLETIONS 256

typedef void ReadLinePrintfFunc(void *opaque, const char *fmt, ...);
typedef void GCC_FMT_ATTR(2, 3) ReadLinePrintfFunc(void *opaque,
const char *fmt, ...);
typedef void ReadLineFlushFunc(void *opaque);
typedef void ReadLineFunc(void *opaque, const char *str,
void *readline_opaque);
Expand Down
3 changes: 2 additions & 1 deletion monitor.c
Expand Up @@ -4888,7 +4888,8 @@ static void sortcmdlist(void)
/* These functions just adapt the readline interface in a typesafe way. We
* could cast function pointers but that discards compiler checks.
*/
static void monitor_readline_printf(void *opaque, const char *fmt, ...)
static void GCC_FMT_ATTR(2, 3) monitor_readline_printf(void *opaque,
const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
Expand Down
3 changes: 2 additions & 1 deletion qemu-io.c
Expand Up @@ -219,7 +219,8 @@ static char *get_prompt(void)
return prompt;
}

static void readline_printf_func(void *opaque, const char *fmt, ...)
static void GCC_FMT_ATTR(2, 3) readline_printf_func(void *opaque,
const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
Expand Down

0 comments on commit d5d1507

Please sign in to comment.