This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/68052] No printf format warnings in C++ code for macro in system headers


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]