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

Nico Weber via libc-commits libc-commits at lists.llvm.org
Thu May 7 08:07:55 PDT 2026


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

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.

>From 979014ca43f2e9f1cf44ee5b64aa6516940b1c38 Mon Sep 17 00:00:00 2001
From: Nico Weber <thakis at chromium.org>
Date: Thu, 7 May 2026 11:06:15 -0400
Subject: [PATCH] [libc][math] Fix -Wshadow warnings in cos.h

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.
---
 libc/src/__support/math/cos.h | 2 --
 1 file changed, 2 deletions(-)

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;
 



More information about the libc-commits mailing list