-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc] Workaround for GCC on typedef
for _Complex __float128
#157010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc] Workaround for GCC on typedef
for _Complex __float128
#157010
Conversation
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.
@llvm/pr-subscribers-libcxx @llvm/pr-subscribers-libc Author: A. Jiang (frederick-vs-ja) ChangesCurrently, GCC can't parse Some recent changes exposed it to GCC and then caused CI failure for libc++. This patch adds a workaround for GCC. Full diff: https://github.com/llvm/llvm-project/pull/157010.diff 2 Files Affected:
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
|
#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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was considered to be duplicate of https://gcc.gnu.org/PR32187 later. Will update the comment once it's confirmed the CI failure due to libc is fixed.
// Remove the workaround when https://gcc.gnu.org/PR121799 gets fixed. | |
// Remove the workaround when https://gcc.gnu.org/PR32187 gets fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. It can be confirmed that GCC is happy now. https://github.com/llvm/llvm-project/actions/runs/17483703784/job/49660001482
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fix!
Just out of curiosity, does libc++ already incorporate llvm-libc? I recall seeing an earlier PR that tried to use llvm-libc in APFloat, but it hasn't been merged yet... |
Yes. Some components provided by libc++'s |
Currently, GCC can't parse
typedef _Complex __float128 cfloat128;
, although__typeof__
can be used as a workaround. Reported https://gcc.gnu.org/PR121799 which was later considered as duplicate of https://gcc.gnu.org/PR32187.Some recent changes exposed it to GCC and then caused CI failure for libc++. This patch adds a workaround for GCC.