[cfe-commits] [patch][libcxx] Fix ctype_byname<wchar>::do_[scan_]is when _LIBCPP_WCTYPE_IS_MASK is not defined

Andrew C. Morrow andrew.c.morrow at gmail.com
Thu Aug 2 10:59:30 PDT 2012


Hi -

Among the various libc++ tests that currently don't pass on Linux are
localization/locale.categories/category.collate/category.ctype/locale.ctype.byname/is_1.pass.cpp
and scan_is.pass.cpp. The tests fail when the character class being
tested is compound, like ctype_base::alnum or ctype_base::graph,
because the existing series of conditionals in do_is an do_scan_is
will abort too early. For instance, if the character class being
tested is alnum, and the character is numeric, do_is will return false
because iswalpha_l will return false, 'result' becomes false, and the
'true' result from the later call to iswdigit_l ends up being ignored
. A similar problem exists in do_scan_is.

My confidence in this patch is much lower than usual, because I'm not
particularly familiar with wchar_t, the intended semantics of
ctype_byname::do_is and ctype_byname::do_scan_is, the character
classes, etc. So this patch is more sort of a suggestion. Though the
patch does make the broken tests pass and doesn't appear to break any
others, so that is some evidence in its favor.

Thanks,
Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libcxx.ctype_byname.do_is.patch
Type: application/octet-stream
Size: 3541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120802/0943cd01/attachment.obj>


More information about the cfe-commits mailing list