diff options
author | Tiziano Müller <tiziano.mueller@chem.uzh.ch> | 2020-07-29 07:28:23 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-07-29 07:47:21 -0700 |
commit | f6fe3bbf9f6c0b7249933e19b94560b6b26bf269 (patch) | |
tree | 92e81c82505a9d23ed95b53c521f8dc1a40dd14d /gcc | |
parent | 55ede0bb87e74463c5b89fbfd501e85e9e683048 (diff) | |
download | gcc-f6fe3bbf9f6c0b7249933e19b94560b6b26bf269.zip gcc-f6fe3bbf9f6c0b7249933e19b94560b6b26bf269.tar.gz gcc-f6fe3bbf9f6c0b7249933e19b94560b6b26bf269.tar.bz2 |
preprocessor: Teach traditional about has_include [PR95889]
Traditional cpp (used by fortran) didn;t know about the new
__has_include__ implementation. Hey, since when did traditional cpp
grow __has_include__? That wasn't in knr!
libcpp/
* init.c (builtin_array): Add xref comment.
* traditional.c (fun_like_macro): Add HAS_INCLUDE codes.
gcc/testsuite/
* c-c++-common/cpp/has-include-1-traditional.c: New.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/c-c++-common/cpp/has-include-1-traditional.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/cpp/has-include-1-traditional.c b/gcc/testsuite/c-c++-common/cpp/has-include-1-traditional.c new file mode 100644 index 0000000..b0acdbe --- /dev/null +++ b/gcc/testsuite/c-c++-common/cpp/has-include-1-traditional.c @@ -0,0 +1,38 @@ +/* { dg-do preprocess { target c } } */ +/* { dg-options "-traditional-cpp" } */ + +#if __has_include ("stdlib.h") +#else +#error error 1 +#endif +#if __has_include (<stdlib.h>) +#else +#error error 2 +#endif +#if !__has_include ("stdlib.h") +#error error 3 +#elif !__has_include (<stdlib.h>) +#error error 4 +#endif +#if __has_include ("stdlib.h") && __has_include (<stdlib.h>) +#else +#error error 5 +#endif +#if !defined(__has_include) +#error error 6 +#endif +#ifndef __has_include +#error error 7 +#endif +#ifdef __has_include +#else +#error error 8 +#endif +#define m1 __has_include("stdlib.h") +#define m2 <stdlib.h> +#if !m1 +#error error 9 +#endif +#if !__has_include (m2) +#error error 13 +#endif |