[libc-commits] [libc] [libc] Add `-Wsign-conversion` (PR #129811)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Wed Mar 5 10:21:56 PST 2025


================
@@ -285,7 +285,10 @@ LIBC_INLINE constexpr cpp::array<word, N> shift(cpp::array<word, N> array,
       return 0;
     if (i >= int(N))
       return is_neg ? cpp::numeric_limits<word>::max() : 0;
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Wsign-conversion"
     return array[i];
----------------
michaelrj-google wrote:

I think this would be a simpler solution:
```suggestion
    return static_cast<word>(array[i]);
```

https://github.com/llvm/llvm-project/pull/129811


More information about the libc-commits mailing list