https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79948
Bug ID: 79948 Summary: _Pragma(“GCC error”) is processed differently inside and outside of a #if directive Product: gcc Version: 5.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: duparq at free dot fr Target Milestone: --- Created attachment 40919 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40919&action=edit Source file that produces the unexpected behavior I process this with gcc -E -std=c1x -Wall -Wextra -Wpedantic main.c >output. I get this on the command line (almost normal): ''' main.c:16:11: error: This is an error "ISVOID(E):" ISVOID(E) ^ ''' I get that in the output: ''' # 1 "main.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "main.c" # 14 "main.c" "ISVOID(something):" 0 "ISVOID():" 1 "ISVOID(E):" # 16 "main.c" # 16 "main.c" 1 "ISVOID(something)==1: false" "ISVOID()==1: true" "ISVOID(E)==1: false" ''' Then, ISVOID(E) expands to 1 outside the #if directive and it expands to 0 inside, meaning that _Pragma("GCC error") is processed differently inside and outside a #if directive. Moreover, there is no emission of a "This is an error" related to the #if ISVOID(E) == 1. Is that behavior normal?