druntime: redirect dual-ABI functions on glibc to IEEE128 version#20826
druntime: redirect dual-ABI functions on glibc to IEEE128 version#20826thewilsonator merged 1 commit intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @liushuyu! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#20826" |
thewilsonator
left a comment
There was a problem hiding this comment.
please use aliases instead of pragma(mangle, ...), like:
pragma(scanf)
int __isoc99_scanf(scope const char* format, scope ...);
///
alias scanf = __isoc99_scanf;
``
I don't know if I understand you correctly, but extern (C) void a();
version (PPC64) {
static if (real.mant_dig == 113) {
extern (C) void a__ieee128();
alias a = a__ieee128;
}
}
void b() {
a();
}This does not work. |
|
Assuming we can't do anything about the version (PPC64)
enum PPCUseIEEE128 = real.mant_dig == 113;
else
enum PPCUseIEEE128 = false;
static if (PPCUseIEEE128)
{
real __strtoieee128(scope inout(char)* nptr, scope inout(char)** endptr);
alias strtold = __strtoieee128;
}
else
{
real strtold(scope inout(char)* nptr, scope inout(char)** endptr);
}... which is a bit verbose for |
|
You only need to have one |
I know, but my concern is that declaring each function twice may increase maintenance burden (both versions have the same D function signature), as opposed to using |
... if IEEE long double ABI is selected
|
All CI tests have passed now. |
|
Uh oh, wrong button pressed. |
| int __isoc99_vfscanfieee128(scope const char* format, va_list arg); | ||
| /// | ||
| alias vscanf = __isoc99_vfscanfieee128; |
There was a problem hiding this comment.
@liushuyu you made mistake here.
warning: conflicting types for built-in function ‘__isoc99_vfscanfieee128’; expected ‘extern (C) int(void*, const(char)*, char*)’ [-Wbuiltin-declaration-mismatch]
1353 | int __isoc99_vfscanfieee128(scope const char* format, va_list arg);
| ^
Do you want to raise a PR to fix it?
| int __isoc99_vfscanfieee128(scope const char* format, va_list arg); | |
| /// | |
| alias vscanf = __isoc99_vfscanfieee128; | |
| int __isoc99_vscanfieee128(scope const char* format, va_list arg); | |
| /// | |
| alias vscanf = __isoc99_vscanfieee128; |
This pull request redirects
powerpcdual-ABI functions on glibc to the IEEE128 version if IEEE long double ABI is selected.A new (reserved) version identifier,D_PPCUseIEEE128, is introduced to control the redirection behaviour. Compilers are expected to set this version identifier when the user selects IEEE 128 ABI for their project.Compilers are expected to correctly set
real.mant_digwhen the user requests IEEE 128 ABI for their project.druntimewill define thePPCUseIEEE128compile-time variable if it detects that the user requests IEEE 128 ABI on PPC64 platforms.Required compiler changes (setting the
D_PPCUseIEEE128identifier) are also proposed in the following: