[libcxx-commits] [libcxx] [libc++] Remove unused headers from <cmath> (PR #213114)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 31 05:57:48 PDT 2026


https://github.com/frederick-vs-ja updated https://github.com/llvm/llvm-project/pull/213114

>From 2939f0728acbbd1f2920010245100348cf51b1b0 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 30 Jul 2026 15:28:27 -0400
Subject: [PATCH 1/2] [libc++] Remove unused headers from <cmath>

I believe these headers were relevant when we actually implemented
functions in <cmath>, but they are not anymore. Note that ::hypot in
particular is obtained from <math.h> like all the other math functions.
---
 libcxx/include/cmath | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/libcxx/include/cmath b/libcxx/include/cmath
index 27698a09fd75f..eea89ccdfb339 100644
--- a/libcxx/include/cmath
+++ b/libcxx/include/cmath
@@ -316,15 +316,11 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept
 #  include <__cxx03/cmath>
 #else
 #  include <__config>
-#  include <__math/hypot.h>
 #  include <__type_traits/enable_if.h>
 #  include <__type_traits/is_arithmetic.h>
-#  include <__type_traits/is_constant_evaluated.h>
 #  include <__type_traits/is_floating_point.h>
 #  include <__type_traits/is_same.h>
 #  include <__type_traits/promote.h>
-#  include <__type_traits/remove_cv.h>
-#  include <limits>
 #  include <version>
 
 #  include <__math/special_functions.h>

>From 072a7aeb6967a186ee0e869cb093ed6686f986a5 Mon Sep 17 00:00:00 2001
From: "A. Jiang" <de34 at live.cn>
Date: Fri, 31 Jul 2026 20:57:27 +0800
Subject: [PATCH 2/2] Fix includes for
 `libcxx/test/std/numerics/complex.number/cases.h`

---
 libcxx/test/std/numerics/complex.number/cases.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libcxx/test/std/numerics/complex.number/cases.h b/libcxx/test/std/numerics/complex.number/cases.h
index b360e1423ff57..3bcbdb202cf6d 100644
--- a/libcxx/test/std/numerics/complex.number/cases.h
+++ b/libcxx/test/std/numerics/complex.number/cases.h
@@ -14,7 +14,9 @@
 #define CASES_H
 
 #include <cassert>
+#include <cmath>
 #include <complex>
+#include <limits>
 #include <type_traits>
 
 #include "test_macros.h"



More information about the libcxx-commits mailing list