]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* c-decl.c (pushdecl): Invert sense of test for non-global types.
authorZack Weinberg <zack@wolery.cumb.org>
Tue, 23 May 2000 17:28:23 +0000 (17:28 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Tue, 23 May 2000 17:28:23 +0000 (17:28 +0000)
From-SVN: r34107

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/gcc.dg/ext-glob.c [new file with mode: 0644]

index 4b1b63d56796b65a2e6d83ad92260e1c9352af51..76023f87633091b4eb099cb02445d3e7ec521f90 100644 (file)
@@ -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.
index d1393d4ba9568776d16a07c1f3f721e41303f5d0..20c60895c1844b58bf7886211ba8ff135e19bf7f 100644 (file)
@@ -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 (file)
index 0000000..cc772f5
--- /dev/null
@@ -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;
+}