libs/libxx/libcxx: Fix compilation warnings

Summary
Workaround the following warning with "GCC 12"
CXX:  libcxxabi/src/cxa_demangle.cpp In file included from libcxx/src/locale.cpp:15:
In member function 'std::__1::_EnableIf<std::__1::__is_cpp17_forward_iterator<_ForwardIterator>::value> std::__1::basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = const wchar_t*; _CharT = wchar_t; _Traits = std::__1::char_traits<wchar_t>; _Allocator = std::__1::allocator<wchar_t>]',    inlined from 'std::__1::basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator, _InputIterator) [with _InputIterator = const wchar_t*; <template-parameter-2-2> = void; _CharT = wchar_t; _Traits = std::__1::char_traits<wchar_t>; _Allocator = std::__1::allocator<wchar_t>]' at include/libcxx/string:2182:11,
    inlined from 'virtual int std::__1::collate_byname<wchar_t>::do_compare(const char_type*, const char_type*, const char_type*, const char_type*) const' at libcxx/src/locale.cpp:764:33:
include/libcxx/string:2156:35: warning: 'lhs' may be used uninitialized [-Wmaybe-uninitialized]
 2156 |         this->__throw_length_error();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~

include/libcxx/new:237:24: warning: argument 1 value '18446744073709551599' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  237 |   return ::operator new(__args...);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~

Signed-off-by: wangming9 <wangming9@xiaomi.com>
This commit is contained in:
wangming9 2023-09-05 19:38:18 +08:00 committed by Petro Karashchenko
parent f05e72324c
commit 61a38ca680

View file

@ -90,6 +90,18 @@ endif
ifeq ($(GCCVER),12)
libcxx/src/filesystem/operations.cpp_CXXFLAGS += -Wno-maybe-uninitialized
libcxx/src/locale.cpp_CXXFLAGS += -Wno-maybe-uninitialized
endif
# Workaround the following warning with "GCC 12"
#
# ...
# include/libcxx/new:237:24: warning: argument 1 value '18446744073709551599' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
# 237 | return ::operator new(__args...);
# | ~~~~~~~~~~~~~~^~~~~~~~~~~
ifeq ($(GCCVER),12)
libcxx/src/string.cpp_CXXFLAGS += -Wno-alloc-size-larger-than
endif
# The following warning was observed with icicle:knsh config.