From: Jakub Jelinek Date: Tue, 4 Feb 2020 12:40:56 +0000 (+0100) Subject: libcpp: Diagnose __has_include outside of preprocessor directives [PR93545] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=59afd6ad83665ad93d3c87af238a21a9c1c38079;p=gcc.git 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 * 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. --- 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 00000000000..bb1b9052685 --- /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 ("")) /* { dg-error "used outside of preprocessing directive" } */ + ; +}