brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · 67a0eb5 Raw
170 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -x c++ -Werror %s3 4int pr8880_1(void) {5  int first = 1;6  for ( ; ({ if (first) { first = 0; continue; } 0; }); )7    return 0;8  return 1;9}10 11void pr8880_2(int first) {12  for ( ; ({ if (first) { first = 0; break; } 0; }); ) {}13}14 15void pr8880_3(int first) {16  for ( ; ; (void)({ if (first) { first = 0; continue; } 0; })) {}17}18 19void pr8880_4(int first) {20  for ( ; ; (void)({ if (first) { first = 0; break; } 0; })) {}21}22 23void pr8880_5 (int first) {24  while(({ if (first) { first = 0; continue; } 0; })) {}25}26 27void pr8880_6 (int first) {28  while(({ if (first) { first = 0; break; } 0; })) {}29}30 31void pr8880_7 (int first) {32  do {} while(({ if (first) { first = 0; continue; } 0; }));33}34 35void pr8880_8 (int first) {36  do {} while(({ if (first) { first = 0; break; } 0; }));37}38 39void pr8880_10(int i) {40  for ( ; i != 10 ; i++ )41    for ( ; ; (void)({ ++i; continue; i;})) {} // expected-warning{{'continue' is bound to current loop, GCC binds it to the enclosing loop}}42}43 44void pr8880_11(int i) {45  for ( ; i != 10 ; i++ )46    for ( ; ; (void)({ ++i; break; i;})) {} // expected-warning{{'break' is bound to current loop, GCC binds it to the enclosing loop}}47}48 49void pr8880_12(int i, int j) {50  for ( ; i != 10 ; i++ )51    for ( ; ({if (i) continue; i;}); j++) {} // expected-warning {{'continue' is bound to current loop, GCC binds it to the enclosing loop}}52}53 54void pr8880_13(int i, int j) {55  for ( ; i != 10 ; i++ )56    for ( ; ({if (i) break; i;}); j++) {} // expected-warning{{'break' is bound to current loop, GCC binds it to the enclosing loop}}57}58 59void pr8880_14(int i) {60  for ( ; i != 10 ; i++ )61    while(({if (i) break; i;})) {} // expected-warning {{'break' is bound to current loop, GCC binds it to the enclosing loop}}62}63 64void pr8880_15(int i) {65  while (--i)66    while(({if (i) continue; i;})) {} // expected-warning {{'continue' is bound to current loop, GCC binds it to the enclosing loop}}67}68 69void pr8880_16(int i) {70  for ( ; i != 10 ; i++ )71    do {} while(({if (i) break; i;})); // expected-warning {{'break' is bound to current loop, GCC binds it to the enclosing loop}}72}73 74void pr8880_17(int i) {75  for ( ; i != 10 ; i++ )76    do {} while(({if (i) continue; i;})); // expected-warning {{'continue' is bound to current loop, GCC binds it to the enclosing loop}}77}78 79void pr8880_18(int x, int y) {80  while(x > 0)81    switch(({if(y) break; y;})) {82    case 2: x = 0;83    }84}85 86void pr8880_19(int x, int y) {87  switch(x) {88  case 1:89    switch(({if(y) break; y;})) {90    case 2: x = 0;91    }92  }93}94 95void pr8880_20(int x, int y) {96  switch(x) {97  case 1:98    while(({if (y) break; y;})) {} //expected-warning {{'break' is bound to loop, GCC binds it to switch}}99  }100}101 102void pr8880_21(int x, int y) {103  switch(x) {104  case 1:105    do {} while(({if (y) break; y;})); //expected-warning {{'break' is bound to loop, GCC binds it to switch}}106  }107}108 109void pr8880_22(int x, int y) {110  switch(x) {111  case 1:112    for ( ; ; (void)({ ++y; break; y;})) {} // expected-warning{{'break' is bound to loop, GCC binds it to switc}}113  }114}115 116void pr8880_23(int x, int y) {117  switch(x) {118  case 1:119    for ( ; ({ ++y; break; y;}); ++y) {} // expected-warning{{'break' is bound to loop, GCC binds it to switch}}120  }121}122 123void pr32648_1(int x, int y) {124  switch(x) {125  case 1:126    for ( ; ({ ++y; switch (y) { case 0: break; } y;}); ++y) {} // no warning127  }128}129 130void pr32648_2(int x, int y) {131  while(x) {132    for ( ; ({ ++y; switch (y) { case 0: continue; } y;}); ++y) {}  // expected-warning {{'continue' is bound to current loop, GCC binds it to the enclosing loop}}133  }134}135 136void pr32648_3(int x, int y) {137  switch(x) {138  case 1:139    for ( ; ({ ++y; for (; y; y++) { break; } y;}); ++y) {} // no warning140  }141}142 143void pr32648_4(int x, int y) {144  switch(x) {145  case 1:146    for ( ; ({ ++y; for (({ break; }); y; y++) { } y;}); ++y) {} // expected-warning{{'break' is bound to loop, GCC binds it to switch}}147  }148}149 150void pr32648_5(int x, int y) {151  switch(x) {152  case 1:153    for ( ; ({ ++y; while (({ break; y; })) {} y;}); ++y) {} // expected-warning{{'break' is bound to current loop, GCC binds it to the enclosing loop}}154  }155}156 157void pr32648_6(int x, int y) {158  switch(x) {159  case 1:160    for ( ; ({ ++y; do {} while (({ break; y; })); y;}); ++y) {} // expected-warning{{'break' is bound to current loop, GCC binds it to the enclosing loop}}161  }162}163 164void pr32648_7(int x, int y) {165  switch(x) {166  case 1:167    for ( ; ({ ++y; do { break; } while (y); y;}); ++y) {} // no warning168  }169}170