msg_207.c revision 1.6
1/* $NetBSD: msg_207.c,v 1.6 2025/07/07 19:57:17 rillig Exp $ */ 2# 3 "msg_207.c" 3 4// Test for message: loop not entered at top [207] 5// This message is not used. 6// Its purpose is unclear, and the number of false positives is too high. 7 8static void 9/* expect+1: warning: static function 'for_loop' unused [236] */ 10for_loop(void) 11{ 12 for (int i = 0; i < 10; i++) 13 if (0 == 1) 14 for (i = 0; 15 i < 5; 16 /* was+2: warning: loop not entered at top [207] */ 17 /* expect+1: warning: end-of-loop code not reached [223] */ 18 i += 4) 19 return; 20 21 // XXX: Why is this different from the snippet above? 22 for (int i = 0; i < 10; i++) 23 if (0 == 1) 24 /* expect+1: warning: 'init' statement not reached [193] */ 25 for (int j = 0; 26 j < 5; 27 /* expect+1: warning: end-of-loop code not reached [223] */ 28 j += 4) 29 return; 30} 31 32static void 33/* expect+1: warning: static function 'while_loop' unused [236] */ 34while_loop(void) 35{ 36 for (int i = 0; i < 10; i++) 37 if (0 == 1) 38 /* was+1: warning: loop not entered at top [207] */ 39 while (i < 5) 40 i += 4; 41} 42 43static void 44/* expect+1: warning: static function 'do_loop' unused [236] */ 45do_loop(void) 46{ 47 for (int i = 0; i < 10; i++) 48 if (0 == 1) 49 /* was+1: warning: loop not entered at top [207] */ 50 do { 51 i += 4; 52 } while (i < 5); 53} 54