Werner LEMBERG wrote:
This is better, thanks. However, I'm not happy to globally disable
the warning. Isn't it possible to use GCC function attributes to
suppress the warning locally, exactly at the right spot – or rather
telling GCC that there is nothing to warn about?
Could be, yes.
Alter
> I suggest disabling the unwanted diagnostic instead. Something like
> this at the start of the file:
>
> #if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
> # pragma GCC diagnostic ignored "-Wformat-extra-args"
> #endif
This is better, thanks. However, I'm not happy to globally disable
the warning.
On 11/05/2014 02:03 AM, Werner LEMBERG wrote:
it might be a programming error
Sure, but it might not be an error, and in fact in this case it is
definitely not an error.
I suggest disabling the unwanted diagnostic instead. Something like
this at the start of the file:
#if 4 < __GNUC__ + (3
>> #if _LIBC
>> - __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
>> - file_name, line_number);
>> + if (file_name != NULL)
>> +__fxprintf (NULL, "%s:%d: ", file_name, line_number);
>> + else
>> +__fxprintf (NULL, " ");
>
> The new version is less efficient becaus
Werner LEMBERG wrote
#if _LIBC
- __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
- file_name, line_number);
+ if (file_name != NULL)
+__fxprintf (NULL, "%s:%d: ", file_name, line_number);
+ else
+__fxprintf (NULL, " ");
The new version is less efficient because
[v0.1-248-gc564172]
A user reported the following warning:
CC error.lo
error.c:386:12: warning: data argument not used by format string
[-Wformat-extra-args]
file_name, line_number);
^
Below is a trivial patch that fixes this.
Werner
=