aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-18 18:42:55 +0000
committerChris Lattner <sabre@nondot.org>2009-04-18 18:42:55 +0000
commit5ce71c99cf00f24f876548d7f0dd0eefac47b168 (patch)
treec25d5871f04e068227ae8d1dac5d4f02c33ee67a
parent6a22a9f16ec889bfbe11cd5b410f2865ef157122 (diff)
improve wording of scope violation error messages.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69456 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td8
-rw-r--r--test/Sema/scope-check.c21
-rw-r--r--test/SemaObjC/scope-check.m2
3 files changed, 10 insertions, 21 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index ef7117afc7..bf2ff2dd45 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -833,13 +833,13 @@ def err_undeclared_label_use : Error<"use of undeclared label '%0'">;
def err_goto_into_protected_scope : Error<"illegal goto into protected scope">;
def note_protected_by_vla_typedef : Note<
- "scope created by VLA typedef">;
+ "jump bypasses initialization of VLA typedef">;
def note_protected_by_vla : Note<
- "scope created by variable length array">;
+ "jump bypasses initialization of variable length array">;
def note_protected_by_cleanup : Note<
- "scope created by declaration with __attribute__((cleanup))">;
+ "jump bypasses initialization of declaration with __attribute__((cleanup))">;
def note_protected_by_objc_try : Note<
- "scope created by @try block">;
+ "jump bypasses initialization of @try block">;
def err_func_returning_array_function : Error<
"function cannot return array or function type %0">;
diff --git a/test/Sema/scope-check.c b/test/Sema/scope-check.c
index 21908fc285..4c3480ea27 100644
--- a/test/Sema/scope-check.c
+++ b/test/Sema/scope-check.c
@@ -1,27 +1,16 @@
// RUN: clang-cc -fsyntax-only -verify %s
-/*
-"/tmp/bug.c", line 2: error: transfer of control bypasses initialization of:
- variable length array "a" (declared at line 3)
- variable length array "b" (declared at line 3)
- goto L;
- ^
-"/tmp/bug.c", line 3: warning: variable "b" was declared but never referenced
- int a[x], b[x];
- ^
-*/
-
int test1(int x) {
goto L; // expected-error{{illegal goto into protected scope}}
- int a[x]; // expected-note {{scope created by variable length array}}
- int b[x]; // expected-note {{scope created by variable length array}}
+ 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:
return sizeof a;
}
int test2(int x) {
goto L; // expected-error{{illegal goto into protected scope}}
- typedef int a[x]; // expected-note {{scope created by VLA typedef}}
+ typedef int a[x]; // expected-note {{jump bypasses initialization of VLA typedef}}
L:
return sizeof(a);
}
@@ -30,14 +19,14 @@ void test3clean(int*);
int test3() {
goto L; // expected-error{{illegal goto into protected scope}}
-int a __attribute((cleanup(test3clean))); // expected-note {{scope created by declaration with __attribute__((cleanup))}}
+int a __attribute((cleanup(test3clean))); // expected-note {{jump bypasses initialization of declaration with __attribute__((cleanup))}}
L:
return a;
}
int test4(int x) {
goto L; // expected-error{{illegal goto into protected scope}}
-int a[x]; // expected-note {{scope created by variable length array}}
+int a[x]; // expected-note {{jump bypasses initialization of variable length array}}
test4(x);
L:
return sizeof a;
diff --git a/test/SemaObjC/scope-check.m b/test/SemaObjC/scope-check.m
index fbec254382..7a28ebbed3 100644
--- a/test/SemaObjC/scope-check.m
+++ b/test/SemaObjC/scope-check.m
@@ -6,7 +6,7 @@ void test1() {
goto L; // expected-error{{illegal goto into protected scope}}
goto L2; // expected-error{{illegal goto into protected scope}}
goto L3; // expected-error{{illegal goto into protected scope}}
- @try { // expected-note 3 {{scope created by @try block}}
+ @try { // expected-note 3 {{jump bypasses initialization of @try block}}
L: ;
} @catch (A *x) {
L2: ;