home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lclint.zip / lclint-2_3h-os2-bin.zip / test / break.c < prev    next >
Text File  |  1997-09-03  |  730b  |  49 lines

  1. void f (int x)
  2. {
  3.   while (x < 3) /* 3 [5]. Suspected infinite loop: no condition values modified */
  4.     {
  5.       switch (x)
  6.     {
  7.     case 1:
  8.       /*@switchbreak@*/ 
  9.       break;
  10.     case 2:
  11.       /*@loopbreak@*/ /* 1. Break preceded by loopbreak is breaking a switch */
  12.       break; 
  13.     case 3:
  14.       break; /* 2. Break statement in switch inside loop */
  15.     }
  16.       
  17.       while (x > 2) /* 2 [4]. Suspected infinite loop: no condition values modified */
  18.     {
  19.       if (3 > 4)
  20.         {
  21.           break; /* 3. Break statement in nested loop */
  22.         }
  23.       else
  24.         {
  25.           /*@innerbreak@*/ 
  26.           break;
  27.         }
  28.     }
  29.     }
  30.  
  31.   while (x < 2)
  32.     {
  33.       x++;
  34.       /*@innerbreak@*/ break; /* 4 [6]. Break preceded by innerbreak is not in a deep loop */
  35.     }
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.