[libc-commits] [libc] bd589f5 - [libc] Move statement inside #ifdef/#endif to prevent unused variable warning

via libc-commits libc-commits at lists.llvm.org
Sat Apr 6 11:58:24 PDT 2024


Author: Guillaume Chatelet
Date: 2024-04-06T20:58:22+02:00
New Revision: bd589f5c7a079d8829fcf994b746634eaaea24ff

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

LOG: [libc] Move statement inside #ifdef/#endif to prevent unused variable warning

This is a fix forward for arm32
`/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/big_int.h:259:20: error: unused variable 'TOTAL_BITS' [-Werror,-Wunused-variable]`

https://lab.llvm.org/buildbot/#/builders/229/builds/24791

Added: 
    

Modified: 
    libc/src/__support/big_int.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/big_int.h b/libc/src/__support/big_int.h
index f722a81d357d4f..e2061c43007024 100644
--- a/libc/src/__support/big_int.h
+++ b/libc/src/__support/big_int.h
@@ -256,8 +256,8 @@ LIBC_INLINE constexpr cpp::array<word, N> shift(cpp::array<word, N> array,
                                                 size_t offset) {
   static_assert(direction == LEFT || direction == RIGHT);
   constexpr size_t WORD_BITS = cpp::numeric_limits<word>::digits;
-  constexpr size_t TOTAL_BITS = N * WORD_BITS;
 #ifdef LIBC_TYPES_HAS_INT128
+  constexpr size_t TOTAL_BITS = N * WORD_BITS;
   if constexpr (TOTAL_BITS == 128) {
     using type = cpp::conditional_t<is_signed, __int128_t, __uint128_t>;
     auto tmp = cpp::bit_cast<type>(array);


        


More information about the libc-commits mailing list