aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2004-02-11 23:50:45 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2004-02-11 23:50:45 +0000
commit32e8aa9af19ca5ba91539abc13017cd94778245c (patch)
treea6b7a99780e0752da0df83d39dc326af2f9b8261 /gcc/cppexp.c
parent3b8e0c9129b0ed3fe2e4aa5bc466df5348e2d5fd (diff)
downloadgcc-32e8aa9af19ca5ba91539abc13017cd94778245c.zip
gcc-32e8aa9af19ca5ba91539abc13017cd94778245c.tar.gz
gcc-32e8aa9af19ca5ba91539abc13017cd94778245c.tar.bz2
re PR c/456 (constant expressions constraints (gcc.dg/c90-const-expr-1))
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: * gcc.dg/cpp/c90-if-comma-1.c, gcc.dg/cpp/c99-if-comma-1.c: New tests. From-SVN: r77676
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index c6f1f1d..5603f5b 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -1347,7 +1347,8 @@ num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
/* Comma. */
default: /* case CPP_COMMA: */
- if (CPP_PEDANTIC (pfile) && !pfile->state.skip_eval)
+ if (CPP_PEDANTIC (pfile) && (!CPP_OPTION (pfile, c99)
+ || !pfile->state.skip_eval))
cpp_error (pfile, CPP_DL_PEDWARN,
"comma operator in operand of #if");
lhs = rhs;