summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/has_c_attribute.c
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2017-12-07 21:37:49 +0000
committerAaron Ballman <aaron@aaronballman.com>2017-12-07 21:37:49 +0000
commit48f5f4d895ecada915677f528d493814a76e890d (patch)
treef4d95612ffc58c9a8f327bcd2f448e64bb3b33c9 /clang/test/Preprocessor/has_c_attribute.c
parent095d4ea4bf4eb13efeeed8b0f1faf93e205ab021 (diff)
downloadbcm5719-llvm-48f5f4d895ecada915677f528d493814a76e890d.tar.gz
bcm5719-llvm-48f5f4d895ecada915677f528d493814a76e890d.zip
Add support for the __has_c_attribute builtin preprocessor macro.
This behaves similar to the __has_cpp_attribute builtin macro in that it allows users to detect whether an attribute is supported with the [[]] spelling syntax, which can be enabled in C with -fdouble-square-bracket-attributes. llvm-svn: 320088
Diffstat (limited to 'clang/test/Preprocessor/has_c_attribute.c')
-rw-r--r--clang/test/Preprocessor/has_c_attribute.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/has_c_attribute.c b/clang/test/Preprocessor/has_c_attribute.c
new file mode 100644
index 00000000000..f9e1a5841b4
--- /dev/null
+++ b/clang/test/Preprocessor/has_c_attribute.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fdouble-square-bracket-attributes -std=c11 -E %s -o - | FileCheck %s
+
+// CHECK: has_fallthrough
+#if __has_c_attribute(fallthrough)
+ int has_fallthrough();
+#endif
+
+// CHECK: does_not_have_selectany
+#if !__has_c_attribute(selectany)
+ int does_not_have_selectany();
+#endif
+
OpenPOWER on IntegriCloud