[libc-commits] [libc] [libc][complex] simplify header guard for F128 and CF128 (PR #112926)

Shourya Goel via libc-commits libc-commits at lists.llvm.org
Fri Oct 18 08:48:24 PDT 2024


https://github.com/Sh0g0-1758 updated https://github.com/llvm/llvm-project/pull/112926

>From 281aede487b44c66a0f4443d160beec9e20329b9 Mon Sep 17 00:00:00 2001
From: Sh0g0-1758 <shouryagoel10000 at gmail.com>
Date: Fri, 18 Oct 2024 21:09:32 +0530
Subject: [PATCH 1/2] simplify header

---
 libc/include/llvm-libc-types/cfloat128.h | 4 ++--
 libc/include/llvm-libc-types/float128.h  | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/libc/include/llvm-libc-types/cfloat128.h b/libc/include/llvm-libc-types/cfloat128.h
index a371671cf62353..48b8c58b53f0a3 100644
--- a/libc/include/llvm-libc-types/cfloat128.h
+++ b/libc/include/llvm-libc-types/cfloat128.h
@@ -18,11 +18,11 @@
 //
 // 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(__STDC_IEC_60559_COMPLEX__)
 #if !defined(__cplusplus)
 #define LIBC_TYPES_HAS_CFLOAT128
 typedef _Complex _Float128 cfloat128;
-#elif defined(__GNUC__) && __GNUC__ >= 13
+#elif __GNUC__ >= 13
 #define LIBC_TYPES_HAS_CFLOAT128
 typedef _Complex _Float128 cfloat128;
 #endif
diff --git a/libc/include/llvm-libc-types/float128.h b/libc/include/llvm-libc-types/float128.h
index 82ebb79f1f5808..bce980900ba288 100644
--- a/libc/include/llvm-libc-types/float128.h
+++ b/libc/include/llvm-libc-types/float128.h
@@ -17,8 +17,7 @@
 //
 // TODO: Update C23 `_Float128` type detection again when clang supports it.
 //   https://github.com/llvm/llvm-project/issues/80195
-#if defined(__STDC_IEC_60559_BFP__) && !defined(__clang__) &&                  \
-    !defined(__cplusplus)
+#if defined(__STDC_IEC_60559_BFP__) && !defined(__cplusplus)
 #define LIBC_TYPES_HAS_FLOAT128
 typedef _Float128 float128;
 #elif defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)

>From 7d23c547309a5bb4ae97ffd11c51ea7ffe4995b6 Mon Sep 17 00:00:00 2001
From: Sh0g0-1758 <shouryagoel10000 at gmail.com>
Date: Fri, 18 Oct 2024 21:18:09 +0530
Subject: [PATCH 2/2] remove header guard on clang version

---
 libc/include/llvm-libc-types/cfloat128.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libc/include/llvm-libc-types/cfloat128.h b/libc/include/llvm-libc-types/cfloat128.h
index 48b8c58b53f0a3..dbfef83a4a98d1 100644
--- a/libc/include/llvm-libc-types/cfloat128.h
+++ b/libc/include/llvm-libc-types/cfloat128.h
@@ -26,8 +26,7 @@ typedef _Complex _Float128 cfloat128;
 #define LIBC_TYPES_HAS_CFLOAT128
 typedef _Complex _Float128 cfloat128;
 #endif
-#elif __clang_major__ >= 11 &&                                                 \
-    (defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__))
+#elif defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
 // Use _Complex __float128 type. clang uses __SIZEOF_FLOAT128__ or __FLOAT128__
 // macro to notify the availability of __float128 type:
 // https://reviews.llvm.org/D15120



More information about the libc-commits mailing list