+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.
+
2004-02-11 Uros Bizjak <uros@kss-loka.si>
* optabs.h (enum optab_index): Add new OTI_log10 and OTI_log2.
/* 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;
+2004-02-11 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ PR c/456
+ * gcc.dg/cpp/c90-if-comma-1.c, gcc.dg/cpp/c99-if-comma-1.c: New
+ tests.
+
2004-02-11 Uros Bizjak <uros@kss-loka.si>
* gcc.dg/builtins-33.c: New test.
--- /dev/null
+/* Test for commas in constant expressions in #if: not permitted in C90
+ but permitted in unevaluated subexpressions in C99. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do preprocess } */
+/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
+
+#if (1, 2) /* { dg-error "comma" "evaluated comma" } */
+#endif
+
+#if 1 || (1, 2) /* { dg-error "comma" "unevaluated comma" } */
+#endif
--- /dev/null
+/* Test for commas in constant expressions in #if: not permitted in C90
+ but permitted in unevaluated subexpressions in C99. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do preprocess } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+#if (1, 2) /* { dg-error "comma" "evaluated comma" } */
+#endif
+
+#if 1 || (1, 2)
+#endif