From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/Lexer/has_extension.c | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 clang/test/Lexer/has_extension.c (limited to 'clang/test/Lexer/has_extension.c') diff --git a/clang/test/Lexer/has_extension.c b/clang/test/Lexer/has_extension.c new file mode 100644 index 0000000..3b08510 --- /dev/null +++ b/clang/test/Lexer/has_extension.c @@ -0,0 +1,44 @@ +// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-PED-NONE %s +// RUN: %clang_cc1 -pedantic-errors -E %s -o - | FileCheck --check-prefix=CHECK-PED-ERR %s + +// CHECK-PED-NONE: no_dummy_extension +#if !__has_extension(dummy_extension) +int no_dummy_extension(); +#endif + +// Arbitrary feature to test that has_extension is a superset of has_feature +// CHECK-PED-NONE: attribute_overloadable +#if __has_extension(attribute_overloadable) +int attribute_overloadable(); +#endif + +// CHECK-PED-NONE: has_c_static_assert +// CHECK-PED-ERR: no_c_static_assert +#if __has_extension(c_static_assert) +int has_c_static_assert(); +#else +int no_c_static_assert(); +#endif + +// CHECK-PED-NONE: has_c_generic_selections +// CHECK-PED-ERR: no_c_generic_selections +#if __has_extension(c_generic_selections) +int has_c_generic_selections(); +#else +int no_c_generic_selections(); +#endif + +// CHECK-PED-NONE: has_c_alignas +// CHECK-PED-ERR: no_c_alignas +#if __has_extension(c_alignas) +int has_c_alignas(); +#else +int no_c_alignas(); +#endif + +// Arbitrary feature to test that the extension name can be surrounded with +// double underscores. +// CHECK-PED-NONE: has_double_underscores +#if __has_extension(__c_alignas__) +int has_double_underscores(); +#endif -- cgit v1.2.3