re PR c/63626 (Warning "inline function declared but never defined" output twice)
authorMarek Polacek <polacek@redhat.com>
Thu, 23 Oct 2014 16:46:44 +0000 (16:46 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 23 Oct 2014 16:46:44 +0000 (16:46 +0000)
PR c/63626
* c-decl.c (pop_scope): Don't print warning in external_scope.

* gcc.dg/pr63626.c: New test.

From-SVN: r216595

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

index 397bf285fedebd49b89610a84dcf9e0ece5125b3..9b6c1d58558296f55e80276fe054ab1a14f73be3 100644 (file)
@@ -1,3 +1,8 @@
+2014-10-23  Marek Polacek  <polacek@redhat.com>
+
+       PR c/63626
+       * c-decl.c (pop_scope): Don't print warning in external_scope.
+
 2014-10-19  Marek Polacek  <polacek@redhat.com>
 
        PR c/63567
index b18da483feaee69909d7ccf17e4dec89d929beae..7d1840e5b615bfdc7df34309b946de1e6b510b6b 100644 (file)
@@ -1182,7 +1182,8 @@ pop_scope (void)
                 with an inline function specifier ... shall also be defined
                 in the same translation unit."  */
              if (!flag_gnu89_inline
-                 && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (p)))
+                 && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (p))
+                 && scope != external_scope)
                pedwarn (input_location, 0,
                         "inline function %q+D declared but never defined", p);
              DECL_EXTERNAL (p) = 1;
index 701fadbd26e683a4b9aa367a5d560b889bb018ba..48ef70d78d66fa37af43f7e912915ce09b630756 100644 (file)
@@ -1,3 +1,8 @@
+2014-10-23  Marek Polacek  <polacek@redhat.com>
+
+       PR c/63626
+       * gcc.dg/pr63626.c: New test.
+
 2014-10-23  Marek Polacek  <polacek@redhat.com>
 
        * c-c++-common/ubsan/undefined-2.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr63626.c b/gcc/testsuite/gcc.dg/pr63626.c
new file mode 100644 (file)
index 0000000..1f03818
--- /dev/null
@@ -0,0 +1,8 @@
+/* PR c/63626 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Test that we don't output the warning twice.  */
+
+inline int foo (void); /* { dg-bogus "inline function.*inline function" } */
+/* { dg-warning "inline function .foo. declared but never defined" "" { target *-*-* } 7 } */