From f9c7f53549ef41cebe2a081521d8c316f2cabb29 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Fri, 5 Sep 2025 12:26:48 +0800 Subject: [PATCH 1/2] [libc] Workaround for GCC on `typedef` for `_Complex __float128` Currently, GCC can't parse `typedef _Complex __float128 cfloat128;`, although `__typeof__` can be used as a workaround. Reported https://gcc.gnu.org/PR121799. Some recent changes exposed it to GCC and then caused CI failure for libc++. This patch adds a workaround for GCC. --- libc/include/llvm-libc-types/cfloat128.h | 5 +++++ libcxx/include/__config | 2 ++ 2 files changed, 7 insertions(+) diff --git a/libc/include/llvm-libc-types/cfloat128.h b/libc/include/llvm-libc-types/cfloat128.h index 25b4cc7345a30..78a3dacd2676c 100644 --- a/libc/include/llvm-libc-types/cfloat128.h +++ b/libc/include/llvm-libc-types/cfloat128.h @@ -13,7 +13,12 @@ #ifdef LIBC_TYPES_HAS_CFLOAT128 #ifndef LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE +#if defined(__GNUC__) && !defined(__clang__) +// Remove the workaround when https://gcc.gnu.org/PR121799 gets fixed. +typedef __typeof__(_Complex __float128) cfloat128; +#else // ^^^ workaround / no workaround vvv typedef _Complex __float128 cfloat128; +#endif // ^^^ workaround ^^^ #else typedef _Complex long double cfloat128; #endif // LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE diff --git a/libcxx/include/__config b/libcxx/include/__config index c197851f1c8fe..b1dff47b6aafd 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1265,3 +1265,5 @@ typedef __char32_t char32_t; #endif // __cplusplus #endif // _LIBCPP___CONFIG + +// triggering CI, will be reverted From 45a99a0e23613be91d5cd5a14d3d3056c694fea9 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Fri, 5 Sep 2025 13:09:52 +0800 Subject: [PATCH 2/2] Update comment for the GCC bug report, revert temporary change --- libc/include/llvm-libc-types/cfloat128.h | 2 +- libcxx/include/__config | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/libc/include/llvm-libc-types/cfloat128.h b/libc/include/llvm-libc-types/cfloat128.h index 78a3dacd2676c..838ef1cbd9ad5 100644 --- a/libc/include/llvm-libc-types/cfloat128.h +++ b/libc/include/llvm-libc-types/cfloat128.h @@ -14,7 +14,7 @@ #ifdef LIBC_TYPES_HAS_CFLOAT128 #ifndef LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE #if defined(__GNUC__) && !defined(__clang__) -// Remove the workaround when https://gcc.gnu.org/PR121799 gets fixed. +// Remove the workaround when https://gcc.gnu.org/PR32187 gets fixed. typedef __typeof__(_Complex __float128) cfloat128; #else // ^^^ workaround / no workaround vvv typedef _Complex __float128 cfloat128; diff --git a/libcxx/include/__config b/libcxx/include/__config index b1dff47b6aafd..c197851f1c8fe 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1265,5 +1265,3 @@ typedef __char32_t char32_t; #endif // __cplusplus #endif // _LIBCPP___CONFIG - -// triggering CI, will be reverted