Clang Project

clang_source_code/test/Lexer/has_feature_c1x.c
1// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c89 %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
2// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=iso9899:199409 %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
3// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c99 %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
4// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c11 %s -o - | FileCheck --check-prefix=CHECK-1X %s
5//
6// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=gnu89 %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
7// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=gnu99 %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
8// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=gnu11 %s -o - | FileCheck --check-prefix=CHECK-1X %s
9
10#if __has_feature(c_atomic)
11int has_atomic();
12#else
13int no_atomic();
14#endif
15// CHECK-1X: has_atomic
16// CHECK-NO-1X: no_atomic
17
18#if __has_feature(c_static_assert)
19int has_static_assert();
20#else
21int no_static_assert();
22#endif
23// CHECK-1X: has_static_assert
24// CHECK-NO-1X: no_static_assert
25
26#if __has_feature(c_generic_selections)
27int has_generic_selections();
28#else
29int no_generic_selections();
30#endif
31// CHECK-1X: has_generic_selections
32// CHECK-NO-1X: no_generic_selections
33
34#if __has_feature(c_alignas)
35int has_alignas();
36#else
37int no_alignas();
38#endif
39// CHECK-1X: has_alignas
40// CHECK-NO-1X: no_alignas
41
42#if __has_feature(c_alignof)
43int has_alignof();
44#else
45int no_alignof();
46#endif
47// CHECK-1X: has_alignof
48// CHECK-NO-1X: no_alignof
49
50#if __has_feature(c_thread_local)
51int has_thread_local();
52#else
53int no_thread_local();
54#endif
55
56// CHECK-1X: has_thread_local
57// CHECK-NO-1X: no_thread_local
58
59#if __STDC_VERSION__ > 199901L
60int is_c1x();
61#else
62int is_not_c1x();
63#endif
64
65// CHECK-1X: is_c1x
66// CHECK-NO-1X: is_not_c1x
67