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]

Re: PR middle-end/18071 -Winline does not respect -fno-default-inline



On 08/07/2007, at 3:30 AM, Manuel López-Ibáñez wrote:


On 06/07/07, Geoff Keating <geoffk@apple.com> wrote:
> 2007-01-16 Manuel Lopez-Ibanez <manu@gcc.gnu.org>

> * It does not set DECL_DECLARED_INLINE_P for methods unless they are
> declared inline or -fdefault-inline is true (which is the default).


will break the C++ linkage model; for instance, you'll get these
methods as the key method of a class.

I'm tempted to declare the compiler's behaviour as correct, since it
is doing what it is documented to do: functions inside a class are
still declared inline, and they're not being inlined, so -Winline
should produce a warning about it.  There's a similar case with -fno-
inline.

So what is the difference between declaring a method "inline" and using -fdefault-inline?

One is a language construct with semantic effects and the other is an optimization flag which does not change language semantics.


The point is: what is the meaning of DECL_DECLARED_INLINE_P? As I
understand it, it means that the declaration includes explicitly the
word "inline" (how to detect this otherwise?). For example,
-finline-functions does not actually sets DECL_DECLARED_INLINE_P for
all functions, it just sets DECL_INLINE. -Winline (should) only warns
for solutions declared inline by the user, not assumed inline by the
compiler.

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.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]