aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-07-17 20:05:01 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-07-17 20:05:01 +0000
commit537815242eb9dd7e704aac5f2bdea0c80c0655a2 (patch)
tree21ddc11c51d1e9d4000501b0351c8344ff0e7d67 /gcc/testsuite/gcc.dg/cpp
parentd882fe5150fbbeb4e44d007bb4964e5b22373021 (diff)
downloadgcc-537815242eb9dd7e704aac5f2bdea0c80c0655a2.zip
gcc-537815242eb9dd7e704aac5f2bdea0c80c0655a2.tar.gz
gcc-537815242eb9dd7e704aac5f2bdea0c80c0655a2.tar.bz2
syshdr.c: New test.
* gcc.dg/cpp/syshdr.c: New test. * gcc.dg/cpp/syshdr1.h, gcc.dg/cpp/syshdr2.h: New files. From-SVN: r35099
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp')
-rw-r--r--gcc/testsuite/gcc.dg/cpp/syshdr.c12
-rw-r--r--gcc/testsuite/gcc.dg/cpp/syshdr1.h4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/syshdr2.h5
3 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/syshdr.c b/gcc/testsuite/gcc.dg/cpp/syshdr.c
new file mode 100644
index 0000000..f36df3e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/syshdr.c
@@ -0,0 +1,12 @@
+/* Test for proper suppression of warnings in system headers,
+ and only in system headers. */
+/* FRAGILITY WARNING: The only way we have to distinguish the good error
+ from the bad error is that the good error is on line 4 and the bad is
+ on line 5 (of their respective files). dg.exp doesn't have any way to
+ condition error matchers on the file they're in. */
+
+/* { dg-do preprocess } */
+/* { dg-error "include_next" "good error" { target *-*-* } 4 } */
+
+#include "syshdr1.h" /* { dg-error "" "In file included from:" } */
+#include "syshdr2.h"
diff --git a/gcc/testsuite/gcc.dg/cpp/syshdr1.h b/gcc/testsuite/gcc.dg/cpp/syshdr1.h
new file mode 100644
index 0000000..310f39b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/syshdr1.h
@@ -0,0 +1,4 @@
+/* This file should generate an error because #include_next is not a
+ standard directive. */
+
+#include_next <stdio.h>
diff --git a/gcc/testsuite/gcc.dg/cpp/syshdr2.h b/gcc/testsuite/gcc.dg/cpp/syshdr2.h
new file mode 100644
index 0000000..0140fda
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/syshdr2.h
@@ -0,0 +1,5 @@
+/* This file would generate an error because of #include_next, but the
+ #pragma marks it a system header, so the error is suppressed. */
+
+#pragma GCC system_header
+#include_next <stdio.h>