msg_207.c revision 1.6
11.6Srillig/*	$NetBSD: msg_207.c,v 1.6 2025/07/07 19:57:17 rillig Exp $	*/
21.1Srillig# 3 "msg_207.c"
31.1Srillig
41.1Srillig// Test for message: loop not entered at top [207]
51.6Srillig// This message is not used.
61.6Srillig// Its purpose is unclear, and the number of false positives is too high.
71.1Srillig
81.4Srilligstatic void
91.4Srillig/* expect+1: warning: static function 'for_loop' unused [236] */
101.4Srilligfor_loop(void)
111.4Srillig{
121.4Srillig	for (int i = 0; i < 10; i++)
131.4Srillig		if (0 == 1)
141.4Srillig			for (i = 0;
151.4Srillig			    i < 5;
161.6Srillig				/* was+2: warning: loop not entered at top [207] */
171.4Srillig				/* expect+1: warning: end-of-loop code not reached [223] */
181.4Srillig			    i += 4)
191.4Srillig				return;
201.4Srillig
211.4Srillig	// XXX: Why is this different from the snippet above?
221.4Srillig	for (int i = 0; i < 10; i++)
231.4Srillig		if (0 == 1)
241.5Srillig			/* expect+1: warning: 'init' statement not reached [193] */
251.4Srillig			for (int j = 0;
261.4Srillig			    j < 5;
271.4Srillig			    /* expect+1: warning: end-of-loop code not reached [223] */
281.4Srillig			    j += 4)
291.4Srillig				return;
301.4Srillig}
311.4Srillig
321.4Srilligstatic void
331.4Srillig/* expect+1: warning: static function 'while_loop' unused [236] */
341.4Srilligwhile_loop(void)
351.4Srillig{
361.4Srillig	for (int i = 0; i < 10; i++)
371.4Srillig		if (0 == 1)
381.6Srillig			/* was+1: warning: loop not entered at top [207] */
391.4Srillig			while (i < 5)
401.4Srillig				i += 4;
411.4Srillig}
421.4Srillig
431.4Srilligstatic void
441.4Srillig/* expect+1: warning: static function 'do_loop' unused [236] */
451.4Srilligdo_loop(void)
461.4Srillig{
471.4Srillig	for (int i = 0; i < 10; i++)
481.4Srillig		if (0 == 1)
491.6Srillig			/* was+1: warning: loop not entered at top [207] */
501.4Srillig			do {
511.4Srillig				i += 4;
521.4Srillig			} while (i < 5);
531.4Srillig}
54