aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/has-feature.c
blob: 2fd0b4c7f1de09db90e55d2a1991cf947d42684c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* { dg-do compile } */
/* { dg-options "" } */
/* Test __has_{feature,extension} for C language features.  */

#if !__has_extension (c_alignas) || !__has_extension (c_alignof)
#error
#endif

#if !__has_extension (c_atomic) || !__has_extension (c_generic_selections)
#error
#endif

#if !__has_extension (c_static_assert) || !__has_extension (c_thread_local)
#error
#endif

#if !__has_extension (cxx_binary_literals)
#error
#endif

#if  __STDC_VERSION__ >= 201112L
/* Have C11 features.  */
#if !__has_feature (c_alignas) || !__has_feature (c_alignof)
#error
#endif

#if !__has_feature (c_atomic) || !__has_feature (c_generic_selections)
#error
#endif

#if !__has_feature (c_static_assert) || !__has_feature (c_thread_local)
#error
#endif

#else
/* Don't have C11 features.  */
#if __has_feature (c_alignas) || __has_feature (c_alignof)
#error
#endif

#if __has_feature (c_atomic) || __has_feature (c_generic_selections)
#error
#endif

#if __has_feature (c_static_assert) || __has_feature (c_thread_local)
#error
#endif

#endif

#if __STDC_VERSION__ >= 202000L
/* Have C2x features.  */
#if !__has_feature (cxx_binary_literals)
#error
#endif

#else
/* Don't have C2x features.  */
#if __has_feature (cxx_binary_literals)
#error
#endif
#endif