libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / has-feature.c
blob2fd0b4c7f1de09db90e55d2a1991cf947d42684c
1 /* { dg-do compile } */
2 /* { dg-options "" } */
3 /* Test __has_{feature,extension} for C language features. */
5 #if !__has_extension (c_alignas) || !__has_extension (c_alignof)
6 #error
7 #endif
9 #if !__has_extension (c_atomic) || !__has_extension (c_generic_selections)
10 #error
11 #endif
13 #if !__has_extension (c_static_assert) || !__has_extension (c_thread_local)
14 #error
15 #endif
17 #if !__has_extension (cxx_binary_literals)
18 #error
19 #endif
21 #if __STDC_VERSION__ >= 201112L
22 /* Have C11 features. */
23 #if !__has_feature (c_alignas) || !__has_feature (c_alignof)
24 #error
25 #endif
27 #if !__has_feature (c_atomic) || !__has_feature (c_generic_selections)
28 #error
29 #endif
31 #if !__has_feature (c_static_assert) || !__has_feature (c_thread_local)
32 #error
33 #endif
35 #else
36 /* Don't have C11 features. */
37 #if __has_feature (c_alignas) || __has_feature (c_alignof)
38 #error
39 #endif
41 #if __has_feature (c_atomic) || __has_feature (c_generic_selections)
42 #error
43 #endif
45 #if __has_feature (c_static_assert) || __has_feature (c_thread_local)
46 #error
47 #endif
49 #endif
51 #if __STDC_VERSION__ >= 202000L
52 /* Have C2x features. */
53 #if !__has_feature (cxx_binary_literals)
54 #error
55 #endif
57 #else
58 /* Don't have C2x features. */
59 #if __has_feature (cxx_binary_literals)
60 #error
61 #endif
62 #endif