llvm-libc-macros: work around gcc defining LDBL_MANT_DIG as 53 on i386

Otherwise, gcc will not be able to compile parts of libc++ 21 in -m32
mode, resulting in errors similar to:

    In file included from /usr/src/contrib/llvm-project/libc/shared/str_to_float.h:13,
                     from /usr/src/contrib/llvm-project/libcxx/src/include/from_chars_floating_point.h:14,
                     from /usr/src/contrib/llvm-project/libcxx/src/charconv.cpp:12:
    /usr/src/contrib/llvm-project/libc/src/__support/str_to_float.h: In function 'void __llvm_libc::internal::set_implicit_bit(__llvm_libc::fputil::FPBits<T>&) [with T = long double]':
    /usr/src/contrib/llvm-project/libc/src/__support/str_to_float.h:77:10: error: 'struct __llvm_libc::fputil::FPBits<long double>' has no member named 'set_implicit_bit'
       77 |   result.set_implicit_bit(result.get_biased_exponent() != 0);
          |          ^~~~~~~~~~~~~~~~

PR:		292067
MFC after:	1 month
This commit is contained in:
Dimitry Andric
2026-01-02 21:32:05 +01:00
parent f7bcd8d8c9
commit 718e5874be
@@ -61,6 +61,11 @@
#define DBL_MANT_DIG __DBL_MANT_DIG__
#endif // DBL_MANT_DIG
// Kludge for gcc defining LDBL_MANT_DIG as 53 on i386
#if defined(LDBL_MANT_DIG) && defined(__GNUC__) && !defined(__clang__) && defined(__i386__)
#undef LDBL_MANT_DIG
#endif
#ifndef LDBL_MANT_DIG
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
#endif // LDBL_MANT_DIG