xlocale patch

Jilles Tjoelker jilles at stack.nl
Sun Nov 20 14:03:10 UTC 2011


On Wed, Sep 21, 2011 at 08:28:54PM +0100, David Chisnall wrote:
> And here's an updated version of the patch.  I've fixed some other
> bugs, including where wcstod() and wcstodl() in trunk return the wrong
> value for any input string starting with spaces, wchar.h's violation
> of POSIX by not declaring FILE, and a few C++ incompatibilities in
> other headers (e.g. putchar being a macro, which breaks things like
> std::putchar(foo)).  All of my libcxxrt and libc++ changes have now
> been pushed upstream, so this should now be repeatable.  
> 
> The libunwind port still has an irritating bug in the header, where
> the extern "C" {} block ends with a semicolon, which causes it to be
> rejected in any C++ program, but with that fixed you can compile
> libcxxrt (I used cmake .. -DCMAKE_CXX_FLAGS="-I/usr/local/include
> -nostdlib -g" - hopefully I'll work out how to make CMake add these
> flags automatically soon...).  Libc++ should build out of the box with
> cmake.

I think it is unfortunate that <xlocale.h> depends on #include order; we
should be moving away from such ordering dependencies, not adding more.
POSIX does not have such dependencies so if they add all these new _l
functions, they will most likely do it differently.

POSIX.1-2008 has some of the _l functions but adds them to the plain
header; for example isalnum_l() is in <ctype.h> like isalnum(),
nl_langinfo_l() is in <langinfo.h> like nl_langinfo() and strcasecmp_l()
is in <strings.h> like strcasecmp(). This appears more sensible to me.
The <xlocale.h> header can then be an empty file.

-- 
Jilles Tjoelker


More information about the freebsd-hackers mailing list