1 // RUN: %clang_cc1 -fsyntax-only -Wuninitialized -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
3
test_bool_no_false()4 _Bool test_bool_no_false() {
5 _Bool var; // expected-note {{initialize}}
6 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:12-[[@LINE-1]]:12}:" = 0"
7 return var; // expected-warning {{uninitialized}}
8 }
9
10 #define bool _Bool
11 #define false (bool)0
12 #define true (bool)1
test_bool_with_false()13 bool test_bool_with_false() {
14 bool var; // expected-note {{initialize}}
15 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:11}:" = false"
16 return var; // expected-warning {{uninitialized}}
17 }
18
test_bool_with_false_undefined()19 bool test_bool_with_false_undefined() {
20 bool
21 #undef false
22 var; // expected-note {{initialize}}
23 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:10}:" = 0"
24 return var; // expected-warning {{uninitialized}}
25 }
26