First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 36320
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Tom Tromey <tromey@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Neil Booth <neil@gcc.gnu.org>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 36320 depends on: 36453 Show dependency tree
Show dependency graph
Bug 36320 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2008-05-24 18:04 Opened: 2008-05-24 10:55
The syntax error in #elif below is not diagnosed with (say) --std=c99
-pedantic-errors.

int z;
#if 1
#elif
#endif

Syntax is:

elif-group:
        # elif constant-expression new-line groupopt

and constant expression cannot be empty.  The syntax relaxation of 6.10p4 does
not apply as the group that the #elif lies in (beginning with the #if) is not
skipped.

------- Comment #1 From Tom Tromey 2008-05-24 16:21 -------
Confirmed.  This seems like a weird design to me, but my reading of the
standard text agrees with yours.

------- Comment #2 From Tom Tromey 2008-05-24 18:04 -------
Testing a patch.

------- Comment #3 From Tom Tromey 2008-05-30 14:25 -------
Subject: Bug 36320

Author: tromey
Date: Fri May 30 14:25:09 2008
New Revision: 136209

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=136209
Log:
gcc/testsuite
        PR preprocessor/36320:
        * gcc.dg/cpp/pr36320.c: New file.
libcpp
        PR preprocessor/36320:
        * internal.h (_cpp_parse_expr): Update.
        * expr.c (_cpp_parse_expr): Add 'is_if' argument.  Update error
        messages.
        * directives.c (do_if): Update.
        (do_elif): Require expression if processing group.

Added:
    trunk/gcc/testsuite/gcc.dg/cpp/pr36320.c
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libcpp/ChangeLog
    trunk/libcpp/directives.c
    trunk/libcpp/expr.c
    trunk/libcpp/internal.h

------- Comment #4 From Tom Tromey 2008-05-30 15:07 -------
Fixed on trunk.

First Last Prev Next    No search results available      Search page      Enter new bug