summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-23 17:28:23 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-23 17:28:23 +0000
commite8f79093d0b9c14a499799f2ee0d8479931e8b43 (patch)
tree095a04c45332e7988144ca8f836909bdc09004b6
parent9c6db7b6ec66cdb6ee18e1957b420219e2b9dcab (diff)
downloadgcc-e8f79093d0b9c14a499799f2ee0d8479931e8b43.tar.gz
* c-decl.c (pushdecl): Invert sense of test for non-global types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34107 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/c-decl.c2
-rw-r--r--gcc/testsuite/gcc.dg/ext-glob.c18
3 files changed, 23 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4b1b63d5679..76023f87633 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2000-05-23 Zack Weinberg <zack@wolery.cumb.org>
+
+ * c-decl.c (pushdecl): Invert sense of test for non-global types.
+
Tue May 23 18:11:42 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
* reload1.c (reload_cse_move2add): Honor TRULY_NOOP_TRUNCATION.
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index d1393d4ba95..20c60895c18 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -2202,7 +2202,7 @@ pushdecl (x)
{
if (type == error_mark_node)
break;
- if (! TYPE_CONTEXT (type))
+ if (TYPE_CONTEXT (type))
{
warning_with_decl (x, "type of external `%s' is not global");
/* By exiting the loop early, we leave TYPE nonzero,
diff --git a/gcc/testsuite/gcc.dg/ext-glob.c b/gcc/testsuite/gcc.dg/ext-glob.c
new file mode 100644
index 00000000000..cc772f574a3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ext-glob.c
@@ -0,0 +1,18 @@
+/* Test for the warning about external functions with non-global
+ types. In -traditional mode, these functions are globally visible
+ even if declared in an inner scope, so their return types should
+ also be visible. */
+
+/* { dg-do compile } */
+/* { dg-options -traditional } */
+
+int
+main ()
+{
+ struct foo { int a, b; };
+
+ extern struct foo *bar(); /* { dg-warning "type of external" "good warn" } */
+ extern int baz(); /* { dg-bogus "type of external" "bad warn" } */
+
+ return 0;
+}