This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix sysmac{1,2}.c take 2
- To: gcc-patches at gcc dot gnu dot org
- Subject: Fix sysmac{1,2}.c take 2
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Sun, 6 May 2001 10:44:27 +0100
- Cc: Geoff Keating <geoffk at redhat dot com>
This was a little trickier than I thought. Having some warnings only
generated if the compiler was built --enable-checking means we have
to avoid any situation where such warnings are generated.
This means that faking a system header in the testsuite can only be
done properly in a header file, with the system_header pragma.
Tested with an --enable-checking bootstrap.
Neil.
* gcc.dg/cpp/syshdr.h: New file.
* gcc.dg/cpp/sysmac1.c: Update.
* gcc.dg/cpp/sysmac2.c: Update.
Index: gcc.dg/cpp/syshdr.h
===================================================================
RCS file: syshdr.h
diff -N syshdr.h
--- /dev/null Tue May 5 13:32:27 1998
+++ syshdr.h Sun May 6 02:40:36 2001
@@ -0,0 +1,10 @@
+/* Indented to avoid "suggest hiding ..." warnings. */
+ #pragma GCC system_header
+
+#define sys_uint 1U
+#define sys_str(x) x
+#define sys_foo(x, y...) bar (x, ##y)
+
+#define sys_uint 1U
+#define sys_fl 1.0f
+#define sys_ld 1.0L
Index: gcc.dg/cpp/sysmac1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/sysmac1.c,v
retrieving revision 1.2
diff -u -p -r1.2 sysmac1.c
--- sysmac1.c 2001/05/05 19:18:38 1.2
+++ sysmac1.c 2001/05/06 09:40:37
@@ -8,17 +8,11 @@
/* Source: Neil Booth, 15 Jan 2001. */
+#include "syshdr.h"
+
#define uint 1U
#define str(x) x
#define foo(x, y...) bar(x, ##y) /* { dg-warning "named variadic macros" } */
-
-# 16 "system.h" 1 3 /* { dg-warning "followed by integer" } */
-
-#define sys_uint 1U
-#define sys_str(x) x
-#define sys_foo(x, y...) bar (x, ##y)
-
-# 22 "sysmac1.c" 2
#if uint /* { dg-warning "traditional C rejects" } */
#endif
Index: gcc.dg/cpp/sysmac2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/sysmac2.c,v
retrieving revision 1.2
diff -u -p -r1.2 sysmac2.c
--- sysmac2.c 2001/05/05 19:18:38 1.2
+++ sysmac2.c 2001/05/06 09:40:37
@@ -8,17 +8,11 @@
/* Source: Neil Booth, 15 Jan 2001. */
+#include "syshdr.h"
+
#define uint 1U
#define fl 1.0f
#define ld 1.0L
-
-# 16 "system.h" 1 3 /* { dg-warning "followed by integer" } */
-
-#define sys_uint 1U
-#define sys_fl 1.0f
-#define sys_ld 1.0L
-
-# 22 "sysmac2.c" 2
int
main ()