summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/tests/input/c/my_infile.c
blob: 8b8cd113def7b43f9d0c387eb99c409aec5d41d5 (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#include <stdlib.h> /* exit */
#include <unistd.h> /* _exit */

int foo(int);

extern int baz;

int foo(int bar)
{
/* Switch blocks: */
 switch( c ) {
     case 1:
  case 2:
      bar+=2;
            break;
            
       case 3:
           bar++;
            baz++;
           case 4:
     break;
            default:
               break;
        }
    
  switch (bar) {
      case 0:
    bar++;
     break;
   case 1:
           bar++;
       return bar;
     case 2:
    bar++;
       goto x;
       case 3:
        bar++;
       /*FALLTHROUGH*/
       case 4:
           bar++;
       exit(bar);
       /*NOTREACHED*/
       case 5:
           bar++;
       _exit(bar);
       /*NOTREACHED*/
       case 6:
           bar++;
           if (baz > 2)
               break;       /* inside if statement; don't align with case */
           else
               return baz;  /* inside if statement; don't align with case */
       /*NOTREACHED*/
       case 7:
         switch (baz) {
  case 0: /* do nothing */
      break;
      case 1:
        return baz;
       case 2:
           baz--;
       goto x;
     case 3:
         exit(baz);
       /*NOTREACHED*/
          case 4:
         _exit(baz);
         /*NOTREACHED*/
         case 5:
           baz--;
        /*FALLTHROUGH*/
      default:
          for (; baz > 0; baz--)
          if (baz == bar)
              break;  /* break out of for loop, unrelated to switch statement */
                 else
                         bar++;
            break;
         }
        break;
      default:
          bar++;
     break;
   }
   
   
switch (a)
{
    case 0:
      // code
            break;
}   


switch ( a ) {
    case 0:
      if ( k > 0 )
        break;
      z = 1;
 break;
 case 1:
  if ( k < 0 )
   break;
  z = 2;
 case 2:
   z = 3;
  break;
}

   
   return bar;
}


int foo2(int op)
 {
  switch (op)
    {
      case 1:
       do_something();
     break;
      case 2:
       do_something_else();
     case 3:
        do_something_different();
         do_something_more();
       break;
    }
      return -1;
  }
   
int foo3(int op)
  {
    for(int nnn = op; nnn <= 100; nnn++)
    {
     switch (nnn)
   {
     case 1:
      do_something();
        break;
  case 2:
           do_something_else();
       case 3:
          if (do_something_different())
       {
           do_this();
            break;
          }
        do_something_more();
      break;
      
      default:
          ; // nothing
          break;
      
    }
    }
      return -1;
  }