Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 38161
Product:  
Component:  
Status: RESOLVED
Resolution: DUPLICATE of bug 36453
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
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 38161 depends on: Show dependency tree
Show dependency graph
Bug 38161 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2008-11-16 21:50 Opened: 2008-11-16 21:14
#ifndef FOO
#define FOO sizeof(void *)
#elif FOO
#endif
t.c:3:7: error: missing binary operator before token "("

I expect it's caused by the fix to bug #36320.

------- Comment #1 From Tom Tromey 2008-11-17 17:29 -------
According to my reading of the standard, this code is in fact incorrect.
This is basically the same as #36320.

I'm beginning to wonder, though, whether this change was overly eager on my
part
and should be made -pedantic only, or something like that.

------- Comment #2 From Hallvard B Furuseth 2008-11-17 20:15 -------
Subject: Re:  [4.4 regression] #elif <non-const expression #defined in this
#if> breaks

Yes, I should have read the #36320 text more carefully.  I merely
noticed that its empty #elif cannot expand to anything correct, while
my example can (and does in the real-life case which produced it).

I thought C99 6.10p7 was what saved it:
  The preprocessing tokens within a preprocessing directive are
  not subject to macro expansion unless otherwise stated.
but maybe not.  6.10.1p3 doesn't say anything about some #elif branches
not being evaluated:-(  Hopefully that's just overly standard-lawerly
though.  Maybe comp.std.c would have been a better place to ask.

------- Comment #3 From Neil Booth 2008-11-18 22:18 -------
The standard talks about the groups controlled by conditionals being skipped.

There is no conditional controlling the #elif - it is at the top level - so I
see nothing permitting its non-evaluation.

------- Comment #4 From Richard Guenther 2008-12-05 12:20 -------

*** This bug has been marked as a duplicate of 36453 ***

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug