msg_161.c revision 1.3
1/* $NetBSD: msg_161.c,v 1.3 2021/01/31 12:30:53 rillig Exp $ */ 2# 3 "msg_161.c" 3 4// Test for message: constant in conditional context [161] 5 6/* lint1-extra-flags: -h */ 7 8void 9while_1(void) 10{ 11 while (1) /* expect: 161 */ 12 continue; 13} 14 15void 16while_0(void) 17{ 18 while (0) /* expect: 161 */ 19 continue; 20} 21 22/* 23 * The pattern 'do { } while (0)' is a common technique to define a 24 * preprocessor macro that behaves like a single statement. There is 25 * nothing unusual or surprising about the constant condition. 26 * Still, lint warns about it. FIXME don't. 27 */ 28void 29do_while_0(void) 30{ 31 do { 32 33 } while (0); /* expect: 161 */ 34} 35 36void 37do_while_1(void) 38{ 39 do { 40 41 } while (1); /* expect: 161 */ 42} 43