msg_161.c revision 1.2
1/* $NetBSD: msg_161.c,v 1.2 2021/01/31 12:29:16 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) 12 continue; 13} 14 15void 16while_0(void) 17{ 18 while (0) 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); 34} 35 36void 37do_while_1(void) 38{ 39 do { 40 41 } while (1); 42} 43