forked from OSchip/llvm-project
Reword switch/goto diagnostics "protected scope" diagnostics. Making up a term
"protected scope" is very unhelpful here and actively confuses users. Instead, simply state the nature of the problem in the diagnostic: we cannot jump from here to there. The notes explain nicely why not. llvm-svn: 217293
This commit is contained in:
parent
5e44ffdb3e
commit
091405d7e3
|
@ -4110,25 +4110,28 @@ def err_undeclared_label_use : Error<"use of undeclared label %0">;
|
|||
def warn_unused_label : Warning<"unused label %0">,
|
||||
InGroup<UnusedLabel>, DefaultIgnore;
|
||||
|
||||
def err_goto_into_protected_scope : Error<"goto into protected scope">;
|
||||
def ext_goto_into_protected_scope : ExtWarn<"goto into protected scope">,
|
||||
def err_goto_into_protected_scope : Error<
|
||||
"cannot jump from this goto statement to its label">;
|
||||
def ext_goto_into_protected_scope : ExtWarn<
|
||||
"jump from this goto statement to its label is a Microsoft extension">,
|
||||
InGroup<Microsoft>;
|
||||
def warn_cxx98_compat_goto_into_protected_scope : Warning<
|
||||
"goto would jump into protected scope in C++98">,
|
||||
"jump from this goto statement to its label is incompatible with C++98">,
|
||||
InGroup<CXX98Compat>, DefaultIgnore;
|
||||
def err_switch_into_protected_scope : Error<
|
||||
"switch case is in protected scope">;
|
||||
"cannot jump from switch statement to this case label">;
|
||||
def warn_cxx98_compat_switch_into_protected_scope : Warning<
|
||||
"switch case would be in a protected scope in C++98">,
|
||||
"jump from switch statement to this case label is incompatible with C++98">,
|
||||
InGroup<CXX98Compat>, DefaultIgnore;
|
||||
def err_indirect_goto_without_addrlabel : Error<
|
||||
"indirect goto in function with no address-of-label expressions">;
|
||||
def err_indirect_goto_in_protected_scope : Error<
|
||||
"indirect goto might cross protected scopes">;
|
||||
"cannot jump from this indirect goto statement to one of its possible targets">;
|
||||
def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
|
||||
"indirect goto might cross protected scopes in C++98">,
|
||||
InGroup<CXX98Compat>, DefaultIgnore;
|
||||
def note_indirect_goto_target : Note<"possible target of indirect goto">;
|
||||
"jump from this indirect goto statement to one of its possible targets "
|
||||
"is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
|
||||
def note_indirect_goto_target : Note<
|
||||
"possible target of indirect goto statement">;
|
||||
def note_protected_by_variable_init : Note<
|
||||
"jump bypasses variable initialization">;
|
||||
def note_protected_by_variable_nontriv_destructor : Note<
|
||||
|
|
|
@ -182,7 +182,7 @@ void test6(unsigned cond) {
|
|||
;
|
||||
id x; // expected-note {{jump bypasses initialization of retaining variable}}
|
||||
|
||||
case 1: // expected-error {{switch case is in protected scope}}
|
||||
case 1: // expected-error {{cannot jump}}
|
||||
x = 0;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace VariableLengthArrays {
|
|||
|
||||
void f() {
|
||||
int n = 42;
|
||||
goto foo; // expected-error {{goto into protected scope}}
|
||||
goto foo; // expected-error {{cannot jump}}
|
||||
using T = int[n]; // expected-note {{bypasses initialization of VLA type alias}}
|
||||
foo: ;
|
||||
}
|
||||
|
|
|
@ -1051,18 +1051,18 @@ namespace dr98 { // dr98: yes
|
|||
void test(int n) {
|
||||
switch (n) {
|
||||
try { // expected-note 2{{bypasses}}
|
||||
case 0: // expected-error {{protected}}
|
||||
case 0: // expected-error {{cannot jump}}
|
||||
x:
|
||||
throw n;
|
||||
} catch (...) { // expected-note 2{{bypasses}}
|
||||
case 1: // expected-error {{protected}}
|
||||
case 1: // expected-error {{cannot jump}}
|
||||
y:
|
||||
throw n;
|
||||
}
|
||||
case 2:
|
||||
goto x; // expected-error {{protected}}
|
||||
goto x; // expected-error {{cannot jump}}
|
||||
case 3:
|
||||
goto y; // expected-error {{protected}}
|
||||
goto y; // expected-error {{cannot jump}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -499,7 +499,7 @@ namespace dr246 { // dr246: yes
|
|||
throw 0;
|
||||
X: ;
|
||||
} catch (int) {
|
||||
goto X; // expected-error {{protected scope}}
|
||||
goto X; // expected-error {{cannot jump}}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -755,7 +755,7 @@ namespace dr467 { // dr467: yes
|
|||
return k;
|
||||
}
|
||||
int g() {
|
||||
goto later; // expected-error {{protected scope}}
|
||||
goto later; // expected-error {{cannot jump}}
|
||||
int k = stuff(); // expected-note {{bypasses variable initialization}}
|
||||
later:
|
||||
return k;
|
||||
|
|
|
@ -692,7 +692,7 @@ namespace dr568 { // dr568: yes c++11
|
|||
void jump() {
|
||||
goto x;
|
||||
#if __cplusplus < 201103L
|
||||
// expected-error@-2 {{protected scope}}
|
||||
// expected-error@-2 {{cannot jump}}
|
||||
// expected-note@+2 {{non-POD}}
|
||||
#endif
|
||||
trivial t;
|
||||
|
|
|
@ -30,11 +30,11 @@ struct Y {
|
|||
|
||||
void f();
|
||||
void test_Y() {
|
||||
goto end; // expected-error{{goto into protected scope}}
|
||||
goto end; // expected-error{{cannot jump from this goto statement to its label}}
|
||||
Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}}
|
||||
end:
|
||||
f();
|
||||
goto inner; // expected-error{{goto into protected scope}}
|
||||
goto inner; // expected-error{{cannot jump from this goto statement to its label}}
|
||||
{
|
||||
Y y2; // expected-note{{jump bypasses variable with a non-trivial destructor}}
|
||||
inner:
|
||||
|
|
|
@ -29,7 +29,7 @@ struct Y {
|
|||
};
|
||||
|
||||
void test_Y() {
|
||||
goto end; // expected-error{{goto into protected scope}}
|
||||
goto end; // expected-error{{cannot jump from this goto statement to its label}}
|
||||
Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}}
|
||||
end:
|
||||
return;
|
||||
|
@ -40,7 +40,7 @@ struct Z {
|
|||
};
|
||||
|
||||
void test_Z() {
|
||||
goto end; // expected-error{{goto into protected scope}}
|
||||
goto end; // expected-error{{cannot jump from this goto statement to its label}}
|
||||
Z z; // expected-note{{jump bypasses initialization of non-POD variable}}
|
||||
end:
|
||||
return;
|
||||
|
|
|
@ -190,7 +190,7 @@ void test18() {
|
|||
|
||||
// rdar://7072507
|
||||
int test19() {
|
||||
goto L0; // expected-error {{goto into protected scope}}
|
||||
goto L0; // expected-error {{cannot jump}}
|
||||
|
||||
__block int x; // expected-note {{jump bypasses setup of __block variable}}
|
||||
L0:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=gnu99 %s -Wno-unreachable-code
|
||||
|
||||
int test1(int x) {
|
||||
goto L; // expected-error{{goto into protected scope}}
|
||||
goto L; // expected-error{{cannot jump from this goto statement to its label}}
|
||||
int a[x]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
int b[x]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
L:
|
||||
|
@ -9,7 +9,7 @@ int test1(int x) {
|
|||
}
|
||||
|
||||
int test2(int x) {
|
||||
goto L; // expected-error{{goto into protected scope}}
|
||||
goto L; // expected-error{{cannot jump from this goto statement to its label}}
|
||||
typedef int a[x]; // expected-note {{jump bypasses initialization of VLA typedef}}
|
||||
L:
|
||||
return sizeof(a);
|
||||
|
@ -18,14 +18,14 @@ int test2(int x) {
|
|||
void test3clean(int*);
|
||||
|
||||
int test3() {
|
||||
goto L; // expected-error{{goto into protected scope}}
|
||||
goto L; // expected-error{{cannot jump from this goto statement to its label}}
|
||||
int a __attribute((cleanup(test3clean))); // expected-note {{jump bypasses initialization of variable with __attribute__((cleanup))}}
|
||||
L:
|
||||
return a;
|
||||
}
|
||||
|
||||
int test4(int x) {
|
||||
goto L; // expected-error{{goto into protected scope}}
|
||||
goto L; // expected-error{{cannot jump from this goto statement to its label}}
|
||||
int a[x]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
test4(x);
|
||||
L:
|
||||
|
@ -50,7 +50,7 @@ void test7(int x) {
|
|||
switch (x) {
|
||||
case 1: ;
|
||||
int a[x]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
case 2: // expected-error {{switch case is in protected scope}}
|
||||
case 2: // expected-error {{cannot jump from switch statement to this case label}}
|
||||
a[1] = 2;
|
||||
break;
|
||||
}
|
||||
|
@ -58,17 +58,17 @@ void test7(int x) {
|
|||
|
||||
int test8(int x) {
|
||||
// For statement.
|
||||
goto L2; // expected-error {{goto into protected scope}}
|
||||
goto L2; // expected-error {{cannot jump from this goto statement to its label}}
|
||||
for (int arr[x]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
; ++x)
|
||||
L2:;
|
||||
|
||||
// Statement expressions.
|
||||
goto L3; // expected-error {{goto into protected scope}}
|
||||
goto L3; // expected-error {{cannot jump from this goto statement to its label}}
|
||||
int Y = ({ int a[x]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
L3: 4; });
|
||||
|
||||
goto L4; // expected-error {{goto into protected scope}}
|
||||
goto L4; // expected-error {{cannot jump from this goto statement to its label}}
|
||||
{
|
||||
int A[x], // expected-note {{jump bypasses initialization of variable length array}}
|
||||
B[x]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
|
@ -91,7 +91,7 @@ int test8(int x) {
|
|||
int A[x], B = ({ if (x)
|
||||
goto L7;
|
||||
else
|
||||
goto L8; // expected-error {{goto into protected scope}}
|
||||
goto L8; // expected-error {{cannot jump from this goto statement to its label}}
|
||||
4; }),
|
||||
C[x]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
L8:; // bad
|
||||
|
@ -103,7 +103,7 @@ int test8(int x) {
|
|||
goto L9;
|
||||
else
|
||||
// FIXME:
|
||||
goto L10; // fixme-error {{goto into protected scope}}
|
||||
goto L10; // fixme-error {{cannot jump from this goto statement to its label}}
|
||||
4; })];
|
||||
L10:; // bad
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ int test8(int x) {
|
|||
}
|
||||
|
||||
// Statement expressions 2.
|
||||
goto L1; // expected-error {{goto into protected scope}}
|
||||
goto L1; // expected-error {{cannot jump from this goto statement to its label}}
|
||||
return x == ({
|
||||
int a[x]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
L1:
|
||||
|
@ -133,7 +133,7 @@ int test8(int x) {
|
|||
void test9(int n, void *P) {
|
||||
int Y;
|
||||
int Z = 4;
|
||||
goto *P; // expected-error {{indirect goto might cross protected scopes}}
|
||||
goto *P; // expected-error {{cannot jump from this indirect goto statement to one of its possible targets}}
|
||||
|
||||
L2: ;
|
||||
int a[n]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
|
@ -151,14 +151,14 @@ L4:
|
|||
}
|
||||
|
||||
void test10(int n, void *P) {
|
||||
goto L0; // expected-error {{goto into protected scope}}
|
||||
goto L0; // expected-error {{cannot jump from this goto statement to its label}}
|
||||
typedef int A[n]; // expected-note {{jump bypasses initialization of VLA typedef}}
|
||||
L0:
|
||||
|
||||
goto L1; // expected-error {{goto into protected scope}}
|
||||
goto L1; // expected-error {{cannot jump from this goto statement to its label}}
|
||||
A b, c[10]; // expected-note 2 {{jump bypasses initialization of variable length array}}
|
||||
L1:
|
||||
goto L2; // expected-error {{goto into protected scope}}
|
||||
goto L2; // expected-error {{cannot jump from this goto statement to its label}}
|
||||
A d[n]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
L2:
|
||||
return;
|
||||
|
@ -171,7 +171,7 @@ void test11(int n) {
|
|||
case 2:
|
||||
case 3:;
|
||||
int Arr[n]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
case 4: // expected-error {{switch case is in protected scope}}
|
||||
case 4: // expected-error {{cannot jump from switch statement to this case label}}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -185,7 +185,7 @@ void test12(int n) {
|
|||
L1:
|
||||
goto L2;
|
||||
L2:
|
||||
goto L3; // expected-error {{goto into protected scope}}
|
||||
goto L3; // expected-error {{cannot jump from this goto statement to its label}}
|
||||
int Arr[n]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
L3:
|
||||
goto L4;
|
||||
|
@ -220,7 +220,7 @@ int test14(int n) {
|
|||
void test15(int n, void *pc) {
|
||||
static const void *addrs[] = { &&L1, &&L2 };
|
||||
|
||||
goto *pc; // expected-error {{indirect goto might cross protected scope}}
|
||||
goto *pc; // expected-error {{cannot jump from this indirect goto statement to one of its possible targets}}
|
||||
|
||||
L1:
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace ms_protected_scope {
|
|||
|
||||
int jump_over_variable_init(bool b) {
|
||||
if (b)
|
||||
goto foo; // expected-warning {{goto into protected scope}}
|
||||
goto foo; // expected-warning {{jump from this goto statement to its label is a Microsoft extension}}
|
||||
C c; // expected-note {{jump bypasses variable initialization}}
|
||||
foo:
|
||||
return 1;
|
||||
|
@ -45,7 +45,7 @@ struct Y {
|
|||
};
|
||||
|
||||
void jump_over_var_with_dtor() {
|
||||
goto end; // expected-warning{{goto into protected scope}}
|
||||
goto end; // expected-warning{{jump from this goto statement to its label is a Microsoft extension}}
|
||||
Y y; // expected-note {{jump bypasses variable with a non-trivial destructor}}
|
||||
end:
|
||||
;
|
||||
|
@ -55,14 +55,14 @@ void jump_over_var_with_dtor() {
|
|||
switch (c) {
|
||||
case 0:
|
||||
int x = 56; // expected-note {{jump bypasses variable initialization}}
|
||||
case 1: // expected-error {{switch case is in protected scope}}
|
||||
case 1: // expected-error {{cannot jump}}
|
||||
x = 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void exception_jump() {
|
||||
goto l2; // expected-error {{goto into protected scope}}
|
||||
goto l2; // expected-error {{cannot jump}}
|
||||
try { // expected-note {{jump bypasses initialization of try block}}
|
||||
l2: ;
|
||||
} catch(int) {
|
||||
|
@ -71,7 +71,7 @@ void exception_jump() {
|
|||
|
||||
int jump_over_indirect_goto() {
|
||||
static void *ps[] = { &&a0 };
|
||||
goto *&&a0; // expected-warning {{goto into protected scope}}
|
||||
goto *&&a0; // expected-warning {{jump from this goto statement to its label is a Microsoft extension}}
|
||||
int a = 3; // expected-note {{jump bypasses variable initialization}}
|
||||
a0:
|
||||
return 0;
|
||||
|
|
|
@ -286,18 +286,18 @@ template<typename T> void EnumNNSFn() {
|
|||
template void EnumNNSFn<Enum>(); // expected-note {{in instantiation}}
|
||||
|
||||
void JumpDiagnostics(int n) {
|
||||
goto DirectJump; // expected-warning {{goto would jump into protected scope in C++98}}
|
||||
goto DirectJump; // expected-warning {{jump from this goto statement to its label is incompatible with C++98}}
|
||||
TrivialButNonPOD tnp1; // expected-note {{jump bypasses initialization of non-POD variable}}
|
||||
|
||||
DirectJump:
|
||||
void *Table[] = {&&DirectJump, &&Later};
|
||||
goto *Table[n]; // expected-warning {{indirect goto might cross protected scopes in C++98}}
|
||||
goto *Table[n]; // expected-warning {{jump from this indirect goto statement to one of its possible targets is incompatible with C++98}}
|
||||
|
||||
TrivialButNonPOD tnp2; // expected-note {{jump bypasses initialization of non-POD variable}}
|
||||
Later: // expected-note {{possible target of indirect goto}}
|
||||
Later: // expected-note {{possible target of indirect goto statement}}
|
||||
switch (n) {
|
||||
TrivialButNonPOD tnp3; // expected-note {{jump bypasses initialization of non-POD variable}}
|
||||
default: // expected-warning {{switch case would be in a protected scope in C++98}}
|
||||
default: // expected-warning {{jump from switch statement to this case label is incompatible with C++98}}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,37 +35,37 @@ void throws() {
|
|||
void jumps() {
|
||||
l1:
|
||||
goto l5;
|
||||
goto l4; // expected-error {{goto into protected scope}}
|
||||
goto l3; // expected-error {{goto into protected scope}}
|
||||
goto l2; // expected-error {{goto into protected scope}}
|
||||
goto l4; // expected-error {{cannot jump}}
|
||||
goto l3; // expected-error {{cannot jump}}
|
||||
goto l2; // expected-error {{cannot jump}}
|
||||
goto l1;
|
||||
try { // expected-note 4 {{jump bypasses initialization of try block}}
|
||||
l2:
|
||||
goto l5;
|
||||
goto l4; // expected-error {{goto into protected scope}}
|
||||
goto l3; // expected-error {{goto into protected scope}}
|
||||
goto l4; // expected-error {{cannot jump}}
|
||||
goto l3; // expected-error {{cannot jump}}
|
||||
goto l2;
|
||||
goto l1;
|
||||
} catch(int) { // expected-note 4 {{jump bypasses initialization of catch block}}
|
||||
l3:
|
||||
goto l5;
|
||||
goto l4; // expected-error {{goto into protected scope}}
|
||||
goto l4; // expected-error {{cannot jump}}
|
||||
goto l3;
|
||||
goto l2; // expected-error {{goto into protected scope}}
|
||||
goto l2; // expected-error {{cannot jump}}
|
||||
goto l1;
|
||||
} catch(...) { // expected-note 4 {{jump bypasses initialization of catch block}}
|
||||
l4:
|
||||
goto l5;
|
||||
goto l4;
|
||||
goto l3; // expected-error {{goto into protected scope}}
|
||||
goto l2; // expected-error {{goto into protected scope}}
|
||||
goto l3; // expected-error {{cannot jump}}
|
||||
goto l2; // expected-error {{cannot jump}}
|
||||
goto l1;
|
||||
}
|
||||
l5:
|
||||
goto l5;
|
||||
goto l4; // expected-error {{goto into protected scope}}
|
||||
goto l3; // expected-error {{goto into protected scope}}
|
||||
goto l2; // expected-error {{goto into protected scope}}
|
||||
goto l4; // expected-error {{cannot jump}}
|
||||
goto l3; // expected-error {{cannot jump}}
|
||||
goto l2; // expected-error {{cannot jump}}
|
||||
goto l1;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace PR10620 {
|
|||
~S() {}
|
||||
};
|
||||
void g(const S& s) {
|
||||
goto done; // expected-error {{goto into protected scope}}
|
||||
goto done; // expected-error {{cannot jump}}
|
||||
const S s2(s); // expected-note {{jump bypasses variable initialization}}
|
||||
done:
|
||||
;
|
||||
|
@ -119,7 +119,7 @@ namespace PR10620 {
|
|||
namespace test12 {
|
||||
struct A { A(); A(const A&); ~A(); };
|
||||
void test(A a) { // expected-note {{jump enters lifetime of block}} FIXME: weird location
|
||||
goto lbl; // expected-error {{goto into protected scope}}
|
||||
goto lbl; // expected-error {{cannot jump}}
|
||||
(void) ^{ (void) a; };
|
||||
lbl:
|
||||
return;
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace test1 {
|
|||
|
||||
int f(bool b) {
|
||||
if (b)
|
||||
goto foo; // expected-error {{goto into protected scope}}
|
||||
goto foo; // expected-error {{cannot jump}}
|
||||
C c; // expected-note {{jump bypasses variable initialization}}
|
||||
foo:
|
||||
return 1;
|
||||
|
@ -79,7 +79,7 @@ namespace test4 {
|
|||
|
||||
C c0;
|
||||
|
||||
goto *ip; // expected-error {{indirect goto might cross protected scopes}}
|
||||
goto *ip; // expected-error {{cannot jump}}
|
||||
C c1; // expected-note {{jump bypasses variable initialization}}
|
||||
lbl1: // expected-note {{possible target of indirect goto}}
|
||||
return 0;
|
||||
|
@ -103,7 +103,7 @@ namespace test5 {
|
|||
if (ip[1]) {
|
||||
D d; // expected-note {{jump exits scope of variable with non-trivial destructor}}
|
||||
ip += 2;
|
||||
goto *ip; // expected-error {{indirect goto might cross protected scopes}}
|
||||
goto *ip; // expected-error {{cannot jump}}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -153,13 +153,13 @@ namespace test8 {
|
|||
switch (c) {
|
||||
case 0:
|
||||
int x = 56; // expected-note {{jump bypasses variable initialization}}
|
||||
case 1: // expected-error {{switch case is in protected scope}}
|
||||
case 1: // expected-error {{cannot jump}}
|
||||
x = 10;
|
||||
}
|
||||
}
|
||||
|
||||
void test2() {
|
||||
goto l2; // expected-error {{goto into protected scope}}
|
||||
goto l2; // expected-error {{cannot jump}}
|
||||
l1: int x = 5; // expected-note {{jump bypasses variable initialization}}
|
||||
l2: x++;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ namespace PR10462 {
|
|||
namespace test10 {
|
||||
int test() {
|
||||
static void *ps[] = { &&a0 };
|
||||
goto *&&a0; // expected-error {{goto into protected scope}}
|
||||
goto *&&a0; // expected-error {{cannot jump}}
|
||||
int a = 3; // expected-note {{jump bypasses variable initialization}}
|
||||
a0:
|
||||
return 0;
|
||||
|
@ -225,7 +225,7 @@ namespace test11 {
|
|||
static void *ips[] = { &&l0 };
|
||||
l0: // expected-note {{possible target of indirect goto}}
|
||||
C c0 = 42; // expected-note {{jump exits scope of variable with non-trivial destructor}}
|
||||
goto *ip; // expected-error {{indirect goto might cross protected scopes}}
|
||||
goto *ip; // expected-error {{cannot jump}}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ namespace test12 {
|
|||
l0: // expected-note {{possible target of indirect goto}}
|
||||
const C &c1 = 42; // expected-note {{jump exits scope of lifetime-extended temporary with non-trivial destructor}}
|
||||
const C &c2 = c0;
|
||||
goto *ip; // expected-error {{indirect goto might cross protected scopes}}
|
||||
goto *ip; // expected-error {{cannot jump}}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ namespace test13 {
|
|||
static void *ips[] = { &&l0 };
|
||||
l0: // expected-note {{possible target of indirect goto}}
|
||||
const int &c1 = C(1).i; // expected-note {{jump exits scope of lifetime-extended temporary with non-trivial destructor}}
|
||||
goto *ip; // expected-error {{indirect goto might cross protected scopes}}
|
||||
goto *ip; // expected-error {{cannot jump}}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,21 +276,21 @@ namespace test14 {
|
|||
// PR14225
|
||||
namespace test15 {
|
||||
void f1() try {
|
||||
goto x; // expected-error {{goto into protected scope}}
|
||||
goto x; // expected-error {{cannot jump}}
|
||||
} catch(...) { // expected-note {{jump bypasses initialization of catch block}}
|
||||
x: ;
|
||||
}
|
||||
void f2() try { // expected-note {{jump bypasses initialization of try block}}
|
||||
x: ;
|
||||
} catch(...) {
|
||||
goto x; // expected-error {{goto into protected scope}}
|
||||
goto x; // expected-error {{cannot jump}}
|
||||
}
|
||||
}
|
||||
|
||||
namespace test16 {
|
||||
struct S { int n; };
|
||||
int f() {
|
||||
goto x; // expected-error {{goto into protected scope}}
|
||||
goto x; // expected-error {{cannot jump}}
|
||||
const S &s = S(); // expected-note {{jump bypasses variable initialization}}
|
||||
x: return s.n;
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ x: return s.n;
|
|||
namespace test17 {
|
||||
struct S { int get(); private: int n; };
|
||||
int f() {
|
||||
goto x; // expected-error {{goto into protected scope}}
|
||||
goto x; // expected-error {{cannot jump}}
|
||||
S s = {}; // expected-note {{jump bypasses variable initialization}}
|
||||
x: return s.get();
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ namespace test18 {
|
|||
void *p = &&x;
|
||||
x: // expected-note {{possible target of indirect goto}}
|
||||
B b = { 0, A() }; // expected-note {{jump exits scope of lifetime-extended temporary with non-trivial destructor}}
|
||||
goto *p; // expected-error {{indirect goto might cross protected scopes}}
|
||||
goto *p; // expected-error {{cannot jump}}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ namespace test19 {
|
|||
A a;
|
||||
x: // expected-note {{possible target of indirect goto}}
|
||||
std::initializer_list<A> il = { a }; // expected-note {{jump exits scope of lifetime-extended temporary with non-trivial destructor}}
|
||||
goto *p; // expected-error {{indirect goto might cross protected scopes}}
|
||||
goto *p; // expected-error {{cannot jump}}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,14 +370,14 @@ namespace test20 {
|
|||
a,
|
||||
{ A() } // expected-note {{jump exits scope of lifetime-extended temporary with non-trivial destructor}}
|
||||
};
|
||||
goto *p; // expected-error {{indirect goto might cross protected scopes}}
|
||||
goto *p; // expected-error {{cannot jump}}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace test21 {
|
||||
template<typename T> void f() {
|
||||
goto x; // expected-error {{protected scope}}
|
||||
goto x; // expected-error {{cannot jump}}
|
||||
T t; // expected-note {{bypasses}}
|
||||
x: return;
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ namespace test_recovery {
|
|||
void test(nexist, int c) { // expected-error {{}}
|
||||
nexist_fn(); // expected-error {{}}
|
||||
goto nexist_label; // expected-error {{use of undeclared label}}
|
||||
goto a0; // expected-error {{goto into protected scope}}
|
||||
goto a0; // expected-error {{cannot jump}}
|
||||
int a = 0; // expected-note {{jump bypasses variable initialization}}
|
||||
a0:;
|
||||
|
||||
|
@ -436,7 +436,7 @@ namespace test_recovery {
|
|||
case $: // expected-error {{}}
|
||||
case 0:
|
||||
int x = 56; // expected-note {{jump bypasses variable initialization}}
|
||||
case 1: // expected-error {{switch case is in protected scope}}
|
||||
case 1: // expected-error {{cannot jump}}
|
||||
x = 10;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ struct X {
|
|||
};
|
||||
|
||||
void test2() {
|
||||
goto later; // expected-error {{goto into protected scope}}
|
||||
goto later; // expected-error {{cannot jump}}
|
||||
X x; // expected-note {{jump bypasses variable initialization}}
|
||||
later:
|
||||
;
|
||||
|
|
|
@ -21,15 +21,15 @@ extern __attribute__((visibility("default"))) struct dispatch_queue_s _dispatch_
|
|||
case 0:
|
||||
dispatch_async((&_dispatch_main_q), ^{ [self pageLeft]; }); // expected-note 3 {{jump enters lifetime of block which strongly captures a variable}}
|
||||
break;
|
||||
case 2: // expected-error {{switch case is in protected scope}}
|
||||
case 2: // expected-error {{cannot jump}}
|
||||
dispatch_async((&_dispatch_main_q), ^{ [self pageRight]; }); // expected-note 2 {{jump enters lifetime of block which strongly captures a variable}}
|
||||
break;
|
||||
case 3: // expected-error {{switch case is in protected scope}}
|
||||
case 3: // expected-error {{cannot jump}}
|
||||
{
|
||||
dispatch_async((&_dispatch_main_q), ^{ [self pageRight]; });
|
||||
break;
|
||||
}
|
||||
case 4: // expected-error {{switch case is in protected scope}}
|
||||
case 4: // expected-error {{cannot jump}}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ int test2(id obj, int state) { // expected-note {{jump enters lifetime of block}
|
|||
(void) ^{ (void) obj; };
|
||||
return 0;
|
||||
|
||||
default: // expected-error {{switch case is in protected scope}}
|
||||
default: // expected-error {{cannot jump}}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ void test6(unsigned cond) {
|
|||
;
|
||||
id x; // expected-note {{jump bypasses initialization of retaining variable}}
|
||||
|
||||
case 1: // expected-error {{switch case is in protected scope}}
|
||||
case 1: // expected-error {{cannot jump}}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ void autoreleasepool_pop(void*);
|
|||
|
||||
@implementation AUTORP
|
||||
- (void) unregisterTask:(id) task {
|
||||
goto L; // expected-error {{goto into protected scope}}
|
||||
goto L; // expected-error {{cannot jump}}
|
||||
|
||||
@autoreleasepool { // expected-note {{jump bypasses auto release push of @autoreleasepool block}}
|
||||
void *tmp = objc_autoreleasepool_push();
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
@class A, B, C;
|
||||
|
||||
void test1() {
|
||||
goto L; // expected-error{{goto into protected scope}}
|
||||
goto L2; // expected-error{{goto into protected scope}}
|
||||
goto L3; // expected-error{{goto into protected scope}}
|
||||
goto L; // expected-error{{cannot jump}}
|
||||
goto L2; // expected-error{{cannot jump}}
|
||||
goto L3; // expected-error{{cannot jump}}
|
||||
@try { // expected-note {{jump bypasses initialization of @try block}}
|
||||
L: ;
|
||||
} @catch (A *x) { // expected-note {{jump bypasses initialization of @catch block}}
|
||||
|
@ -17,11 +17,11 @@ L3: ;
|
|||
}
|
||||
|
||||
@try {
|
||||
goto L4; // expected-error{{goto into protected scope}}
|
||||
goto L5; // expected-error{{goto into protected scope}}
|
||||
goto L4; // expected-error{{cannot jump}}
|
||||
goto L5; // expected-error{{cannot jump}}
|
||||
} @catch (C *c) { // expected-note {{jump bypasses initialization of @catch block}}
|
||||
L5: ;
|
||||
goto L6; // expected-error{{goto into protected scope}}
|
||||
goto L6; // expected-error{{cannot jump}}
|
||||
} @catch (B *c) { // expected-note {{jump bypasses initialization of @catch block}}
|
||||
L6: ;
|
||||
} @finally { // expected-note {{jump bypasses initialization of @finally block}}
|
||||
|
@ -32,12 +32,12 @@ L3: ;
|
|||
@try { // expected-note 2 {{jump bypasses initialization of @try block}}
|
||||
L7: ;
|
||||
} @catch (C *c) {
|
||||
goto L7; // expected-error{{goto into protected scope}}
|
||||
goto L7; // expected-error{{cannot jump}}
|
||||
} @finally {
|
||||
goto L7; // expected-error{{goto into protected scope}}
|
||||
goto L7; // expected-error{{cannot jump}}
|
||||
}
|
||||
|
||||
goto L8; // expected-error{{goto into protected scope}}
|
||||
goto L8; // expected-error{{cannot jump}}
|
||||
@try {
|
||||
} @catch (A *c) {
|
||||
} @catch (B *c) {
|
||||
|
@ -47,7 +47,7 @@ L3: ;
|
|||
|
||||
// rdar://6810106
|
||||
id X;
|
||||
goto L9; // expected-error{{goto into protected scope}}
|
||||
goto L9; // expected-error{{cannot jump}}
|
||||
goto L10; // ok
|
||||
@synchronized // expected-note {{jump bypasses initialization of @synchronized block}}
|
||||
( ({ L10: ; X; })) {
|
||||
|
@ -79,7 +79,7 @@ void test3() {
|
|||
+ (void) hello {
|
||||
|
||||
@try {
|
||||
goto blargh; // expected-error {{goto into protected scope}}
|
||||
goto blargh; // expected-error {{cannot jump}}
|
||||
} @catch (...) { // expected-note {{jump bypasses initialization of @catch block}}
|
||||
blargh: ;
|
||||
}
|
||||
|
@ -87,14 +87,14 @@ void test3() {
|
|||
|
||||
+ (void)meth2 {
|
||||
int n; void *P;
|
||||
goto L0; // expected-error {{goto into protected scope}}
|
||||
goto L0; // expected-error {{cannot jump}}
|
||||
typedef int A[n]; // expected-note {{jump bypasses initialization of VLA typedef}}
|
||||
L0:
|
||||
|
||||
goto L1; // expected-error {{goto into protected scope}}
|
||||
goto L1; // expected-error {{cannot jump}}
|
||||
A b, c[10]; // expected-note 2 {{jump bypasses initialization of variable length array}}
|
||||
L1:
|
||||
goto L2; // expected-error {{goto into protected scope}}
|
||||
goto L2; // expected-error {{cannot jump}}
|
||||
A d[n]; // expected-note {{jump bypasses initialization of variable length array}}
|
||||
L2:
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue