diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2013-01-09 02:20:00 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2013-01-09 02:20:00 +0000 |
commit | a0f2d02d166880e5d826074b6c2ecbf64f8ca70d (patch) | |
tree | 75ec385ca0e5b01e621b6059404b216f0efbc329 /test/Preprocessor/has_include.c | |
parent | 7dc80e1c4dd44ce2b2da0fc3daff786c3d02348b (diff) |
Make __has_include a bit more resilient in the presence of macros. <rdar://problem/12748859>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Preprocessor/has_include.c')
-rw-r--r-- | test/Preprocessor/has_include.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Preprocessor/has_include.c b/test/Preprocessor/has_include.c index 10f7795fc3..985501a215 100644 --- a/test/Preprocessor/has_include.c +++ b/test/Preprocessor/has_include.c @@ -64,6 +64,33 @@ #error "defined(__has_include_next) failed (8)." #endif +// Fun with macros +#define MACRO1 __has_include(<stdint.h>) +#define MACRO2 ("stdint.h") +#define MACRO3 ("blahblah.h") +#define MACRO4 blahblah.h>) +#define MACRO5 <stdint.h> + +#if !MACRO1 + #error "__has_include with macro failed (1)." +#endif + +#if !__has_include MACRO2 + #error "__has_include with macro failed (2)." +#endif + +#if __has_include MACRO3 + #error "__has_include with macro failed (3)." +#endif + +#if __has_include(<MACRO4 + #error "__has_include with macro failed (4)." +#endif + +#if !__has_include(MACRO5) + #error "__has_include with macro failed (2)." +#endif + // Try badly formed expressions. // FIXME: We can recover better in almost all of these cases. (PR13335) |