1 /* $NetBSD: msg_333.c,v 1.5 2022/06/17 18:54:53 rillig Exp $ */ 2 # 3 "msg_333.c" 3 4 // Test for message: controlling expression must be bool, not '%s' [333] 5 // 6 // See d_c99_bool_strict.c for many more examples. 7 8 /* lint1-extra-flags: -T */ 9 10 typedef _Bool bool; 11 12 const char * 13 example(bool b, int i, const char *p) 14 { 15 16 if (b) 17 return "bool"; 18 19 /* expect+1: error: controlling expression must be bool, not 'int' [333] */ 20 if (i) 21 return "int"; 22 23 /* expect+1: error: controlling expression must be bool, not 'pointer' [333] */ 24 if (p) 25 return "pointer"; 26 27 if (__lint_false) { 28 /* expect+1: warning: statement not reached [193] */ 29 return "bool constant"; 30 } 31 32 /* expect+1: error: controlling expression must be bool, not 'int' [333] */ 33 if (0) { 34 /* expect+1: warning: statement not reached [193] */ 35 return "integer constant"; 36 } 37 38 return p + i; 39 } 40