Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c99 -E %s -o - | FileCheck --check-prefix=CHECK-PED-NONE %s |
| 2 | // RUN: %clang_cc1 -std=c99 -pedantic-errors -E %s -o - | FileCheck --check-prefix=CHECK-PED-ERR %s |
Peter Collingbourne | c1b5fa4 | 2011-05-13 20:54:45 +0000 | [diff] [blame] | 3 | |
| 4 | // CHECK-PED-NONE: no_dummy_extension |
| 5 | #if !__has_extension(dummy_extension) |
| 6 | int no_dummy_extension(); |
| 7 | #endif |
| 8 | |
| 9 | // Arbitrary feature to test that has_extension is a superset of has_feature |
| 10 | // CHECK-PED-NONE: attribute_overloadable |
| 11 | #if __has_extension(attribute_overloadable) |
| 12 | int attribute_overloadable(); |
| 13 | #endif |
| 14 | |
| 15 | // CHECK-PED-NONE: has_c_static_assert |
| 16 | // CHECK-PED-ERR: no_c_static_assert |
| 17 | #if __has_extension(c_static_assert) |
| 18 | int has_c_static_assert(); |
| 19 | #else |
| 20 | int no_c_static_assert(); |
| 21 | #endif |
| 22 | |
| 23 | // CHECK-PED-NONE: has_c_generic_selections |
| 24 | // CHECK-PED-ERR: no_c_generic_selections |
| 25 | #if __has_extension(c_generic_selections) |
| 26 | int has_c_generic_selections(); |
| 27 | #else |
| 28 | int no_c_generic_selections(); |
| 29 | #endif |
| 30 | |
Peter Collingbourne | fd5f686 | 2011-10-14 23:44:46 +0000 | [diff] [blame] | 31 | // CHECK-PED-NONE: has_c_alignas |
| 32 | // CHECK-PED-ERR: no_c_alignas |
| 33 | #if __has_extension(c_alignas) |
| 34 | int has_c_alignas(); |
| 35 | #else |
| 36 | int no_c_alignas(); |
| 37 | #endif |
| 38 | |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame] | 39 | // CHECK-PED-NONE: has_c_alignof |
| 40 | // CHECK-PED-ERR: no_c_alignof |
| 41 | #if __has_extension(c_alignof) |
| 42 | int has_c_alignof(); |
| 43 | #else |
| 44 | int no_c_alignof(); |
| 45 | #endif |
| 46 | |
Richard Smith | 5297d71 | 2012-02-25 10:41:10 +0000 | [diff] [blame] | 47 | // Arbitrary feature to test that the extension name can be surrounded with |
| 48 | // double underscores. |
| 49 | // CHECK-PED-NONE: has_double_underscores |
| 50 | #if __has_extension(__c_alignas__) |
| 51 | int has_double_underscores(); |
| 52 | #endif |