msg_207.c revision 1.5
11.5Srillig/* $NetBSD: msg_207.c,v 1.5 2024/11/13 04:32:49 rillig Exp $ */ 21.1Srillig# 3 "msg_207.c" 31.1Srillig 41.1Srillig// Test for message: loop not entered at top [207] 51.1Srillig 61.4Srilligstatic void 71.4Srillig/* expect+1: warning: static function 'for_loop' unused [236] */ 81.4Srilligfor_loop(void) 91.4Srillig{ 101.4Srillig for (int i = 0; i < 10; i++) 111.4Srillig if (0 == 1) 121.4Srillig for (i = 0; 131.4Srillig i < 5; 141.4Srillig /* expect+2: warning: loop not entered at top [207] */ 151.4Srillig /* expect+1: warning: end-of-loop code not reached [223] */ 161.4Srillig i += 4) 171.4Srillig return; 181.4Srillig 191.4Srillig // XXX: Why is this different from the snippet above? 201.4Srillig for (int i = 0; i < 10; i++) 211.4Srillig if (0 == 1) 221.5Srillig /* expect+1: warning: 'init' statement not reached [193] */ 231.4Srillig for (int j = 0; 241.4Srillig j < 5; 251.4Srillig /* expect+1: warning: end-of-loop code not reached [223] */ 261.4Srillig j += 4) 271.4Srillig return; 281.4Srillig} 291.4Srillig 301.4Srilligstatic void 311.4Srillig/* expect+1: warning: static function 'while_loop' unused [236] */ 321.4Srilligwhile_loop(void) 331.4Srillig{ 341.4Srillig for (int i = 0; i < 10; i++) 351.4Srillig if (0 == 1) 361.4Srillig /* expect+1: warning: loop not entered at top [207] */ 371.4Srillig while (i < 5) 381.4Srillig i += 4; 391.4Srillig} 401.4Srillig 411.4Srilligstatic void 421.4Srillig/* expect+1: warning: static function 'do_loop' unused [236] */ 431.4Srilligdo_loop(void) 441.4Srillig{ 451.4Srillig for (int i = 0; i < 10; i++) 461.4Srillig if (0 == 1) 471.4Srillig /* expect+1: warning: loop not entered at top [207] */ 481.4Srillig do { 491.4Srillig i += 4; 501.4Srillig } while (i < 5); 511.4Srillig} 52