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

            Bug ID: 82335
           Summary: Incorrect _Pragma expansion with in complex macro
                    expressions
           Product: gcc
           Version: 5.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pskocik at gmail dot com
  Target Milestone: ---

Created attachment 42239
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42239&action=edit
reproducer for "Incorrect _Pragma expansion with in complex macro expressions";
compile with -Wall -Wextra

Basically, _Pragma's expansions (as shown with gcc -E) seem to get shifted out
of some slightly "more complex" macro expressions, which renders them
ineffective.

Attached is one piece of code that reproduces the problem. When compiled with
`-Wall -Wextra`, the warning which should've been silenced isn't, because the
#pragma push-pop pair gets shifted out of the expression.

It's hard to pinpoint exactly what causes this, and the problem goes away with
minor complexity reductions (such as replacing a macro (e.g., the tof macro)
with what it expands to), but it seems to stick in more complex contexts.

clang handles everything fine.

Reply via email to