Bug 17310 – [SPEC] Ambiguous mangling for 'Y', Objective-C function or variadic arguments?

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-04-08T14:54:42Z
Last change time
2024-12-13T18:51:57Z
Keywords
mangling, objc, pull
Assigned to
No Owner
Creator
Rainer Schuetze
Moved to GitHub: dmd#19244 →

Comments

Comment #0 by r.sagitario — 2017-04-08T14:54:42Z
extern(Objective-C) void ofun(); void foo(typeof(ofun)* fn); void goo(...); pragma(msg, typeof(foo).mangleof); pragma(msg, typeof(goo).mangleof); produces: FPYZvZv FYv 'Y' at the position of a function argument can both be an Objective-C function type or the end of the argument list of variadic function. Granted, the function type might never appear without a pointer prefix in the argument list, but this special case makes it harder for a demangler. Objective-C functions should use a different character (or a combination of characters, e.g. "No") instead.
Comment #1 by r.sagitario — 2017-04-14T15:13:58Z
> Granted, the function type might never appear without a pointer prefix in the argument list It appears inside QualifiedName for nested symbols inside an extern(Objective-C ) function.
Comment #2 by r.sagitario — 2017-04-15T07:32:52Z
Comment #3 by ibuclaw — 2017-04-15T08:47:32Z
$ ./cxxfilt -s dlang _D8demangle3fooFPYZvZv demangle.foo(extern(Objective-C) void() function) _D8demangle3gooFYv demangle.goo(...) I have no problem handling this. ;-)
Comment #4 by ibuclaw — 2017-04-15T08:54:04Z
(In reply to Rainer Schuetze from comment #0) > > Granted, the function type might never appear without a pointer prefix in > the argument list, but this special case makes it harder for a demangler. > I think it should be assumed that the demangler rejects this anyway. $ ./cxxfilt -s dlang _D8demangle3fooFYZvZv _D8demangle3fooFYZvZv <- Not demangled. As a litmus test, I also tried. _D8demangle3gooYZv <- extern(Objective-C) goo() demangle.goo() _D8demangle3gooYYv <- extern(Objective-C) goo(...) demangle.goo(...) But the compiler will never emit functions like the above two anyway...
Comment #5 by r.sagitario — 2017-04-15T09:18:28Z
Try these: module test; struct S {} extern(Objective-C) void ofun() { void foo(S s, ...); void goo(typeof(&foo) fn); pragma(msg, foo.mangleof); // _D4test4ofunYZ3fooMFS4test1SYv pragma(msg, goo.mangleof); // _D4test4ofunYZ3gooMFDFS4test1SYvZv } The 'Y' after 4test1S looks ambiguous to me.
Comment #6 by razvan.nitu1305 — 2023-05-18T08:47:50Z
Since https://github.com/dlang/dmd/pull/6702 has been closed is there any point in keeping this bug report open?
Comment #7 by r.sagitario — 2023-05-18T09:18:14Z
Even if adding support for Objective-C to the demangler, it fails to demangle the symbols in comment 5, while it works for `extern(Windows)`. So I guess it is still valid if Objective-C support is not deprecated. See https://run.dlang.io/is/4sFOLJ
Comment #8 by robert.schadek — 2024-12-13T18:51:57Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19244 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB