aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-02-04 13:40:56 +0100
committerJakub Jelinek <jakub@redhat.com>2020-02-04 13:40:56 +0100
commit59afd6ad83665ad93d3c87af238a21a9c1c38079 (patch)
treeac4e71a0717ea5285754d91463095ee25f1c3a59
parentf8d6e448f801bcbdaa83c98991b15ed35d1bb3cc (diff)
downloadgcc-59afd6ad83665ad93d3c87af238a21a9c1c38079.zip
gcc-59afd6ad83665ad93d3c87af238a21a9c1c38079.tar.gz
gcc-59afd6ad83665ad93d3c87af238a21a9c1c38079.tar.bz2
libcpp: Diagnose __has_include outside of preprocessor directives [PR93545]
Add forgotten gcc/testsuite/c-c++-common/gomp/has-include-1.c. 2020-02-04 Jakub Jelinek <jakub@redhat.com> * macro.c (builtin_has_include): Diagnose __has_include* use outside of preprocessing directives. * c-c++-common/cpp/has-include-1.c: New test. * c-c++-common/cpp/has-include-next-1.c: New test. * c-c++-common/gomp/has-include-1.c: New test.
-rw-r--r--gcc/testsuite/c-c++-common/gomp/has-include-1.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/gomp/has-include-1.c b/gcc/testsuite/c-c++-common/gomp/has-include-1.c
new file mode 100644
index 0000000..bb1b905
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/has-include-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+void
+foo (void)
+{
+#pragma omp parallel if (__has_include ("<stdlib.h>")) /* { dg-error "used outside of preprocessing directive" } */
+ ;
+}