[Bug c/85290] Defining identifiers to themselves in system headers prevents diagnostics from being emitted.

admin@tho-otto.de gcc-bugzilla@gcc.gnu.org
Sun Apr 8 17:56:00 GMT 2018


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

--- Comment #3 from Thorsten Otto <admin@tho-otto.de> ---
When compiling the attached source file, which includes a header file marked as
system header (same happens when include some real file from a system header
path), specifying -Wdeclaration-after-statement, no diagnostic is printed.

The reason is that the macro expansion gets in the way, resulting in a
preprocessed source of (roughly)


# 4 "bla.c"
int test(void)
{
 test();


# 8 "bla.c" 3
pid_t 
# 8 "bla.c"
      pid = 0;

 test();

 return pid;
}

essentialy marking the remaining translation unit as system header.


More information about the Gcc-bugs mailing list