| 1 | // RUN: %clang_cc1 -std=c99 -E %s -o - | FileCheck --check-prefix=CHECK-NONE %s |
| 2 | |
| 3 | // RUN: %clang_cc1 -std=gnu89 -E %s -o - \ |
| 4 | // RUN: | FileCheck --check-prefix=CHECK-GNU-KEYWORDS %s |
| 5 | // RUN: %clang_cc1 -std=c99 -fgnu-keywords -E %s -o - \ |
| 6 | // RUN: | FileCheck --check-prefix=CHECK-GNU-KEYWORDS %s |
| 7 | // RUN: %clang_cc1 -std=gnu89 -fno-gnu-keywords -E %s -o - \ |
| 8 | // RUN: | FileCheck --check-prefix=CHECK-NONE %s |
| 9 | |
| 10 | // RUN: %clang_cc1 -std=c99 -fms-extensions -fms-compatibility -E %s -o - \ |
| 11 | // RUN: | FileCheck --check-prefix=CHECK-MS-KEYWORDS %s |
| 12 | // RUN: %clang_cc1 -std=c99 -fdeclspec -E %s -o - \ |
| 13 | // RUN: | FileCheck --check-prefix=CHECK-DECLSPEC-KEYWORD %s |
| 14 | // RUN: %clang_cc1 -std=c99 -fms-extensions -fno-declspec -E %s -o - \ |
| 15 | // RUN: | FileCheck --check-prefix=CHECK-MS-KEYWORDS-WITHOUT-DECLSPEC %s |
| 16 | |
| 17 | void f() { |
| 18 | // CHECK-NONE: int asm |
| 19 | // CHECK-GNU-KEYWORDS: asm ("ret" : :) |
| 20 | #if __is_identifier(asm) |
| 21 | int asm; |
| 22 | #else |
| 23 | asm ("ret" : :); |
| 24 | #endif |
| 25 | } |
| 26 | |
| 27 | // CHECK-NONE: no_ms_wchar |
| 28 | // CHECK-MS-KEYWORDS: has_ms_wchar |
| 29 | // CHECK-MS-KEYWORDS-WITHOUT-DECLSPEC: has_ms_wchar |
| 30 | #if __is_identifier(__wchar_t) |
| 31 | void no_ms_wchar(); |
| 32 | #else |
| 33 | void has_ms_wchar(); |
| 34 | #endif |
| 35 | |
| 36 | // CHECK-NONE: no_declspec |
| 37 | // CHECK-MS-KEYWORDS: has_declspec |
| 38 | // CHECK-MS-KEYWORDS-WITHOUT-DECLSPEC: no_declspec |
| 39 | // CHECK-DECLSPEC-KEYWORD: has_declspec |
| 40 | #if __is_identifier(__declspec) |
| 41 | void no_declspec(); |
| 42 | #else |
| 43 | void has_declspec(); |
| 44 | #endif |
| 45 | |
| 46 | // CHECK-NONE: no_static_assert |
| 47 | // CHECK-GNU-KEYWORDS: no_static_assert |
| 48 | // CHECK-MS-KEYWORDS: has_static_assert |
| 49 | // CHECK-MS-KEYWORDS-WITHOUT-DECLSPEC: no_static_assert |
| 50 | #if __is_identifier(static_assert) |
| 51 | void no_static_assert(); |
| 52 | #else |
| 53 | void has_static_assert(); |
| 54 | #endif |
| 55 | |