File: break.c

package info (click to toggle)
splint 1%3A3.1.2%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 21,004 kB
  • sloc: ansic: 150,869; yacc: 3,465; sh: 3,034; makefile: 2,157; lex: 412
file content (48 lines) | stat: -rw-r--r-- 730 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
void f (int x)
{
  while (x < 3) /* 3 [5]. Suspected infinite loop: no condition values modified */
    {
      switch (x)
	{
	case 1:
	  /*@switchbreak@*/ 
	  break;
	case 2:
	  /*@loopbreak@*/ /* 1. Break preceded by loopbreak is breaking a switch */
	  break; 
	case 3:
	  break; /* 2. Break statement in switch inside loop */
	}
      
      while (x > 2) /* 2 [4]. Suspected infinite loop: no condition values modified */
	{
	  if (3 > 4)
	    {
	      break; /* 3. Break statement in nested loop */
	    }
	  else
	    {
	      /*@innerbreak@*/ 
	      break;
	    }
	}
    }

  while (x < 2)
    {
      x++;
      /*@innerbreak@*/ break; /* 4 [6]. Break preceded by innerbreak is not in a deep loop */
    }
}