This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fobey-inline (was Re: gcc and inlining)
Olivier Galibert wrote:
Remember, inline was _added_ to the standard because it was considered
useful by the users. It's not legacy like register,
"inline" is legacy in _exactly the same way_ as "register" is:
the compiler can make a better guess as to what to inline
(cq what to put in registers) than the user can. At least,
that's the plan. It would be a good idea if the
compiler took "inline" (and "register") as a very strong
hint to actually inline (or put in register) -- it should
do it unless it really cannot. The only thing that can
be hurt by the compiler obeying the user's code is
performance -- and if a user wants to write "inline"
(or "register") he/she should be aware that it will
not always improve performance.
It's very nice if the compiler can make better
decisions than the user, but it should always obey
the user. Unless, maybe, a -fno-obey-inline-keyword flag
is given -- such a flag could help people compiling
"legacy" software sprinkled with way too many bad "inline"
(or "register") hints.
Hrm, now I find myself arguing to add the flag, but
defaulting it to off, while I thought I wanted to argue
against adding the compiler flag :-)
And it would be really great if we could have an
-fobey-register-keyword flag, too :)
Segher