aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2026-01-02 20:32:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2026-04-25 14:14:11 +0000
commit718e5874be0306ea302fd2b8e1d97fc79682abbe (patch)
tree498f58b879ccbd72a13b8ced770d09b996079ebe
parentf7bcd8d8c9336b97569265e5ad36b73b30357beb (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
-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