[libc-commits] [libc] [libc][complex] fix compiler support matrix for cfloat128 (PR #122593)

via libc-commits libc-commits at lists.llvm.org
Sat Jan 11 06:56:13 PST 2025


================
@@ -18,15 +18,17 @@
 //
 // TODO: Update the complex variant of C23 `_Float128` type detection again when
 // clang supports it.
-#if defined(__STDC_IEC_60559_COMPLEX__) && !defined(__clang__)
-#if !defined(__cplusplus)
+#if !defined(__clang__)
----------------
lntue wrote:

the updated detection logic can be simplified to:
```
#ifdef (__clang__)
  #if (__clang_major__ >= 11) && (defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__))
    #define LIBC_TYPES_HAS_CFLOAT128
    typedef _Complex __float128 cfloat128;
  #endif
#elif defined(__GNUC__)
  #if (defined(__STDC_IEC_60559_COMPLEX__) || defined(__SIZEOF_FLOAT128__)) &&    \
      (__GNUC__ >= 13 || (!defined(__cplusplus)))
    #define LIBC_TYPES_HAS_CFLOAT128
    typedef _Complex _Float128 cfloat128;
  #endif
#elif (LDBL_MANT_DIG == 113)
...
#endif
```

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


More information about the libc-commits mailing list