From: Joe Buck <jbuck@Synopsys.COM>
To: carlo@runaway.xs4all.nl (Carlo Wood)
Cc: egcs@cygnus.com
Subject: Re: Annoying warning
Date: Fri, 30 Apr 1999 23:15:00 -0000 [thread overview]
Message-ID: <199904112009.NAA15005@atrus.synopsys.com> (raw)
Message-ID: <19990430231500.H98t09wjX6sOYkufNfT4fVB9AjfREp1MecHYK-xQNXo@z> (raw)
In-Reply-To: <199904110036.CAA09133@jolan.ppro>
> This code snippet, from the STL:
>
> inline int __black_count(__rb_tree_node_base* node, __rb_tree_node_base* root)
> {
[ a recursive function ]
> }
>
> causes this warning when compiled with -g -O3 :
>
> /usr/local/egcs/include/g++/stl_tree.h:1045: warning: can't inline call to `int __black_count(struct __rb_tree_node_base *, struct __rb_tree_node_base *)'
> /usr/local/egcs/include/g++/stl_tree.h:1053: warning: called from here
>
> Shouldn't this warning be suppressed for a recursive call?
No, the whole point of the warning is to report when an inline operation
can't be performed.
It would be better to either remove the 'inline' or to rewrite the
function into a form that can be inlined (tail recursion):
inline int __black_count(__rb_tree_node_base* node, __rb_tree_node_base* root,
int black_parent)
{
if (node == 0)
return black_parent;
else {
int bc = (node->color == __rb_tree_black);
if (node == root)
return bc + black_parent;
else
return __black_count(node->parent, root, bc);
}
}
inline int __black_count(__rb_tree_node_base* node, __rb_tree_node_base* root)
{
return __black_count(node, root, 0);
}
next prev parent reply other threads:[~1999-04-30 23:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-11 7:29 Carlo Wood
1999-04-11 13:10 ` Joe Buck [this message]
1999-04-12 8:28 ` Carlo Wood
1999-04-30 23:15 ` Carlo Wood
1999-04-30 23:15 ` Joe Buck
1999-04-30 23:15 ` Carlo Wood
1999-04-11 16:02 Edwards, Phil
1999-04-11 18:21 ` Joe Buck
1999-04-30 23:15 ` Joe Buck
1999-04-30 23:15 ` Edwards, Phil
1999-04-12 8:42 Edwards, Phil
1999-04-30 23:15 ` Edwards, Phil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199904112009.NAA15005@atrus.synopsys.com \
--to=jbuck@synopsys.com \
--cc=carlo@runaway.xs4all.nl \
--cc=egcs@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).