This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/59367] New: Syntax error with #pragma message before "else"


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59367

            Bug ID: 59367
           Summary: Syntax error with #pragma message before "else"
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: felix.abecassis at gmail dot com

Using #pragma message before "else" triggers a syntax error:
pragma_message.c: In function 'main':
pragma_message.c:4:9: note: #pragma message: foo
 #pragma message "foo"
         ^
pragma_message.c:5:5: error: 'else' without a previous 'if'
     else {}
     ^
See attached file for source.

Preprocessed .i file:
# 1 "pragma_message.c"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 30 "/usr/include/stdc-predef.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/predefs.h" 1 3 4
# 31 "/usr/include/stdc-predef.h" 2 3 4
# 1 "<command-line>" 2
# 1 "pragma_message.c"
int main()
{
    if (1) {}

# 4 "pragma_message.c"
#pragma message "foo"
# 4 "pragma_message.c"

    else {}
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]