From 6bc8a1261f5523c515ff7071ec6c188d99aa24ef Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 3 Oct 2014 20:14:48 +0000 Subject: [PATCH] re PR c/63453 (Bogus warning for gnu_inline functions) PR c/63453 * c-decl.c (pop_scope): Don't warn about "inline function declared but never defined" for functions marked with gnu_inline attribute. * gcc.dg/pr63453.c: New test. From-SVN: r215874 --- gcc/c/ChangeLog | 6 ++++++ gcc/c/c-decl.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr63453.c | 8 ++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr63453.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index cb69773247c..519aad0cff8 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2014-10-03 Marek Polacek + + PR c/63453 + * c-decl.c (pop_scope): Don't warn about "inline function declared + but never defined" for functions marked with gnu_inline attribute. + 2014-09-25 Jakub Jelinek PR c++/63249 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index b4995a67733..ce5a8deecb8 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -1177,7 +1177,8 @@ pop_scope (void) /* C99 6.7.4p6: "a function with external linkage... declared with an inline function specifier ... shall also be defined in the same translation unit." */ - if (!flag_gnu89_inline) + if (!flag_gnu89_inline + && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (p))) 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 4c4c6049018..b8611ff0793 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-10-03 Marek Polacek + + PR c/63453 + * gcc.dg/pr63453.c: New test. + 2014-10-03 Marc Glisse PR c++/54427 diff --git a/gcc/testsuite/gcc.dg/pr63453.c b/gcc/testsuite/gcc.dg/pr63453.c new file mode 100644 index 00000000000..e6337aa2f5c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr63453.c @@ -0,0 +1,8 @@ +/* PR c/63453 */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu11" } */ + +inline int fn1 (void); /* { dg-warning "declared but never defined" } */ +extern inline int fn2 (void); /* { dg-warning "declared but never defined" } */ +inline int __attribute__ ((gnu_inline)) fn3 (void); +extern inline int __attribute__ ((gnu_inline)) fn4 (void); -- 2.30.2