[libc-commits] [libc] 485e2de - [libc][nfc] Silence two warnings in tests

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Fri Jun 16 10:52:12 PDT 2023


Author: Joseph Huber
Date: 2023-06-16T12:52:06-05:00
New Revision: 485e2de6d5a7d8fc2167e69c4486b1ebc673fc68

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

LOG: [libc][nfc] Silence two warnings in tests

These currently give warnings for unused variables or a default case
where everything is covered.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D153137

Added: 
    

Modified: 
    libc/test/UnitTest/RoundingModeUtils.cpp
    libc/test/src/__support/uint_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/UnitTest/RoundingModeUtils.cpp b/libc/test/UnitTest/RoundingModeUtils.cpp
index c6a69fc3f16fc..f880effd75a35 100644
--- a/libc/test/UnitTest/RoundingModeUtils.cpp
+++ b/libc/test/UnitTest/RoundingModeUtils.cpp
@@ -20,19 +20,14 @@ int get_fe_rounding(RoundingMode mode) {
   switch (mode) {
   case RoundingMode::Upward:
     return FE_UPWARD;
-    break;
   case RoundingMode::Downward:
     return FE_DOWNWARD;
-    break;
   case RoundingMode::TowardZero:
     return FE_TOWARDZERO;
-    break;
   case RoundingMode::Nearest:
     return FE_TONEAREST;
-    break;
-  default:
-    __builtin_unreachable();
   }
+  __builtin_unreachable();
 }
 
 ForceRoundingMode::ForceRoundingMode(RoundingMode mode) {

diff  --git a/libc/test/src/__support/uint_test.cpp b/libc/test/src/__support/uint_test.cpp
index ad6684fb8eca0..3fe9b26bc4256 100644
--- a/libc/test/src/__support/uint_test.cpp
+++ b/libc/test/src/__support/uint_test.cpp
@@ -25,7 +25,6 @@ using LL_Int128 = __llvm_libc::cpp::Int<128>;
 using LL_Int192 = __llvm_libc::cpp::Int<192>;
 
 TEST(LlvmLibcUIntClassTest, BasicInit) {
-  LL_UInt128 empty;
   LL_UInt128 half_val(12345);
   LL_UInt128 full_val({12345, 67890});
   ASSERT_TRUE(half_val != full_val);


        


More information about the libc-commits mailing list