This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Tweak for gcc.dg/cpp/20000628-1.c
- To: gcc-patches at gcc dot gnu dot org
- Subject: Tweak for gcc.dg/cpp/20000628-1.c
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Thu, 29 Jun 2000 12:27:11 -0700
- Cc: Jakub Jelinek <jakub at redhat dot com>
This patch makes 20000628-1.c trigger the bug it's supposed to test
for, instead of that bug plus a stack of syntax-error complaints.
asm(""); is rejected in -ansi mode, and all the dg tests run in -ansi
mode unless that is specifically overridden.
I took the opportunity to tighten up the test a bit.
zw
* gcc.dg/cpp/20000628-1a.h: Don't use asm(). On each
of the first three inclusions, declare one variable. On the
fourth, error.
* gcc.dg/cpp/20000628-1.c (main): Reference the three variables
declared by 20000628-1a.h.
===================================================================
Index: testsuite/gcc.dg/cpp/20000628-1.c
--- testsuite/gcc.dg/cpp/20000628-1.c 2000/06/28 19:34:12 1.1
+++ testsuite/gcc.dg/cpp/20000628-1.c 2000/06/29 19:20:50
@@ -2,4 +2,4 @@
includes self. */
/* { dg-do compile } */
#include "20000628-1.h"
-int main(void) { return 0; }
+int main(void) { return a + b + c; }
===================================================================
Index: testsuite/gcc.dg/cpp/20000628-1a.h
--- testsuite/gcc.dg/cpp/20000628-1a.h 2000/06/28 19:34:12 1.1
+++ testsuite/gcc.dg/cpp/20000628-1a.h 2000/06/29 19:20:50
@@ -1,2 +1,15 @@
-/* Included from 20000628-1.h */
-asm ("");
+/* Included from 20000628-1.h. This header is supposed to be seen
+ exactly three times. */
+
+#if !defined A
+#define A
+int a;
+#elif !defined B
+#define B
+int b;
+#elif !defined C
+#define C
+int c;
+#else
+#error Included a fourth time
+#endif