| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "" } */ |
| 3 |
/* Test __has_{feature,extension} for C language features. */ |
| 4 |
|
| 5 |
#if !__has_extension (c_alignas) || !__has_extension (c_alignof) |
| 6 |
#error |
| 7 |
#endif |
| 8 |
|
| 9 |
#if !__has_extension (c_atomic) || !__has_extension (c_generic_selections) |
| 10 |
#error |
| 11 |
#endif |
| 12 |
|
| 13 |
#if !__has_extension (c_static_assert) || !__has_extension (c_thread_local) |
| 14 |
#error |
| 15 |
#endif |
| 16 |
|
| 17 |
#if !__has_extension (cxx_binary_literals) |
| 18 |
#error |
| 19 |
#endif |
| 20 |
|
| 21 |
#if __STDC_VERSION__ >= 201112L |
| 22 |
/* Have C11 features. */ |
| 23 |
#if !__has_feature (c_alignas) || !__has_feature (c_alignof) |
| 24 |
#error |
| 25 |
#endif |
| 26 |
|
| 27 |
#if !__has_feature (c_atomic) || !__has_feature (c_generic_selections) |
| 28 |
#error |
| 29 |
#endif |
| 30 |
|
| 31 |
#if !__has_feature (c_static_assert) || !__has_feature (c_thread_local) |
| 32 |
#error |
| 33 |
#endif |
| 34 |
|
| 35 |
#else |
| 36 |
/* Don't have C11 features. */ |
| 37 |
#if __has_feature (c_alignas) || __has_feature (c_alignof) |
| 38 |
#error |
| 39 |
#endif |
| 40 |
|
| 41 |
#if __has_feature (c_atomic) || __has_feature (c_generic_selections) |
| 42 |
#error |
| 43 |
#endif |
| 44 |
|
| 45 |
#if __has_feature (c_static_assert) || __has_feature (c_thread_local) |
| 46 |
#error |
| 47 |
#endif |
| 48 |
|
| 49 |
#endif |
| 50 |
|
| 51 |
#if __STDC_VERSION__ >= 202000L |
| 52 |
/* Have C2x features. */ |
| 53 |
#if !__has_feature (cxx_binary_literals) |
| 54 |
#error |
| 55 |
#endif |
| 56 |
|
| 57 |
#else |
| 58 |
/* Don't have C2x features. */ |
| 59 |
#if __has_feature (cxx_binary_literals) |
| 60 |
#error |
| 61 |
#endif |
| 62 |
#endif |