This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH][C] Fix GNU extern inline heuristic again (fix C++ memory usage regression)
On Mon, 27 Aug 2007, Dave Korn wrote:
> On 27 August 2007 16:24, Richard Guenther wrote:
>
> > On Mon, 27 Aug 2007, Dave Korn wrote:
> >
> >>> Index: c-decl.c
> >>> ===================================================================
> >>> *** c-decl.c.orig 2007-08-27 11:25:41.000000000 +0200
> >>> --- c-decl.c 2007-08-27 14:01:38.000000000 +0200
> >>
> >>> *************** finish_function (void)
> >>> *** 6771,6776 ****
> >>> --- 6776,6786 ----
> >>> /* Finalize the ELF visibility for the function. */
> >>> c_determine_visibility (fndecl);
> >>>
> >>> + /* For GNU C extern inline functions disregard inline limits. */
> >>> + if (DECL_EXTERNAL (fndecl)
> >>> + && DECL_DECLARED_INLINE_P (fndecl))
> >>> + DECL_DISREGARD_INLINE_LIMITS (fndecl) = 1;
> >>> +
> >>> /* Genericize before inlining. Delay genericizing nested functions
> >>> until their parent function is genericized. Since finalizing
> >>> requires GENERIC, delay that as well. */
> >>
> >>
> >> I don't understand why the comment says "GNU C extern inline functions". I
> >> couldn't find any reason this wouldn't also affect C99 extern inline
> >> functions. Is the comment just too specific?
> >
> > C99 extern inline functions? Do you mean C99 inline functions? These
> > are not covered by the predicate and I'm just trying to preserve
> > previous behavior. Or am I missing something?
>
> All I mean is, there are varying definitions of "extern inline" between c99,
> gnu99 (at least until 4.4), and gnu89, and as far as I can see your patch would
> affect all extern inline functions regardless of the language standard in effect.
> The comment appears to be referring only to GNU C mode.
Well, for -std=c99
extern inline int foo(int i)
{
return i + 1;
}
doesn't have DECL_EXTERNAL set. Not even for
extern inline int foo(int i);
So I believe DECL_DECLARED_INLINE_P && DECL_EXTERNAL only covers
GNU C extern inline functions. Note that this was also the only
condition that was tested in the old disregard_inlining_limits langhook.
Richard.