This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/68052] No printf format warnings in C++ code for macro in system headers
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 07 Oct 2017 00:28:41 +0000
- Subject: [Bug c++/68052] No printf format warnings in C++ code for macro in system headers
- Auto-submitted: auto-generated
- References: <bug-68052-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68052
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-10-07
Ever confirmed|0 |1
--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #7)
> That example doesn't work, here's the preprocessed source for a corrected
> version:
Without the system headerness:
4:11: warning: format '%s' expects argument of type 'char *', but argument 2
has type 'int' [-Wformat=]
"<3>"
^~~~~
5:20: note: format string is defined here
"%s", 3);
~^
%d
The warning points to '"', which is define in the system header, thus
suppressed. Like in the examples above, it should say:
5:20: warning: format '%s' expects argument of type 'char *', but argument 2
has type 'int' [-Wformat=]
"%s", 3);
~^
%d
In C++, there is no warning whatsoever for this, so that may be a different
bug.