aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-04-07 11:54:17 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-04-07 11:54:17 -0400
commit2401726e18691dec7144312cb531aa9e11ca8240 (patch)
treeadbb2b4b58b8a741c4fb03168108e97c945cc3bf /gcc
parent2ea9dc6459761bae70146f8ea85436f70eca25eb (diff)
downloadgcc-2401726e18691dec7144312cb531aa9e11ca8240.zip
gcc-2401726e18691dec7144312cb531aa9e11ca8240.tar.gz
gcc-2401726e18691dec7144312cb531aa9e11ca8240.tar.bz2
re PR c++/41970 (use of a type with no linkage to declare a variable with linkage)
PR c++/41970 * decl.c (grokvardecl): Tweak warning message. (grokfndecl): Likewise. From-SVN: r158071
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c15
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/linkage1.C10
4 files changed, 25 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3d41244..a6e6f3a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/41970
+ * decl.c (grokvardecl): Tweak warning message.
+ (grokfndecl): Likewise.
+
2010-04-07 Dodji Seketeli <dodji@redhat.com>
PR c++/42697
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index a308d64..4ae924b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6821,8 +6821,9 @@ grokfndecl (tree ctype,
/* Allow this; it's pretty common in C. */;
else
{
- permerror (input_location, "non-local function %q#D uses anonymous type",
- decl);
+ permerror (input_location, "anonymous type with no linkage "
+ "used to declare function %q#D with linkage",
+ decl);
if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
permerror (input_location, "%q+#D does not refer to the unqualified "
"type, so it is not used for linkage",
@@ -6830,7 +6831,8 @@ grokfndecl (tree ctype,
}
}
else
- permerror (input_location, "non-local function %q#D uses local type %qT", decl, t);
+ permerror (input_location, "type %qT with no linkage used to "
+ "declare function %q#D with linkage", t, decl);
}
}
@@ -7104,8 +7106,8 @@ grokvardecl (tree type,
no linkage can only be used to declare extern "C"
entities. Since it's not always an error in the
ISO C++ 90 Standard, we only issue a warning. */
- warning (0, "non-local variable %q#D uses anonymous type",
- decl);
+ warning (0, "anonymous type with no linkage used to declare "
+ "variable %q#D with linkage", decl);
if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
warning (0, "%q+#D does not refer to the unqualified "
"type, so it is not used for linkage",
@@ -7113,7 +7115,8 @@ grokvardecl (tree type,
}
}
else
- warning (0, "non-local variable %q#D uses local type %qT", decl, t);
+ warning (0, "type %qT with no linkage used to declare variable "
+ "%q#D with linkage", t, decl);
}
}
else
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0032dd8..3138c8a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/41970
+ * g++.old-deja/g++.other/linkage1.C: Adjust.
+
2010-04-07 Dodji Seketeli <dodji@redhat.com>
PR c++/42697
diff --git a/gcc/testsuite/g++.old-deja/g++.other/linkage1.C b/gcc/testsuite/g++.old-deja/g++.other/linkage1.C
index e9b5a9d..556ef97 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/linkage1.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/linkage1.C
@@ -3,13 +3,13 @@ typedef struct {
int i;
} *p;
-void f (p) { } // { dg-error "uses anonymous type" }
-p q; // { dg-warning "uses anonymous type" }
+void f (p) { } // { dg-error "with no linkage" }
+p q; // { dg-warning "with no linkage" }
int main()
{
- extern p j; // { dg-warning "uses anonymous type" }
+ extern p j; // { dg-warning "with no linkage" }
struct A { int j; };
- extern A a; // { dg-warning "uses local type" }
- extern void f (A); // { dg-error "uses local type" }
+ extern A a; // { dg-warning "with no linkage" }
+ extern void f (A); // { dg-error "with no linkage" }
}