This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/18071] [4.0/4.1/4.2/4.3 Regression] -Winline does not respect -fno-default-inline
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jan 2008 15:21:20 -0000
- Subject: [Bug middle-end/18071] [4.0/4.1/4.2/4.3 Regression] -Winline does not respect -fno-default-inline
- References: <bug-18071-4672@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #30 from rguenth at gcc dot gnu dot org 2008-01-15 15:21 -------
I suggest to tag the DECL with TREE_NO_WARNING if -fno-default-inline is set
and
check this.
On the trunk the functions are inlined anyway, because we inline small
functions by default (and the functions are pure anyway). Also trunk
tests
if (!flag_inline_small_functions && !DECL_DECLARED_INLINE_P (decl))
{
if (reason)
*reason = N_("function not inline candidate");
return false;
that is, it uses DECL_DECLARED_INLINE_P (!) which is not affected by
-fno-default-inline.
Better testcase:
volatile int x;
struct Foo {
int a(int r) { return r & x; }
virtual int b(int r) { return r & x; }
static int c(int r) { return r & x; }
};
int bar(int r) {
Foo f; int k = 0;
k |= f.a(r); k |= f.b(r); k |= f.a(r);
return k;
}
which will on the trunk warn with -fno-inline only.
With the proposed approach we'd improve this to
./cc1plus -quiet -Winline t.ii -O -fno-default-inline -fno-inline
t.ii: In constructor 'Foo::Foo()':
t.ii:2: warning: function 'Foo::Foo() throw ()' can never be inlined because it
is suppressed using -fno-inline
t.ii: In function 'int bar(int)':
t.ii:2: warning: inlining failed in call to 'Foo::Foo() throw ()': function not
inlinable
t.ii:9: warning: called from here
that is, the compiler-generated methods are still marked inline and are not
affected by -fno-default-inline.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org, hubicka at gcc dot gnu
| |dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18071