[libc-commits] [libc] [libc][math] Fix -Wshadow warnings in cos.h (PR #196342)

via libc-commits libc-commits at lists.llvm.org
Thu May 7 08:09:20 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Nico Weber (nico)

<details>
<summary>Changes</summary>

cos() does `using namespace range_reduction_double_internal;` and range_reduction_double_internal after 51e9430a0c767 contains

    using LIBC_NAMESPACE::fputil::DoubleDouble;
    using Float128 = LIBC_NAMESPACE::fputil::DyadicFloat<128>;

So the local using statements for DoubleDouble and Float128 shadowed these. Just remove the local using statements.

No behavior change.

---
Full diff: https://github.com/llvm/llvm-project/pull/196342.diff


1 Files Affected:

- (modified) libc/src/__support/math/cos.h (-2) 


``````````diff
diff --git a/libc/src/__support/math/cos.h b/libc/src/__support/math/cos.h
index 1a7833978304a..e6a37c132cd80 100644
--- a/libc/src/__support/math/cos.h
+++ b/libc/src/__support/math/cos.h
@@ -32,7 +32,6 @@ namespace math {
 
 LIBC_INLINE constexpr double cos(double x) {
   using namespace range_reduction_double_internal;
-  using DoubleDouble = fputil::DoubleDouble;
   using FPBits = typename fputil::FPBits<double>;
   FPBits xbits(x);
 
@@ -122,7 +121,6 @@ LIBC_INLINE constexpr double cos(double x) {
 #ifdef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
   return rr.hi + rr.lo;
 #else
-  using Float128 = typename fputil::DyadicFloat<128>;
   double rlp = rr.lo + err;
   double rlm = rr.lo - err;
 

``````````

</details>


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


More information about the libc-commits mailing list