From 1bc5a4513e09efd42f22ccbc25ff8cd7ec5619f5 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 23 Oct 2014 16:46:44 +0000 Subject: [PATCH] re PR c/63626 (Warning "inline function declared but never defined" output twice) 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 | 5 +++++ gcc/c/c-decl.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr63626.c | 8 ++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr63626.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 397bf285fed..9b6c1d58558 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2014-10-23 Marek Polacek + + PR c/63626 + * c-decl.c (pop_scope): Don't print warning in external_scope. + 2014-10-19 Marek Polacek PR c/63567 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index b18da483fea..7d1840e5b61 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 701fadbd26e..48ef70d78d6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-10-23 Marek Polacek + + PR c/63626 + * gcc.dg/pr63626.c: New test. + 2014-10-23 Marek Polacek * 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 index 00000000000..1f0381822c1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr63626.c @@ -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 } */ -- 2.30.2