[PATCH 02/59] stdlib: longlong.h: Do no use asm input cast for clang
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Mon Oct 20 12:46:42 GMT 2025
On 17/10/25 19:36, H.J. Lu wrote:
> On Sat, Oct 18, 2025 at 3:23 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> clang 18 and 19 rejects the input casts with:
>>
>> error: invalid use of a cast in a inline asm context requiring an lvalue: remove the cast or build with -fheinous-gnu-extensions
>>
>> While clang 20 and 21 throws a different error:
>>
>> strtod_l.c:1502:20: error: invalid use of a cast in an inline asm context requiring an lvalue
>> [-Winvalid-gnu-asm-cast]
>>
>> And even with -fheinous-gnu-extensions clang issues an warning
>> that can only be supressed with clang 20/21 (and the option might
>> also might be removed in the future).
>
> This file is copied from GCC. It should be modified in GCC first.
>
Fangrui tries to make a similar change back em 2021 [1], and I tried
to make a similar change again in 2023 [2]. The impression I had was
that gcc developers do not want to make any changes on the header
to handle clang requirements. I really do not want to get stalled
again in gcc maillist for this simple fix.
Since Joseph said is not a good idea to diverge between implementations,
another possibility is to get rid of longlong.h by using stdbit.h and
mode the required definitions on sysdeps using a more modern definition
(function instead the spaghetti macro). The problem with this approach
is this also touches shared code with gcc, and thus we will have similar
problems.
I thought about a hack solution which is to pre-process this header
with some script to generate another one at build time; but I do not
want to go on this path.
[1] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581257.html
[2] https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609671.html
More information about the Libc-alpha
mailing list