This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for constant expression constraints in preprocessor
- From: "Zack Weinberg" <zack at codesourcery dot com>
- To: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 11 Feb 2004 14:23:58 -0800
- Subject: Re: Patch for constant expression constraints in preprocessor
- References: <Pine.LNX.4.58.0402111943230.19297@digraph.polyomino.org.uk>
"Joseph S. Myers" <jsm@polyomino.org.uk> writes:
> Although constant expression constraints in the compiler are extremely
> complicated, those in the preprocessor are simple (largely because of
> the lack of casts, sizeof and floating point constants). (The
> _semantics_ are also simple once the correction of DR#265 is applied.)
> I think the following patch is all that is needed to follow the
> constraints of the various standard versions: unlike C99, C90 and C++
> do not permit comma expressions in constant expressions at all outside
> of sizeof, even in other unevaluated subexpressions. (Note that this
> patch only addresses a small part of bug 456.)
>
> Boostrapped with no regressions on i686-pc-linux-gnu. OK to commit to
> mainline and 3.4 branch (this is a regression in C90 mode relative to
> 3.2.3, 3.0.4 and 2.95.3)?
Ok.
>
> 2004-02-11 Joseph S. Myers <jsm@polyomino.org.uk>
>
> PR c/456
> * cppexp.c (num_binary_op): Don't allow comma operators in #if
> constant expressions at all outside C99 mode if pedantic.
>
> testsuite:
> 2004-02-11 Joseph S. Myers <jsm@polyomino.org.uk>
>
> PR c/456
> * gcc.dg/cpp/c90-if-comma-1.c, gcc.dg/c99-if-comma-1.c: New tests.