[libcxx-commits] [libcxx] [libc++] picolibc: avoid warning in __locale (PR #73937)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 30 05:53:52 PST 2023


================
@@ -452,16 +452,18 @@ public:
 #elif defined(_NEWLIB_VERSION)
     // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
     typedef char mask;
+    // In case char is signed, static_cast is needed to avoid warning on
+    // positive value becomming negative.
     static const mask space  = _S;
-    static const mask print  = _P | _U | _L | _N | _B;
+    static const mask print  = static_cast<mask>(_P | _U | _L | _N | _B);
----------------
ldionne wrote:

Why do we not need the cast in all of these initializations?

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


More information about the libcxx-commits mailing list