aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2026-01-02 20:32:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2026-05-29 22:57:31 +0000
commit6960284840f8178cb86e359da3b2d4cbe1581b23 (patch)
tree0c973a2d6062592fa17696a8e545079fd0cf7426
parent030fd7fb65c38d889f1dd6f81cb2971de5a09e5d (diff)
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 (cherry picked from commit 718e5874be0306ea302fd2b8e1d97fc79682abbe)
-rw-r--r--contrib/llvm-project/libc/include/llvm-libc-macros/float-macros.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/llvm-project/libc/include/llvm-libc-macros/float-macros.h b/contrib/llvm-project/libc/include/llvm-libc-macros/float-macros.h
index a25ef60a293d..3bf92bc7b6c9 100644
--- a/contrib/llvm-project/libc/include/llvm-libc-macros/float-macros.h
+++ b/contrib/llvm-project/libc/include/llvm-libc-macros/float-macros.h
@@ -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