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

            Bug ID: 114436
           Summary: #pragma GCC system_header vs. _Pragma("GCC
                    system_header")
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: finke at cognitec dot com
  Target Milestone: ---

Created attachment 57784
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57784&action=edit
code snippet

When using the _Pragma operator instead of the #pragma directive for "GCC
system_header", a different behavior can be observed:

Warnings in included header files are not being ignored as it is the case with
the #pragma directive.

The attached code snippet does emit an error when compiled with 
"g++ -Werror=unused-parameter pragma.cc"

The expectation would be, that it compiles without error (clang is compiling it
without error).

gcc versions tested: 4.8.5 & 13.2.1

Output from compiler:
In file included from pragma.h:10:0,
                 from pragma.cc:1:
third_party.h:4:13: error: unused parameter 'force_unused_warning'
[-Werror=unused-parameter]
 inline void foo( int force_unused_warning) {
             ^
cc1plus: some warnings being treated as errors

Reply via email to