From 9da32fe151688a1790f3de95a6fd396d22a626dd Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 17 Jun 2003 19:00:16 -0400 Subject: [PATCH] re PR c++/10929 (-Winline warns about functions for which no definition is visible) PR c++/10929 * tree-inline.c (expand_call_inline): Don't warn about failing to inline a function which was made inline by -finline-functions. * cp/decl.c (grokfndecl): Don't mark a function inline for -finline-functions if it isn't defined. From-SVN: r68122 --- gcc/ChangeLog | 6 ++++++ gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 2 +- gcc/testsuite/g++.dg/warn/Winline-2.C | 5 +++++ gcc/tree-inline.c | 2 +- 5 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/warn/Winline-2.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e57272e7c0d..48c7c7c5e2c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-06-17 Jason Merrill + + PR c++/10929 + * tree-inline.c (expand_call_inline): Don't warn about failing to + inline a function which was made inline by -finline-functions. + 2003-06-17 Kazu Hirata * config/h8300/h8300-protos.h: Update to ISO C. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7e8bbc7b1d6..8c333fe8b45 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-06-17 Jason Merrill + + PR c++/10929 + * decl.c (grokfndecl): Don't mark a function inline for + -finline-functions if it isn't defined. + 2003-06-17 Mark Mitchell PR c++/10712 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d76133a0f4a..4ec5c3176ce 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8883,7 +8883,7 @@ grokfndecl (tree ctype, the user explicitly asks us to, all functions. */ if (DECL_DECLARED_INLINE_P (decl)) DECL_INLINE (decl) = 1; - if (flag_inline_trees == 2 && !DECL_INLINE (decl)) + if (flag_inline_trees == 2 && !DECL_INLINE (decl) && funcdef_flag) { DID_INLINE_FUNC (decl) = 1; DECL_INLINE (decl) = 1; diff --git a/gcc/testsuite/g++.dg/warn/Winline-2.C b/gcc/testsuite/g++.dg/warn/Winline-2.C new file mode 100644 index 00000000000..69af3435119 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Winline-2.C @@ -0,0 +1,5 @@ +// PR c++/10929 +// { dg-options "-Winline -O3" } + +int foo (); +int bar () { return foo (); } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index dd50ca1d631..c0d36106cf1 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1201,7 +1201,7 @@ expand_call_inline (tp, walk_subtrees, data) || !cgraph_global_info (fn)->inline_once) && !inlinable_function_p (fn, id, 0)) { - if (warn_inline && DECL_INLINE (fn)) + if (warn_inline && DECL_INLINE (fn) && !DID_INLINE_FUNC (fn)) { warning_with_decl (fn, "inlining failed in call to `%s'"); warning ("called from here");