This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH for c++/10929 (bogus -Winline warnings)
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 17 Jun 2003 18:53:45 -0400
- Subject: PATCH for c++/10929 (bogus -Winline warnings)
We were automatically setting DECL_INLINE for an undefined function at -O3
and then complaining that we couldn't inline it. Duh.
Tested athlon-pc-linux-gnu, applied to trunk. Test in
g++.dg/warn/Winline-2.C.
2003-06-17 Jason Merrill <jason@redhat.com>
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.
*** tree-inline.c.~1~ 2003-06-17 13:00:02.000000000 -0400
--- tree-inline.c 2003-06-17 12:52:58.000000000 -0400
*************** expand_call_inline (tp, walk_subtrees, d
*** 999,1005 ****
|| !cgraph_global_info (fn)->inline_once)
&& !inlinable_function_p (fn, id, 0))
{
! if (warn_inline && DECL_INLINE (fn))
{
warning_with_decl (fn, "inlining failed in call to `%s'");
warning ("called from here");
--- 999,1005 ----
|| !cgraph_global_info (fn)->inline_once)
&& !inlinable_function_p (fn, id, 0))
{
! if (warn_inline && DECL_INLINE (fn) && !DID_INLINE_FUNC (fn))
{
warning_with_decl (fn, "inlining failed in call to `%s'");
warning ("called from here");
*** cp/decl.c.~1~ 2003-06-17 13:00:03.000000000 -0400
--- cp/decl.c 2003-06-17 12:53:37.000000000 -0400
*************** grokfndecl (tree ctype,
*** 8889,8895 ****
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))
{
DID_INLINE_FUNC (decl) = 1;
DECL_INLINE (decl) = 1;
--- 8889,8895 ----
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) && funcdef_flag)
{
DID_INLINE_FUNC (decl) = 1;
DECL_INLINE (decl) = 1;