[libc-commits] [libc] [libc] Fix -Wunused-variable warnings (PR #241982)
Victor Campos via libc-commits
libc-commits at lists.llvm.org
Thu Nov 12 09:47:50 PST 2026
https://github.com/vhscampos created https://github.com/llvm/llvm-project/pull/241982
These variables may end up unused depending on the rounding mode in place.
>From e5f68dec7e3f3bf315e44a33a812b04c2d062fcc Mon Sep 17 00:00:00 2001
From: Victor Campos <victor.campos at arm.com>
Date: Thu, 12 Nov 2026 17:43:22 +0000
Subject: [PATCH] [libc] Fix -Wunused-variable warnings
These variables may end up unused depending on the rounding mode in
place.
---
libc/test/src/math/smoke/exp2f16_test.cpp | 2 +-
libc/test/src/math/smoke/expf16_test.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libc/test/src/math/smoke/exp2f16_test.cpp b/libc/test/src/math/smoke/exp2f16_test.cpp
index 07e2e23dcff05..68aea9256f925 100644
--- a/libc/test/src/math/smoke/exp2f16_test.cpp
+++ b/libc/test/src/math/smoke/exp2f16_test.cpp
@@ -63,7 +63,7 @@ TEST_F(LlvmLibcExp2f16Test, Underflow) {
TEST_F(LlvmLibcExp2f16Test, OverflowStatusAllRoundingModes) {
using Bits = LIBC_NAMESPACE::fputil::FPBits<float16>;
const float16 x = Bits(uint16_t(0x5000)).get_val();
- const float16 largest = Bits(uint16_t(0x7bff)).get_val();
+ [[maybe_unused]] const float16 largest = Bits(uint16_t(0x7bff)).get_val();
const float16 infinity = Bits::inf().get_val();
EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_NEAREST(
infinity, LIBC_NAMESPACE::exp2f16(x), FE_OVERFLOW | FE_INEXACT);
diff --git a/libc/test/src/math/smoke/expf16_test.cpp b/libc/test/src/math/smoke/expf16_test.cpp
index aa0d4314a3dda..e4a45136893e8 100644
--- a/libc/test/src/math/smoke/expf16_test.cpp
+++ b/libc/test/src/math/smoke/expf16_test.cpp
@@ -63,7 +63,7 @@ TEST_F(LlvmLibcExpf16Test, Underflow) {
TEST_F(LlvmLibcExpf16Test, OverflowStatusAllRoundingModes) {
using Bits = LIBC_NAMESPACE::fputil::FPBits<float16>;
const float16 x = Bits(uint16_t(0x5000)).get_val();
- const float16 largest = Bits(uint16_t(0x7bff)).get_val();
+ [[maybe_unused]] const float16 largest = Bits(uint16_t(0x7bff)).get_val();
const float16 infinity = Bits::inf().get_val();
EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_NEAREST(
infinity, LIBC_NAMESPACE::expf16(x), FE_OVERFLOW | FE_INEXACT);
More information about the libc-commits
mailing list