xref: /minix3/external/bsd/llvm/dist/clang/test/Lexer/has_extension.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -std=c99 -E %s -o - | FileCheck --check-prefix=CHECK-PED-NONE %s
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -std=c99 -pedantic-errors -E %s -o - | FileCheck --check-prefix=CHECK-PED-ERR %s
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc // CHECK-PED-NONE: no_dummy_extension
5f4a2713aSLionel Sambuc #if !__has_extension(dummy_extension)
6f4a2713aSLionel Sambuc int no_dummy_extension();
7f4a2713aSLionel Sambuc #endif
8f4a2713aSLionel Sambuc 
9f4a2713aSLionel Sambuc // Arbitrary feature to test that has_extension is a superset of has_feature
10f4a2713aSLionel Sambuc // CHECK-PED-NONE: attribute_overloadable
11f4a2713aSLionel Sambuc #if __has_extension(attribute_overloadable)
12f4a2713aSLionel Sambuc int attribute_overloadable();
13f4a2713aSLionel Sambuc #endif
14f4a2713aSLionel Sambuc 
15f4a2713aSLionel Sambuc // CHECK-PED-NONE: has_c_static_assert
16f4a2713aSLionel Sambuc // CHECK-PED-ERR: no_c_static_assert
17f4a2713aSLionel Sambuc #if __has_extension(c_static_assert)
18f4a2713aSLionel Sambuc int has_c_static_assert();
19f4a2713aSLionel Sambuc #else
20f4a2713aSLionel Sambuc int no_c_static_assert();
21f4a2713aSLionel Sambuc #endif
22f4a2713aSLionel Sambuc 
23f4a2713aSLionel Sambuc // CHECK-PED-NONE: has_c_generic_selections
24f4a2713aSLionel Sambuc // CHECK-PED-ERR: no_c_generic_selections
25f4a2713aSLionel Sambuc #if __has_extension(c_generic_selections)
26f4a2713aSLionel Sambuc int has_c_generic_selections();
27f4a2713aSLionel Sambuc #else
28f4a2713aSLionel Sambuc int no_c_generic_selections();
29f4a2713aSLionel Sambuc #endif
30f4a2713aSLionel Sambuc 
31f4a2713aSLionel Sambuc // CHECK-PED-NONE: has_c_alignas
32f4a2713aSLionel Sambuc // CHECK-PED-ERR: no_c_alignas
33f4a2713aSLionel Sambuc #if __has_extension(c_alignas)
34f4a2713aSLionel Sambuc int has_c_alignas();
35f4a2713aSLionel Sambuc #else
36f4a2713aSLionel Sambuc int no_c_alignas();
37f4a2713aSLionel Sambuc #endif
38f4a2713aSLionel Sambuc 
39*0a6a1f1dSLionel Sambuc // CHECK-PED-NONE: has_c_alignof
40*0a6a1f1dSLionel Sambuc // CHECK-PED-ERR: no_c_alignof
41*0a6a1f1dSLionel Sambuc #if __has_extension(c_alignof)
42*0a6a1f1dSLionel Sambuc int has_c_alignof();
43*0a6a1f1dSLionel Sambuc #else
44*0a6a1f1dSLionel Sambuc int no_c_alignof();
45*0a6a1f1dSLionel Sambuc #endif
46*0a6a1f1dSLionel Sambuc 
47f4a2713aSLionel Sambuc // Arbitrary feature to test that the extension name can be surrounded with
48f4a2713aSLionel Sambuc // double underscores.
49f4a2713aSLionel Sambuc // CHECK-PED-NONE: has_double_underscores
50f4a2713aSLionel Sambuc #if __has_extension(__c_alignas__)
51f4a2713aSLionel Sambuc int has_double_underscores();
52f4a2713aSLionel Sambuc #endif
53