[PING^3] PR middle-end/18071 -Winline does not respect -fno-default-inline

Manuel López-Ibáñez lopezibanez@gmail.com
Sun Mar 4 22:17:00 GMT 2007


On 04/03/07, Mark Mitchell <mark@codesourcery.com> wrote:
> Manuel López-Ibáñez wrote:
>
> > cp/
> > * decl.c (start_method): Don't set DECL_DECLARED_INLINE_P if
> > -fno-default-inline.
>
> I don't think this change is correct.  DECL_DECLARED_INLINE_P controls
> linkage, and -fno-default-inline is documented as not changing linkage.
>  Thus, the change that you're making might affect the linkage of inline
> functions in object files, which would be bad.  The C++ front end sets
> DECL_DECLARED_INLINE_P, but no DECL_INLINE, which seems exactly
> consistent with the documentation: this function should be treated as
> inline for linkage purposes, but the middle end should not try to inline it.
>

I was afraid of this as I said: 'I am not sure whether the latter
breaks the current description of -fno-default-inline:  "Note that
these functions will have linkage
like inline functions; they just won't be inlined by default".'

The problem is that DECL_DECLARED_INLINE_P has two meanings. It
controls the linkage and it also denotes which functions were
explicitly declared inline. Since both meanings can contradict in this
case (a function was not declared inline but it has "inline linkage"),
it is impossible to detect this case with just one flag.

So, I am not sure how this can be solved. Adding yet another flag to
each tree node just to handle this case seems a bit overkill to me.

Cheers,

Manuel.




> --
> Mark Mitchell
> CodeSourcery
> mark@codesourcery.com
> (650) 331-3385 x713
>



More information about the Gcc-patches mailing list