diff options
| author | Jonathan Wakely <jwakely@redhat.com> | 2026-01-23 14:04:26 +0000 |
|---|---|---|
| committer | Jonathan Wakely <redi@gcc.gnu.org> | 2026-01-28 10:28:05 +0000 |
| commit | 975025de350bb8cc264fef0a5f88f71abe5b3791 (patch) | |
| tree | ace6b2f9a5bf13998ed35d7da8552a0ba8bcf91d /libjava/gnu/java/security | |
| parent | bb5ebc937329196eca404385b4388352ae568a86 (diff) | |
| download | gcc-975025de350bb8cc264fef0a5f88f71abe5b3791.zip gcc-975025de350bb8cc264fef0a5f88f71abe5b3791.tar.gz gcc-975025de350bb8cc264fef0a5f88f71abe5b3791.tar.bz2 | |
libstdc++: Avoid -Wtype-limits warnings in locale/gnu/ctype_members.cc
On targets where wchar_t is unsigned we get warnings during the
libstdc++ build:
ctype_members.cc: In member function ‘virtual char std::ctype<wchar_t>::do_narrow(wchar_t, char) const’:
ctype_members.cc:224:14: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
224 | if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
| ~~~~~^~~~
ctype_members.cc: In member function ‘virtual const wchar_t* std::ctype<wchar_t>::do_narrow(const wchar_t*, const wchar_t*, char, char*) const’:
ctype_members.cc:247:21: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
247 | if (*__lo >= 0 && *__lo < 128)
| ~~~~~~^~~~
This introduces a helper function that converts the wchar_t to an
unsigned type and then does the comparison. This means the comparison is
not target-dependent, and there's no more warning.
libstdc++-v3/ChangeLog:
* config/locale/gnu/ctype_members.cc (use_table): New function.
(ctype<wchar_t>::do_narrow): Use use_table.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Diffstat (limited to 'libjava/gnu/java/security')
0 files changed, 0 insertions, 0 deletions
