[libc-commits] [libc] 52da2db - [libc][complex] check that cfloat128 is not defined as _Complex long double (#119324)
via libc-commits
libc-commits at lists.llvm.org
Mon Dec 9 21:48:32 PST 2024
Author: Shourya Goel
Date: 2024-12-10T11:18:29+05:30
New Revision: 52da2db48911aa71fc878470e7052e0b2078110e
URL: https://github.com/llvm/llvm-project/commit/52da2db48911aa71fc878470e7052e0b2078110e
DIFF: https://github.com/llvm/llvm-project/commit/52da2db48911aa71fc878470e7052e0b2078110e.diff
LOG: [libc][complex] check that cfloat128 is not defined as _Complex long double (#119324)
Fix buildbot errors in #118671
Added:
Modified:
libc/include/llvm-libc-types/cfloat128.h
libc/src/__support/complex_type.h
Removed:
################################################################################
diff --git a/libc/include/llvm-libc-types/cfloat128.h b/libc/include/llvm-libc-types/cfloat128.h
index a371671cf62353..f76a0c1c2f5af5 100644
--- a/libc/include/llvm-libc-types/cfloat128.h
+++ b/libc/include/llvm-libc-types/cfloat128.h
@@ -35,6 +35,7 @@ typedef _Complex _Float128 cfloat128;
typedef _Complex __float128 cfloat128;
#elif (LDBL_MANT_DIG == 113)
#define LIBC_TYPES_HAS_CFLOAT128
+#define LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE
typedef _Complex long double cfloat128;
#endif
diff --git a/libc/src/__support/complex_type.h b/libc/src/__support/complex_type.h
index 4c861b05bc752c..88239886f983b5 100644
--- a/libc/src/__support/complex_type.h
+++ b/libc/src/__support/complex_type.h
@@ -37,10 +37,12 @@ template <> struct make_complex<float16> {
};
#endif
#if defined(LIBC_TYPES_HAS_CFLOAT128)
+#if !(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
template <> struct make_complex<float128> {
using type = cfloat128;
};
#endif
+#endif
template <typename T> using make_complex_t = typename make_complex<T>::type;
@@ -62,10 +64,12 @@ template <> struct make_real<cfloat16> {
};
#endif
#if defined(LIBC_TYPES_HAS_CFLOAT128)
+#if !(LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE)
template <> struct make_real<cfloat128> {
using type = float128;
};
#endif
+#endif
template <typename T> using make_real_t = typename make_real<T>::type;
More information about the libc-commits
mailing list