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: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Dec 2007 10:46:12 -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 #29 from manu at gcc dot gnu dot org 2007-12-17 10:46 -------
(In reply to comment #28)
> Open regression with no activity since February 14. Ping?
>
The last thread about this was in:
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg00523.html
Summarising:
* C++ front-end sets DECL_DECLARED_INLINE_P for methods always. It sets
DECL_INLINE unless -fno-default-inline.
* -Winline warns when a function "declared inlined" is not inlined. Currently,
"declared inline" means DECL_DECLARED_INLINE_P is set.
* DECL_DECLARED_INLINE_P controls linkage.
* -fno-default-inline should not affect linkage.
Geoff Keating said:
"DECL_DECLARED_INLINE_P in the C++ front-end means 'this function is an "inline
function" as defined by the standard'. There are two ways to get a function to
be an inline function: (a) the 'inline' keyword, and (b) define the function
inside a class; the ways are equivalent from the language's perspective. See
[dcl.fct.spec] in the C++ standard, especially paragraphs 2 and 3.
The question here is whether -Winline should be limited to those inline
functions in case (a) or whether it can include those in case (b) too."
Therefore, if -Winline also include case (b) then the warning seems correct. A
function that was declared inline was not inlined. Alternatively, we could not
warn for -fno-default-inline but then we would have to detect that: 1)
-fno-default-inline was given, 2) this is a method, 3) it wasn't declared using
the 'inline' keyword.
On the other hand, if -Winline is limited to case (a), then we need a way to
distinguish between (a) and (b).
Therefore, either the warning is correct and this is not a bug, or we need a
way to distinguish between (a) and (b). At least, this is how I see. I wouldn't
mind to implement other solution if one is clearly described and agreed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18071