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

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Oct 6 23:26:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68052

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That example doesn't work, here's the preprocessed source for a corrected
version:

# 1 "m.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "m.c"
# 1 "sys/m.h" 1 3 4
# 2 "m.c" 2
extern int printf(const char*, ...);
int main(void) {
    printf(
# 4 "m.c" 3 4
          "<3>" 
# 4 "m.c"
                 "%s", 3);
    return 0;
}


More information about the Gcc-bugs mailing list