[libc-commits] [libc] d3a5589 - [libc] Add maybe_unused for functions only used on slow path (#98024)

via libc-commits libc-commits at lists.llvm.org
Mon Jul 8 07:04:19 PDT 2024


Author: Joseph Huber
Date: 2024-07-08T09:04:15-05:00
New Revision: d3a5589684baed14e82e57ca31fd4e988cb1436d

URL: https://github.com/llvm/llvm-project/commit/d3a5589684baed14e82e57ca31fd4e988cb1436d
DIFF: https://github.com/llvm/llvm-project/commit/d3a5589684baed14e82e57ca31fd4e988cb1436d.diff

LOG: [libc] Add maybe_unused for functions only used on slow path (#98024)

Summary:
When the fast math options are enabled these functions are uncalled,
which makes it error.

Added: 
    

Modified: 
    libc/src/math/generic/tan.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/math/generic/tan.cpp b/libc/src/math/generic/tan.cpp
index e6230e9c1cd69..7f1385c4717dd 100644
--- a/libc/src/math/generic/tan.cpp
+++ b/libc/src/math/generic/tan.cpp
@@ -95,7 +95,7 @@ LIBC_INLINE DoubleDouble tan_eval(const DoubleDouble &u) {
 }
 
 // Accurate evaluation of tan for small u.
-Float128 tan_eval(const Float128 &u) {
+[[maybe_unused]] Float128 tan_eval(const Float128 &u) {
   Float128 u_sq = fputil::quick_mul(u, u);
 
   // tan(x) ~ x + x^3/3 + x^5 * 2/15 + x^7 * 17/315 + x^9 * 62/2835 +
@@ -127,7 +127,7 @@ Float128 tan_eval(const Float128 &u) {
 // Calculation a / b = a * (1/b) for Float128.
 // Using the initial approximation of q ~ (1/b), then apply 2 Newton-Raphson
 // iterations, before multiplying by a.
-Float128 newton_raphson_div(const Float128 &a, Float128 b, double q) {
+[[maybe_unused]] Float128 newton_raphson_div(const Float128 &a, Float128 b, double q) {
   Float128 q0(q);
   constexpr Float128 TWO(2.0);
   b.sign = (b.sign == Sign::POS) ? Sign::NEG : Sign::POS;


        


More information about the libc-commits mailing list