Thread overview
[Issue 19570] pragma(inline) is emitting symbols
Jan 11
Manu
Jan 11
Manu
Jan 13
Manu
January 11
https://issues.dlang.org/show_bug.cgi?id=19570

Nicholas Wilson <iamthewilsonator@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iamthewilsonator@hotmail.co
                   |                            |m

--- Comment #1 from Nicholas Wilson <iamthewilsonator@hotmail.com> ---
https://github.com/dlang/dmd/pull/9235

--
January 11
https://issues.dlang.org/show_bug.cgi?id=19570

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
Why is this marked as critical?

Besides, the reason it is emitted to the object file is in the case someone in another module takes the address of it.

Also, the linker is supposed to elide unreferenced COMDATs, so it should go away.

This needs a better rationale for why it is a bug, let alone critical.

--
January 11
https://issues.dlang.org/show_bug.cgi?id=19570

Manu <turkeyman@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal

--- Comment #3 from Manu <turkeyman@gmail.com> ---
I'm not sure why it's critical, I don't recall doing that... Perhaps it was an accident. I created another bug critical yesterday, but that was bad codegen, failing to do the ABI proper.

> Besides, the reason it is emitted to the object file is in the case someone in another module takes the address of it.

>From another module being emit to the same object file, or another module
compiled into a separate object file?
I would expect taking the address would cause the code to be emit locally to
the module that's taking the address, rather than externing to a copy in the
module it's declared.

> Also, the linker is supposed to elide unreferenced COMDATs, so it should go away.

It doesn't. That's motivating this issue. But also I'm upset that it was there in the first place. That's distinctly *not* honouring my "inline" request.

> This needs a better rationale for why it is a bug, let alone critical.

I mean, I don't feel like I should be presenting an argument here... an explicit inline feature that doesn't do what's written on the tin seems like a bug.

I think the rationale needs to support why it wouldn't behave the way you'd expect.

Suggesting that we have to emit the function because a 3rd party should be able
to link to it is weird, because that's totally self-defeating.
Why is it inline then? I expect that if I've explicitly marked it inline, then
I can not extern to it, that would be the whole point.

Code that calls an inline function should either inline it as preferred, or if it decides not to for some reason, emit the code locally into the referencing module (and perhaps even don't emit a symbol name for the not-inline code).

--
January 11
https://issues.dlang.org/show_bug.cgi?id=19570

--- Comment #4 from Manu <turkeyman@gmail.com> ---
I recall having a big discussion about this when you added it... and I felt like we agreed on this and the semantics were very clear. You were even in favour at the time of requiring a compile error if inline failed, but I think I resisted on a hard error, because other compilers weren't necessarily able to respect that request.

--
January 13
https://issues.dlang.org/show_bug.cgi?id=19570

Manu <turkeyman@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical

--- Comment #5 from Manu <turkeyman@gmail.com> ---
It is critical, inline literally does nothing at all, as shows in the comments
section of the PR threads:
https://github.com/dlang/dmd/pull/9235

Absolutely nothing about inline works, and I'm blocked on it.

--