This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] cpplib: -Wno-endif-labels
On Sun, Mar 24, 2002 at 01:01:39PM +0000, Neil Booth wrote:
> Joseph S. Myers wrote:-
>
> > There ought, of course, to be testcases for what "-pedantic
> > -Wno-endif-labels" and "-Wno-endif-labels -pedantic" do, given that this
> > is a deliberate choice of compiler behaviour.
>
> Phil? I'll let you do that 8-)
Here's what I've just checked in on the trunk; they needed the specs/pedantic
tweak that Neil just approved. The testsuite results I posted with that
specs patch included the two below, so we're doing well.
2002-03-26 Phil Edwards <pme@gcc.gnu.org>
* gcc.dg/cpp/endif-pedantic1.c,
gcc.dg/cpp/endif-pedantic2.c: New tests.
Index: gcc.dg/cpp/endif-pedantic1.c
===================================================================
RCS file: endif-pedantic1.c
diff -N endif-pedantic1.c
--- /dev/null Tue May 5 13:32:27 1998
+++ endif-pedantic1.c Tue Mar 26 13:47:07 2002
@@ -0,0 +1,17 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-pedantic -Wno-endif-labels" } */
+
+/* Tests combinations of -pedantic and -Wno-endif-labels; see extratokens2.c
+ for more general tests. */
+
+/* Source: Phil Edwards, 25 Mar 2002. Copied from extratokens2.c and
+ modified. */
+
+#if 1
+#if 0
+#else foo /* { dg-bogus "extra tokens" "bad warning" } */
+#endif / /* { dg-bogus "extra tokens" "bad warning" } */
+#endif
+
Index: gcc.dg/cpp/endif-pedantic2.c
===================================================================
RCS file: endif-pedantic2.c
diff -N endif-pedantic2.c
--- /dev/null Tue May 5 13:32:27 1998
+++ endif-pedantic2.c Tue Mar 26 13:47:07 2002
@@ -0,0 +1,17 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-Wno-endif-labels -pedantic" } */
+
+/* Tests combinations of -pedantic and -Wno-endif-labels; see extratokens2.c
+ for more general tests. */
+
+/* Source: Phil Edwards, 25 Mar 2002. Copied from endif-pedantic1.c and
+ modified. */
+
+#if 1
+#if 0
+#else foo /* { dg-error "extra tokens" "tokens after #else" } */
+#endif / /* { dg-error "extra tokens" "tokens after #endif" } */
+#endif
+