contrib/libc++/include/locale compares integers of different signs.
With our CXXFLAG settings, this causes "WITH_TESTS=1 make buildworld"
to fail while compiling libatf-c++, as I mentioned in another thread.
I've now written a minimal test case. Just #include locale and
compile it with the right settings.
$ cat use_locale.cpp
#include
$ c++ -Wsystem-headers -Werror -Wsign-compare -Wno-unused-parameter
-Wno-c++11-extensions -c -o use_locale.o use_locale.cpp
In file included from use_locale.cpp:1:
/usr/include/c++/v1/locale:1016:27: error: comparison of integers of different
signs: 'long' and 'size_type' (aka 'unsigned long')
[-Werror,-Wsign-compare]
if (__a_end - __a == __buf.size())
~ ^
/usr/include/c++/v1/locale:1066:27: error: comparison of integers of different
signs: 'long' and 'size_type' (aka 'unsigned long')
[-Werror,-Wsign-compare]
if (__a_end - __a == __buf.size())
~ ^
/usr/include/c++/v1/locale:1120:27: error: comparison of integers of different
signs: 'long' and 'size_type' (aka 'unsigned long')
[-Werror,-Wsign-compare]
if (__a_end - __a == __buf.size())
~ ^
3 errors generated.
The below patch fixes the problem, but I don't have the confidence to
change the system C++ library myself. Can somebody please review it?
Index: contrib/libc++/include/locale
===
--- contrib/libc++/include/locale (revision 261283)
+++ contrib/libc++/include/locale (working copy)
@@ -1012,7 +1012,7 @@
unsigned __dc = 0;
for (; __b != __e; ++__b)
{
-if (__a_end - __a == __buf.size())
+if ((size_t)(__a_end - __a) == __buf.size())
{
size_t __tmp = __buf.size();
__buf.resize(2*__buf.size());
@@ -1062,7 +1062,7 @@
unsigned __dc = 0;
for (; __b != __e; ++__b)
{
-if (__a_end - __a == __buf.size())
+if ((size_t)(__a_end - __a) == __buf.size())
{
size_t __tmp = __buf.size();
__buf.resize(2*__buf.size());
@@ -1116,7 +1116,7 @@
char __exp = 'E';
for (; __b != __e; ++__b)
{
-if (__a_end - __a == __buf.size())
+if ((size_t)(__a_end - __a) == __buf.size())
{
size_t __tmp = __buf.size();
__buf.resize(2*__buf.size());
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"