[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gcc warning in argmatch
From: |
Bruno Haible |
Subject: |
gcc warning in argmatch |
Date: |
Thu, 19 Oct 2006 14:18:19 +0200 |
User-agent: |
KMail/1.9.1 |
Hi,
The gcc 4.1 option -Wformat=2 appears to be useful. The only warning I get
with it is:
argmatch.c:140: warning: format not a string literal, argument types not
checked
Moving the conditional expression into the function call allows gcc to
do format string checking, and the warning disappears. OK to apply?
2006-10-18 Bruno Haible <address@hidden>
* lib/argmatch.c (argmatch_invalid): Inline the format string
expression. This allows gcc to perform format string checking.
*** gnulib-20061012/lib/argmatch.c 2006-09-19 00:51:15.000000000 +0200
--- gnulib-20061012-modified/lib/argmatch.c 2006-10-19 00:19:09.000000000
+0200
***************
*** 131,141 ****
void
argmatch_invalid (const char *context, const char *value, ptrdiff_t problem)
{
! char const *format = (problem == -1
! ? _("invalid argument %s for %s")
! : _("ambiguous argument %s for %s"));
!
! error (0, 0, format, quotearg_n_style (0, ARGMATCH_QUOTING_STYLE, value),
quote_n (1, context));
}
--- 131,141 ----
void
argmatch_invalid (const char *context, const char *value, ptrdiff_t problem)
{
! error (0, 0,
! (problem == -1
! ? _("invalid argument %s for %s")
! : _("ambiguous argument %s for %s")),
! quotearg_n_style (0, ARGMATCH_QUOTING_STYLE, value),
quote_n (1, context));
}
- gcc warning in argmatch,
Bruno Haible <=