[libc-commits] [libc] [libc][math] Fix buildbot fails (PR #151186)

Krishna Pandey via libc-commits libc-commits at lists.llvm.org
Tue Jul 29 09:58:12 PDT 2025


https://github.com/krishna2803 created https://github.com/llvm/llvm-project/pull/151186

cc @lntue 

>From a911bd0d6f3fc2e2d4aba5a374b223b246d0c2a5 Mon Sep 17 00:00:00 2001
From: Krishna Pandey <kpandey81930 at gmail.com>
Date: Tue, 29 Jul 2025 22:25:13 +0530
Subject: [PATCH 1/3] fix: wrap static_cast in else block

Signed-off-by: Krishna Pandey <kpandey81930 at gmail.com>
---
 libc/src/__support/FPUtil/cast.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libc/src/__support/FPUtil/cast.h b/libc/src/__support/FPUtil/cast.h
index e6fad1be7d053..061a42c52527b 100644
--- a/libc/src/__support/FPUtil/cast.h
+++ b/libc/src/__support/FPUtil/cast.h
@@ -67,8 +67,9 @@ cast(InType x) {
     DyadicFloat<cpp::bit_ceil(MAX_FRACTION_LEN)> xd(x);
     return xd.template as<OutType, /*ShouldSignalExceptions=*/true>();
   }
-
-  return static_cast<OutType>(x);
+  else {
+    return static_cast<OutType>(x);
+  }
 }
 
 } // namespace LIBC_NAMESPACE::fputil

>From eed450e7084c46acc848f6dd301c45e5306011b0 Mon Sep 17 00:00:00 2001
From: Krishna Pandey <kpandey81930 at gmail.com>
Date: Tue, 29 Jul 2025 22:25:35 +0530
Subject: [PATCH 2/3] style: clang-format

Signed-off-by: Krishna Pandey <kpandey81930 at gmail.com>
---
 libc/src/__support/FPUtil/cast.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libc/src/__support/FPUtil/cast.h b/libc/src/__support/FPUtil/cast.h
index 061a42c52527b..e999ece37871a 100644
--- a/libc/src/__support/FPUtil/cast.h
+++ b/libc/src/__support/FPUtil/cast.h
@@ -66,8 +66,7 @@ cast(InType x) {
         cpp::max(OutFPBits::FRACTION_LEN, InFPBits::FRACTION_LEN);
     DyadicFloat<cpp::bit_ceil(MAX_FRACTION_LEN)> xd(x);
     return xd.template as<OutType, /*ShouldSignalExceptions=*/true>();
-  }
-  else {
+  } else {
     return static_cast<OutType>(x);
   }
 }

>From 4531eaad2d28bcf8f69d4b9b53dcafb6f18d0363 Mon Sep 17 00:00:00 2001
From: Krishna Pandey <kpandey81930 at gmail.com>
Date: Tue, 29 Jul 2025 22:26:12 +0530
Subject: [PATCH 3/3] style: coding convention

Signed-off-by: Krishna Pandey <kpandey81930 at gmail.com>
---
 libc/src/__support/FPUtil/cast.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libc/src/__support/FPUtil/cast.h b/libc/src/__support/FPUtil/cast.h
index e999ece37871a..719b1eaa97ff4 100644
--- a/libc/src/__support/FPUtil/cast.h
+++ b/libc/src/__support/FPUtil/cast.h
@@ -66,9 +66,8 @@ cast(InType x) {
         cpp::max(OutFPBits::FRACTION_LEN, InFPBits::FRACTION_LEN);
     DyadicFloat<cpp::bit_ceil(MAX_FRACTION_LEN)> xd(x);
     return xd.template as<OutType, /*ShouldSignalExceptions=*/true>();
-  } else {
+  } else
     return static_cast<OutType>(x);
-  }
 }
 
 } // namespace LIBC_NAMESPACE::fputil



More information about the libc-commits mailing list