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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-09-15
                 CC|                            |manu at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Probably because the warning happens within a system header:

<source>: In function 'main':
<source>:6:14: warning: ISO C90 does not support boolean types
[-Wc90-c99-compat]
 #define bool _Bool
              ^~~~~
<source>:30:2: note: in expansion of macro 'bool'
  bool ok = true;
  ^~~~

This is another case of PR60304. The solution is to follow guidelines: 
https://gcc.gnu.org/wiki/DiagnosticsGuidelines#Locations

and use 

      source_location loc =
        expansion_point_location_if_in_system_header (original_location)

In this case, -Wsystem-headers doesn't work because:

              if (!in_system_header_at (loc))
                pedwarn_c90 (loc, OPT_Wpedantic,
                             "ISO C90 does not support boolean types");

I think this is useless, the diagnostics machinery already should disable
warning when loc is in a system header but still warn when -Wsystem-headers is
used.

Reply via email to