[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / AST / ast-print-bool.c
blob230e4d96cf8416614861a75a79c7d208cd607693
1 // RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_CBOOL \
2 // RUN: | FileCheck %s --check-prefixes=BOOL-AS-CBOOL,CBOOL
3 //
4 // RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_CBOOL -DDIAG \
5 // RUN: | FileCheck %s --check-prefixes=BOOL-AS-CBOOL,CBOOL
6 //
7 // RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_INT \
8 // RUN: | FileCheck %s --check-prefixes=BOOL-AS-INT,CBOOL
9 //
10 // RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_INT -DDIAG \
11 // RUN: | FileCheck %s --check-prefixes=BOOL-AS-INT,CBOOL
13 // RUN: %clang_cc1 -verify -ast-print %s -xc++ \
14 // RUN: | FileCheck %s --check-prefixes=BOOL-AS-BOOL
16 // RUN: %clang_cc1 -verify -ast-print %s -xc++ -DDIAG \
17 // RUN: | FileCheck %s --check-prefixes=BOOL-AS-BOOL
19 #if DEF_BOOL_CBOOL
20 # define bool _Bool
21 #elif DEF_BOOL_INT
22 # define bool int
23 #endif
25 // BOOL-AS-CBOOL: _Bool i;
26 // BOOL-AS-INT: int i;
27 // BOOL-AS-BOOL: bool i;
28 bool i;
30 #ifndef __cplusplus
31 // CBOOL: _Bool j;
32 _Bool j;
33 #endif
35 // Induce a diagnostic (and verify we actually managed to do so), which used to
36 // permanently alter the -ast-print printing policy for _Bool. How bool is
37 // defined by the preprocessor is examined only once per compilation, when the
38 // diagnostic is emitted, and it used to affect the entirety of -ast-print, so
39 // test only one definition of bool per compilation.
40 #if DIAG
41 void fn(void) { 1; } // expected-warning {{expression result unused}}
42 #else
43 // expected-no-diagnostics
44 #endif