[PATCH 3/6] generated character data for libc/ctype
Thomas Wolff
towo@towo.net
Tue Mar 27 18:16:00 GMT 2018
Am 27.03.2018 um 12:37 schrieb Corinna Vinschen:
> On Mar 27 11:09, Thomas Preudhomme wrote:
>> Hi Thomas,
>>
>> This patch appears to regress 3 tests in libstdc++:
>>
>> 22_locale/ctype/is/wchar_t/1.cc execution test
>> 22_locale/ctype/scan/wchar_t/1.cc execution test
>> 28_regex/traits/wchar_t/isctype.cc execution test
>>
>> I believe the issue is due to ... (scroll down)
>>
>> On 09/03/18 22:54, Thomas Wolff wrote:
>>
>> [SNIP]
>>
>>> diff --git a/newlib/libc/ctype/iswupper_l.c b/newlib/libc/ctype/iswupper_l.c
>>> index 2555cd0..7ce8b5e
>>> --- a/newlib/libc/ctype/iswupper_l.c
>>> +++ b/newlib/libc/ctype/iswupper_l.c
>>> @@ -1,10 +1,20 @@
>>> +/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
>>> #include <_ansi.h>
>>> +#include <ctype.h>
>>> #include <wctype.h>
>>> +#include "local.h"
>>> +#include "categories.h"
>>> int
>>> iswupper_l (wint_t c, struct __locale_t *locale)
>>> {
>>> - /* We're using a locale-independent representation of upper/lower case
>>> - based on Unicode data. Thus, the locale doesn't matter. */
>>> - return towlower (c) != c;
>>> +#ifdef _MB_CAPABLE
>>> + c = _jp2uc_l (c, locale);
>>> + // The wide-character class "upper" contains at least those characters wc
>>> + // which are equal to towupper(wc) and different from towlower(wc).
>>> + enum category cat = category (c);
>>> + return cat == CAT_Lu || (cat == CAT_LC && towupper (c) == c);
>>> +#else
>>> + return c < 0x100 ? islower (c) : 0;
>>> +#endif /* _MB_CAPABLE */
>>> }
>> This change. Shouldn't is call isupper instead of islower? Or perhaps !islower?
>> I've tried with isupper and it makes the tests mentionned above pass.
Sure. I didn't mean to change the #ifdef _MB_CAPABLE #else case at all,
but due to some refactoring and reversed dependencies, it needed to be
tweaked. This looks like a copy-paste accident, which makes me really
blush. I've meanwhile compared the sources to look out for further flaws
but didn't find any. Sorry and thanks for testing.
> Yeah, calling isupper is correct, just as calling towupper in the _MB_CAPABLE case. I pushed a patch.
Thanks.
Thomas
More information about the Newlib
mailing list