[libcxx-commits] [libcxxabi] [libcxxabi] Use __LDBL_MANT_DIG__ for configuring demangling of long doubles (PR #134976)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 9 01:29:37 PDT 2025


================
@@ -5741,14 +5741,12 @@ struct FloatData<double>
 template <>
 struct FloatData<long double>
 {
-#if defined(__mips__) && defined(__mips_n64) || defined(__aarch64__) || \
-    defined(__wasm__) || defined(__riscv) || defined(__loongarch__) || \
-    defined(__ve__)
-    static const size_t mangled_size = 32;
-#elif defined(__arm__) || defined(__mips__) || defined(__hexagon__)
-    static const size_t mangled_size = 16;
-#else
-    static const size_t mangled_size = 20;  // May need to be adjusted to 16 or 24 on other platforms
+#if __LDBL_MANT_DIG__ == 113
+  static const size_t mangled_size = 32;
+#elif __LDBL_MANT_DIG__ == 53
+  static const size_t mangled_size = 16;
+#else // __LDBL_MANT_DIG__ == 64
----------------
philnik777 wrote:

I think it'd be better to check the mantissa here as well and `#error` if there is a new size. Otherwise we might be silently wrong on some platforms.

https://github.com/llvm/llvm-project/pull/134976


More information about the libcxx-commits mailing list