This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hello,
this simple patch fixes a wrong interaction between -Winline
and -fno-default-inline. In the C++ frontend, when -fno-default-inline is
used, the DECL for a member function defined within the class definition is
created with DECL_DECLARED_INLINE = 1 but DECL_INLINE = 0.
This causes a problem in tree-inline when -Winline is used, because
expand_call_inline thinks that a warning should be emitted for all the
functions marked with DECL_DECLARED_INLINE which did not get inlined. This
is wrong: what we actually want is to emit a warning for the functions
marked with DECL_INLINE, because those are the ones which are candidates for
inlining at any -O level.
After this fix, we hit a problem in the C frontend, c-decl.c, because
grokdeclarator has some logic to mark bare declarations with the inline
specifier (but without a corrisponding definition) as
DECL_DECLARED_INLINE=1, DECL_INLINE=0. The logic was added by RTH here:
http://gcc.gnu.org/ml/gcc-patches/2001-12/msg02393.html, to workaround a
problem in dwarf2out. It looks like this is no longer the case: when I
remove the code, I see no testsuite failures (and I verified that the
original testcases added with that patch are still in the testsuite).
Fully bootstrapped and regression tested on i686-pc-linux-gnu with no new
regressions. OK for mainline?
Giovanni Bajo
PR middle-end/18071
* tree-inline.c (expand_call_inline): Do not warn for functions that
frontends marked as not inlineable.
* c-decl.c (grokdeclarator): Mark even bare declarations with
DECL_INLINE.
testsuite/
PR middle-end/18071
* g++.dg/warn/Winline-5.C: New test.
Attachment:
patch-pr18071.txt
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |