https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79008
Eric Gallager <egallager at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2017-08-22 CC| |egallager at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #0) > In C++ (but not in C) -Wbuiltin-declaration-mismatch prints the conflicting > declarations of the function as shown below. This is helpful when the > declarations visibly differ but not so much when they look the same as is > likely to be common in code that declares the function based on the C or > POSIX standards. > > To avoid this problem, when the conflict is due to missing attributes, the > warning should also include the attributes that cause the conflict. Do you have an example that uses attributes? The one you included here doesn't show any problem with attributes. > > To make this feature generally available beyond this specific warning I > would suggest to enhance the pretty printer to make it possible to also > include attributes in a declaration. E.g., by interpreting the pound ('#') > flag as a request to do so ("%#qE"). > > $ cat b.c && gcc -S -Wall -Wextra -Wpedantic -xc++ b.c > extern "C" int sprintf (char*, ...); > > b.c:1:16: warning: declaration of ‘int sprintf(char*, ...)’ conflicts with > built-in declaration ‘int sprintf(char*, const char*, ...)’ > [-Wbuiltin-declaration-mismatch] > extern "C" int sprintf (char*, ...); > ^~~~~~~