[Issue 20925] pragma(inline) should emit code to the calling CU + appropriate linker flags
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jun 13 03:00:09 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20925
kinke <kinke at gmx.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kinke at gmx.net
--- Comment #5 from kinke <kinke at gmx.net> ---
(In reply to Manu from comment #4)
> Which is why I proposed allowing more fidelity in the argument to the pragma.
> Perhaps something like:
> pragma(inline, true) - linkonce
> pragma(inline, always) - strong hint that inlining should occur if possible
> pragma(inline, force) - compile error if inline fails
>
> These map to the 3 distinct use cases I referred to in my forum OP.
> What alternative proposal would you suggest for `linkonce`? That's what
> 'inline' actually means to most native programmers... deviating from that
> precedent would likely be _more_ confusing rather than less.
That's wild speculation on your part. ;) I don't find anything with `inline`
acceptable; I'm a C++ guy too, but I also try to keep in mind future
generations of D devs.
pragma(inline, <true|false>) are already reserved and make sense. Making
`pragma(inline, true)` mean linkonce_odr emission into each referencing CU (and
absolutely having to do nothing with actual inlining into callers), and
`pragma(inline, false)` mean
never-inline-into-any-callers-and-only-emit-into-owning-CU just isn't sound.
I don't have a thought-through alternative proposal because this isn't of high
enough interest to me. From the LDC side, we could simply add a UDA and allow
the user to specify the LLVM linkage directly if desired - à la `@linkonce`.
--
More information about the Digitalmars-d-bugs
mailing list