This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] LWG 2019 - std::isblank<C>(C, const std::locale&)


On 17/10/14 10:41 +0100, Jonathan Wakely wrote:
http://cplusplus.github.io/LWG/lwg-defects.html#2019

I've checked the relevant _ISblank/_ISBLANK/_CTYPE_B constant on all
targets except VxWorks where I chose something that looks reasonable.
Not all targets reserve a bit for isblank, but this way
ctype_base::blank is always defined, but on some platforms with the
same value as ctype_base::space. That means that on those targets
isblank(c, loc) is equivalent to isspace(c, loc) which is not correct,
but isn't completely crazy either.

Some systems (bionic, newlib, netbsd, openbsd) do define a _B (or
_CTYPE_B) constant, but as it says on netbsd:

/*
* isblank() is implemented as C function, due to insufficient bitwidth in
* _ctype_.  Note that _B does not mean isblank - it means isprint && !isgraph.
*/

On those targets there is no bitmask corresponding to the isblank set.
I don't know how to solve that without changing ctype_base::mask to a
wider type, which I'm not planning on doing.

N.B. on other BSDs (freebsd, darwin, dragonfly) _CTYPE_B *does*
correspond to isblank. Portability is fun.

Some implementations of ctype<char>::is(mask, char) and/or
ctype<wchar_t>::do_is defined inline in config/os/*/ctype_inline.h
need the ctype_base::blank mask, but those files get included by C++98
code, so for some targets ctype_base::blank is always defined even in
C++98 mode. Solving that is too difficult.

Tested x86_64-linux, with --enable-clocale={gnu,generic}
and also by hacking configure.host to use config/os/generic, and also
tested on x86_64-netbsd5.1 and x86_64-dragonfly3.6. Something will
probably break on a target I didn't test, but should be easy to fix.

I plan to commit this later today.

Committed to trunk.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]