public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/17089] New: error.c triggers -Wformat-extra-args
@ 2014-06-25 18:58 dmacks at netspace dot org
2014-06-25 19:05 ` [Bug libc/17089] " eblake at redhat dot com
2014-06-26 8:38 ` fweimer at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: dmacks at netspace dot org @ 2014-06-25 18:58 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17089
Bug ID: 17089
Summary: error.c triggers -Wformat-extra-args
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: dmacks at netspace dot org
CC: drepper.fsp at gmail dot com
Building gettext-0.19.1 (which embeds copies of gnulib, which has error.c with
code from libc), on OS X 10.8, which uses the clang compiler (via XCode-5.1),
gives:
clang -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../intl -I../intl
-DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -I/sw/include -Os -c -o
error.o error.c
error.c:381:12: warning: data argument not used by format string
[-Wformat-extra-args]
file_name, line_number);
The same construct is still present in misc/error.c in glibc git at line 306
[1]:
#if _LIBC
__fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
file_name, line_number);
#else
fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
file_name, line_number);
#endif
In the case where file_name==NULL, the format-string is " " but file_name and
line_number are still passed. This may not be a functional error [2], but it's
an easy-to-clear warning. Just have whole alternative fprintf() with
appropriate parameters in a conditional if/else block rather than just
conditional on the format-string. Something like:
if (file_name != NULL)
fprintf (stderr, "%s:%d: ", file_name, line_number)
else
fprintf (stderr, " ");
[1]
http://sourceware.org/git/?p=glibc.git;a=blob;f=misc/error.c;h=63bd309f22b7782474b72239ffa70e11a2b4b531;hb=HEAD
[2]
http://stackoverflow.com/questions/3578970/passing-too-many-arguments-to-printf
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libc/17089] error.c triggers -Wformat-extra-args
2014-06-25 18:58 [Bug libc/17089] New: error.c triggers -Wformat-extra-args dmacks at netspace dot org
@ 2014-06-25 19:05 ` eblake at redhat dot com
2014-06-26 8:38 ` fweimer at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: eblake at redhat dot com @ 2014-06-25 19:05 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17089
Eric Blake <eblake at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |eblake at redhat dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libc/17089] error.c triggers -Wformat-extra-args
2014-06-25 18:58 [Bug libc/17089] New: error.c triggers -Wformat-extra-args dmacks at netspace dot org
2014-06-25 19:05 ` [Bug libc/17089] " eblake at redhat dot com
@ 2014-06-26 8:38 ` fweimer at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: fweimer at redhat dot com @ 2014-06-26 8:38 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17089
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Flags| |security-
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-26 8:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25 18:58 [Bug libc/17089] New: error.c triggers -Wformat-extra-args dmacks at netspace dot org
2014-06-25 19:05 ` [Bug libc/17089] " eblake at redhat dot com
2014-06-26 8:38 ` fweimer at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).