mirror of
https://github.com/apache/nuttx.git
synced 2026-05-12 01:42:49 +08:00
61a38ca680
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>
libs/libxx/README.txt
^^^^^^^^^^^^^^^^^^^^^
This directory contains three C++ library:
- A fragmentary C++ library that will allow to build only the simplest of
C++ applications. In the deeply embedded world, that is probably all
that is necessary.
At present, only the following are supported here:
- void *operator new(std::size_t nbytes);
- void operator delete(void* ptr);
- void operator delete[](void *ptr);
- void __cxa_pure_virtual(void);
- int __aeabi_atexit(void* object, void (*destroyer)(void*),
void *dso_handle);
- int __cxa_atexit(__cxa_exitfunc_t func, FAR void *arg,
FAR void *dso_handle);
This implementation is selected when neither of the following
two options are enabled.
- LLVM "libc++" C++ library (http://libcxx.llvm.org/)
This implementation is selected with CONFIG_LIBCXX=y.
- uClibc++ C++ library (http://cxx.uclibc.org/)
This implementation is selected with CONFIG_UCLIBCXX=y.
operator new
------------
This operator should take a type of size_t. But size_t has an unknown underlying
type. In the nuttx sys/types.h header file, size_t is typed as uint32_t
(which is determined by architecture-specific logic). But the C++
compiler may believe that size_t is of a different type resulting in
compilation errors in the operator. Using the underlying integer type
instead of size_t seems to resolve the compilation issues. Need to
REVISIT this.
Once some C++ compilers, this will cause an error:
Problem: "'operator new' takes size_t ('...') as first parameter"
Workaround: Add -fpermissive to the compilation flags