[libcxx-commits] [libcxx] [libc++] picolibc: avoid warning in __locale (PR #73937)
Dominik Wójt via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 30 06:02:00 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);
----------------
domin144 wrote:
The `formatter.char.fsigned-char.pass.cpp` test uses `-fsigned-char`
>From picolibc (and probably newlib, too), `ctype.h`:
```
#define _B 0200
```
So any mask with `_B` becomes negative after conversion to `mask`, which is `char`.
https://github.com/llvm/llvm-project/pull/73937
More information about the libcxx-commits
mailing list