diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
commit | c72c57c9e9b69944e3e009cd5e209634839581d3 (patch) | |
tree | 4fc2f184c499d106f29a386c452b49e5197bf63d /test/Preprocessor/feature_tests.c | |
parent | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff) | |
download | FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz |
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'test/Preprocessor/feature_tests.c')
-rw-r--r-- | test/Preprocessor/feature_tests.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Preprocessor/feature_tests.c b/test/Preprocessor/feature_tests.c index b78a251..19d8046 100644 --- a/test/Preprocessor/feature_tests.c +++ b/test/Preprocessor/feature_tests.c @@ -32,3 +32,23 @@ __has_builtin(__builtin_altivec_abs_v4sf) #error Broken handling of target-specific builtins #endif + +// Macro expansion does not occur in the parameter to __has_builtin, +// __has_feature, etc. (as is also expected behaviour for ordinary +// macros), so the following should not expand: + +#define MY_ALIAS_BUILTIN __c11_atomic_init +#define MY_ALIAS_FEATURE attribute_overloadable + +#if __has_builtin(MY_ALIAS_BUILTIN) || __has_feature(MY_ALIAS_FEATURE) +#error Alias expansion not allowed +#endif + +// But deferring should expand: + +#define HAS_BUILTIN(X) __has_builtin(X) +#define HAS_FEATURE(X) __has_feature(X) + +#if !HAS_BUILTIN(MY_ALIAS_BUILTIN) || !HAS_FEATURE(MY_ALIAS_FEATURE) +#error Expansion should have occurred +#endif |