45 lines · c
1// RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_CBOOL \2// RUN: | FileCheck %s --check-prefixes=BOOL-AS-CBOOL,CBOOL3//4// RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_CBOOL -DDIAG \5// RUN: | FileCheck %s --check-prefixes=BOOL-AS-CBOOL,CBOOL6//7// RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_INT \8// RUN: | FileCheck %s --check-prefixes=BOOL-AS-INT,CBOOL9//10// RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_INT -DDIAG \11// RUN: | FileCheck %s --check-prefixes=BOOL-AS-INT,CBOOL12//13// RUN: %clang_cc1 -verify -ast-print %s -xc++ \14// RUN: | FileCheck %s --check-prefixes=BOOL-AS-BOOL15//16// RUN: %clang_cc1 -verify -ast-print %s -xc++ -DDIAG \17// RUN: | FileCheck %s --check-prefixes=BOOL-AS-BOOL18 19#if DEF_BOOL_CBOOL20# define bool _Bool21#elif DEF_BOOL_INT22# define bool int23#endif24 25// BOOL-AS-CBOOL: _Bool i;26// BOOL-AS-INT: int i;27// BOOL-AS-BOOL: bool i;28bool i;29 30#ifndef __cplusplus31// CBOOL: _Bool j;32_Bool j;33#endif34 35// Induce a diagnostic (and verify we actually managed to do so), which used to36// permanently alter the -ast-print printing policy for _Bool. How bool is37// defined by the preprocessor is examined only once per compilation, when the38// diagnostic is emitted, and it used to affect the entirety of -ast-print, so39// test only one definition of bool per compilation.40#if DIAG41void fn(void) { 1; } // expected-warning {{expression result unused}}42#else43// expected-no-diagnostics44#endif45