From a815fbdf6f89a8b2197692c826efbb52976ae826 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Mon, 10 Jan 2022 11:37:07 +0100 Subject: [PATCH 1/2] Revert "change include directives to use double quotes" This does not seem to be a complete and proper fix for the conflict between uclibc++ new/delete and the ones defined by the AVR core, since it only fixes conflicts in the header files, but source files might still produce linker errors. So better revert it and stay closer to upstream uclibc++ sources. This reverts commit 84b4a911b8228bf3dfb4133f3992ddad36366a3a. --- src/ArduinoSTL.cpp | 2 +- src/ArduinoSTL.h | 2 +- src/abi/abi.cpp | 6 +++--- src/algorithm | 8 ++++---- src/algorithm.cpp | 2 +- src/array | 4 ++-- src/associative_base | 10 +++++----- src/associative_base.cpp | 2 +- src/basic_definitions | 2 +- src/bitset | 12 ++++++------ src/bitset.cpp | 2 +- src/char_traits | 10 +++++----- src/char_traits.cpp | 4 ++-- src/complex | 4 ++-- src/complex.cpp | 2 +- src/cstdio | 2 +- src/cstdlib | 2 +- src/cstring | 2 +- src/ctime | 2 +- src/cwchar | 2 +- src/del_opnt.cpp | 6 +++--- src/del_ops.cpp | 6 +++--- src/del_opvnt.cpp | 6 +++--- src/del_opvs.cpp | 6 +++--- src/deque | 6 +++--- src/deque.cpp | 2 +- src/eh_alloc.cpp | 8 ++++---- src/eh_globals.cpp | 8 ++++---- src/exception | 2 +- src/exception.cpp | 2 +- src/func_exception | 4 ++-- src/func_exception.cpp | 8 ++++---- src/functional | 2 +- src/iomanip | 4 ++-- src/iomanip.cpp | 2 +- src/ios | 8 ++++---- src/ios.cpp | 8 ++++---- src/iosfwd | 6 +++--- src/iostream | 12 ++++++------ src/iostream.cpp | 2 +- src/istream | 10 +++++----- src/istream.cpp | 2 +- src/istream_helpers | 6 +++--- src/iterator | 10 +++++----- src/iterator.cpp | 2 +- src/iterator_base | 2 +- src/limits | 2 +- src/limits.cpp | 2 +- src/list | 8 ++++---- src/list.cpp | 2 +- src/locale | 6 +++--- src/locale.cpp | 10 +++++----- src/map | 10 +++++----- src/map.cpp | 2 +- src/memory | 12 ++++++------ src/new | 6 +++--- src/new_handler.cpp | 2 +- src/new_opnt.cpp | 6 +++--- src/new_opvnt.cpp | 6 +++--- src/numeric | 4 ++-- src/numeric.cpp | 2 +- src/ostream | 10 +++++----- src/ostream.cpp | 2 +- src/ostream_helpers | 10 +++++----- src/ostream_helpers.cpp | 2 +- src/queue | 8 ++++---- src/queue.cpp | 2 +- src/serstream | 12 ++++++------ src/set | 12 ++++++------ src/set.cpp | 2 +- src/sstream | 14 +++++++------- src/sstream.cpp | 2 +- src/stack | 4 ++-- src/stack.cpp | 2 +- src/stdexcept | 6 +++--- src/stdexcept.cpp | 4 ++-- src/streambuf | 10 +++++----- src/streambuf.cpp | 2 +- src/string | 14 +++++++------- src/string.cpp | 10 +++++----- src/string_iostream | 10 +++++----- src/support | 6 +++--- src/support.cpp | 2 +- src/type_traits | 8 ++++---- src/typeinfo | 2 +- src/typeinfo.cpp | 2 +- src/unwind-cxx.h | 7 +++---- src/utility | 2 +- src/utility.cpp | 2 +- src/valarray | 6 +++--- src/valarray.cpp | 2 +- src/vector | 14 +++++++------- src/vector.cpp | 2 +- 93 files changed, 247 insertions(+), 248 deletions(-) diff --git a/src/ArduinoSTL.cpp b/src/ArduinoSTL.cpp index 4208aa6e..6d321070 100644 --- a/src/ArduinoSTL.cpp +++ b/src/ArduinoSTL.cpp @@ -1,4 +1,4 @@ -#include "ArduinoSTL.h" +#include #include // diff --git a/src/ArduinoSTL.h b/src/ArduinoSTL.h index d692afa4..35a5ade7 100644 --- a/src/ArduinoSTL.h +++ b/src/ArduinoSTL.h @@ -10,7 +10,7 @@ #define ARDUINOSTL_M_H #include -#include "serstream" +#include // Create cout and cin.. there doesn't seem to be a way // to control what serial device at runtime. Grr. diff --git a/src/abi/abi.cpp b/src/abi/abi.cpp index 94f966c2..ecc20482 100644 --- a/src/abi/abi.cpp +++ b/src/abi/abi.cpp @@ -17,9 +17,9 @@ USA. */ -#include "cstdlib" -#include "typeinfo" -#include "basic_definitions" +#include +#include +#include /* This file implements a number of the language support features * needed to deal with the C++ abi, as originally documented in the diff --git a/src/algorithm b/src/algorithm index 1e981d7f..52403494 100644 --- a/src/algorithm +++ b/src/algorithm @@ -15,10 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "cstdlib" -#include "iterator" -#include "utility" -#include "functional" +#include +#include +#include +#include #ifndef __STD_HEADER_ALGORITHM #define __STD_HEADER_ALGORITHM 1 diff --git a/src/algorithm.cpp b/src/algorithm.cpp index 74ba15c2..e21b14e3 100644 --- a/src/algorithm.cpp +++ b/src/algorithm.cpp @@ -18,7 +18,7 @@ */ -#include "algorithm" +#include namespace std{ diff --git a/src/array b/src/array index ce4ab00b..094ecf91 100644 --- a/src/array +++ b/src/array @@ -1,8 +1,8 @@ #ifndef __ARRAY__ #define __ARRAY__ -#include "cstddef" -#include "initializer_list" +#include +#include namespace std { diff --git a/src/associative_base b/src/associative_base index 280576bb..be8b27f6 100644 --- a/src/associative_base +++ b/src/associative_base @@ -18,11 +18,11 @@ -#include "memory" -#include "utility" -#include "iterator" -#include "functional" -#include "list" +#include +#include +#include +#include +#include #ifndef __STD_HEADER_ASSOCIATIVE_BASE diff --git a/src/associative_base.cpp b/src/associative_base.cpp index 583ae469..cc2d20e5 100644 --- a/src/associative_base.cpp +++ b/src/associative_base.cpp @@ -17,7 +17,7 @@ */ -#include "associative_base" +#include namespace std{ diff --git a/src/basic_definitions b/src/basic_definitions index 46b1d9fa..9936563e 100644 --- a/src/basic_definitions +++ b/src/basic_definitions @@ -18,7 +18,7 @@ #ifndef __BASIC_DEFINITIONS #define __BASIC_DEFINITIONS 1 -#include "system_configuration.h" +#include #pragma GCC visibility push(default) diff --git a/src/bitset b/src/bitset index 2b40af85..41c779f8 100644 --- a/src/bitset +++ b/src/bitset @@ -17,12 +17,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "cstddef" -#include "climits" -#include "func_exception" -#include "string" -#include "iosfwd" +#include +#include +#include +#include +#include +#include #ifndef __STD_BITSET_HEADER #define __STD_BITSET_HEADER 1 diff --git a/src/bitset.cpp b/src/bitset.cpp index acd881b9..f1ece31f 100644 --- a/src/bitset.cpp +++ b/src/bitset.cpp @@ -17,7 +17,7 @@ */ -#include "bitset" +#include namespace std{ diff --git a/src/char_traits b/src/char_traits index 5e23566a..1d33f394 100644 --- a/src/char_traits +++ b/src/char_traits @@ -16,14 +16,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" +#include #include -#include "exception" -#include "memory" +#include +#include #ifdef __UCLIBCXX_HAS_WCHAR__ -#include "cwchar" -#include "cwctype" +#include +#include #endif #ifndef __HEADER_CHAR_TRAITS diff --git a/src/char_traits.cpp b/src/char_traits.cpp index e5030ad6..2a91bd97 100644 --- a/src/char_traits.cpp +++ b/src/char_traits.cpp @@ -21,8 +21,8 @@ #define __UCLIBCXX_COMPILE_CHAR_TRAITS__ 1 -#include "basic_definitions" -#include "char_traits" +#include +#include namespace std{ diff --git a/src/complex b/src/complex index b737180b..61e489ed 100644 --- a/src/complex +++ b/src/complex @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "istream" -#include "ostream" +#include +#include #ifndef __STD_HEADER_COMPLEX #define __STD_HEADER_COMPLEX 1 diff --git a/src/complex.cpp b/src/complex.cpp index 764b0c28..6b895a88 100644 --- a/src/complex.cpp +++ b/src/complex.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "complex" +#include namespace std{ diff --git a/src/cstdio b/src/cstdio index 14a32d22..0a424580 100644 --- a/src/cstdio +++ b/src/cstdio @@ -16,7 +16,7 @@ */ #include -#include "basic_definitions" +#include #ifndef __HEADER_CSTDIO #define __HEADER_CSTDIO 1 diff --git a/src/cstdlib b/src/cstdlib index 01148242..e45261aa 100644 --- a/src/cstdlib +++ b/src/cstdlib @@ -17,7 +17,7 @@ */ #include -#include "basic_definitions" +#include #ifndef __HEADER_CSTDLIB #define __HEADER_CSTDLIB 1 diff --git a/src/cstring b/src/cstring index e40c11dd..de8589b3 100644 --- a/src/cstring +++ b/src/cstring @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "cstddef" +#include #include #ifndef __HEADER_CSTRING diff --git a/src/ctime b/src/ctime index 136d71be..1b4c09b7 100644 --- a/src/ctime +++ b/src/ctime @@ -46,7 +46,7 @@ #pragma GCC system_header -#include "cstddef" +#include #include diff --git a/src/cwchar b/src/cwchar index 6a851e4e..03fae09d 100644 --- a/src/cwchar +++ b/src/cwchar @@ -16,7 +16,7 @@ */ #include -#include "basic_definitions" +#include #ifndef __HEADER_CWCHAR #define __HEADER_CWCHAR 1 diff --git a/src/del_opnt.cpp b/src/del_opnt.cpp index 292b17e3..48259129 100644 --- a/src/del_opnt.cpp +++ b/src/del_opnt.cpp @@ -17,9 +17,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "new" -#include "cstdlib" -#include "func_exception" +#include +#include +#include #ifndef NO_NOTHROW _UCXXEXPORT void operator delete(void* ptr, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT { diff --git a/src/del_ops.cpp b/src/del_ops.cpp index fa93c2fa..b914fc59 100644 --- a/src/del_ops.cpp +++ b/src/del_ops.cpp @@ -18,9 +18,9 @@ */ /* C++14 sized deallocation */ -#include "new" -#include "cstdlib" -#include "func_exception" +#include +#include +#include _UCXXEXPORT void operator delete(void* ptr, std::size_t) _UCXX_USE_NOEXCEPT{ ::operator delete (ptr); diff --git a/src/del_opvnt.cpp b/src/del_opvnt.cpp index b49aa6d6..71b7631b 100644 --- a/src/del_opvnt.cpp +++ b/src/del_opvnt.cpp @@ -17,9 +17,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "new" -#include "cstdlib" -#include "func_exception" +#include +#include +#include #ifndef NO_NOTHROW _UCXXEXPORT void operator delete[](void* ptr, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT{ diff --git a/src/del_opvs.cpp b/src/del_opvs.cpp index e5f02d86..53ab7cc9 100644 --- a/src/del_opvs.cpp +++ b/src/del_opvs.cpp @@ -18,9 +18,9 @@ */ /* C++14 sized deallocation */ -#include "new" -#include "cstdlib" -#include "func_exception" +#include +#include +#include _UCXXEXPORT void operator delete[](void * ptr, std::size_t) _UCXX_USE_NOEXCEPT{ ::operator delete[] (ptr); diff --git a/src/deque b/src/deque index 80dd94b1..ff07ab51 100644 --- a/src/deque +++ b/src/deque @@ -17,9 +17,9 @@ */ -#include "memory" -#include "iterator" -#include "stdexcept" +#include +#include +#include #pragma GCC visibility push(default) diff --git a/src/deque.cpp b/src/deque.cpp index 2842a834..c5155808 100644 --- a/src/deque.cpp +++ b/src/deque.cpp @@ -17,7 +17,7 @@ */ -#include "deque" +#include namespace std{ diff --git a/src/eh_alloc.cpp b/src/eh_alloc.cpp index 638c6cb8..270ef10b 100644 --- a/src/eh_alloc.cpp +++ b/src/eh_alloc.cpp @@ -17,12 +17,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "cstdlib" -#include "cstring" -#include "func_exception" +#include +#include +#include //This is a system-specific header which does all of the error-handling management -#include "unwind-cxx.h" +#include namespace __cxxabiv1 { diff --git a/src/eh_globals.cpp b/src/eh_globals.cpp index aa81cfe1..99154331 100644 --- a/src/eh_globals.cpp +++ b/src/eh_globals.cpp @@ -17,12 +17,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "cstdlib" -#include "cstring" -#include "func_exception" +#include +#include +#include //This is a system-specific header which does all of the error-handling management -#include "unwind-cxx.h" +#include //The following functionality is derived from reading of the GNU libstdc++ code and making it...simple diff --git a/src/exception b/src/exception index e1a8f826..0cccc9cb 100644 --- a/src/exception +++ b/src/exception @@ -37,7 +37,7 @@ #ifndef __EXCEPTION__ #define __EXCEPTION__ -#include "basic_definitions" +#include extern "C++" { diff --git a/src/exception.cpp b/src/exception.cpp index 2fe30237..5f4e8962 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -18,7 +18,7 @@ */ -#include "exception" +#include //We can't do this yet because gcc is too stupid to be able to handle //different implementations of exception class. diff --git a/src/func_exception b/src/func_exception index 9d525d4c..1b7bdd8c 100644 --- a/src/func_exception +++ b/src/func_exception @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "exception" +#include +#include #ifndef HEADER_IMPLEMENTATION_FUNC_EXCEPTION diff --git a/src/func_exception.cpp b/src/func_exception.cpp index c295ba35..fab095f3 100644 --- a/src/func_exception.cpp +++ b/src/func_exception.cpp @@ -17,10 +17,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "exception" -#include "func_exception" -#include "stdexcept" -#include "cstdlib" +#include +#include +#include +#include namespace std{ diff --git a/src/functional b/src/functional index 69b20f51..ae9ed4b8 100644 --- a/src/functional +++ b/src/functional @@ -19,7 +19,7 @@ #ifndef __STD_HEADER_FUNCTIONAL #define __STD_HEADER_FUNCTIONAL 1 -#include "basic_definitions" +#include #pragma GCC visibility push(default) diff --git a/src/iomanip b/src/iomanip index f455773f..14a82607 100644 --- a/src/iomanip +++ b/src/iomanip @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "exception" -#include "ios" +#include +#include #ifndef __STD_IOMANIP #define __STD_IOMANIP 1 diff --git a/src/iomanip.cpp b/src/iomanip.cpp index c35d2563..c5e60cce 100644 --- a/src/iomanip.cpp +++ b/src/iomanip.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "iomanip" +#include namespace std{ diff --git a/src/ios b/src/ios index 506f55eb..ac6566a5 100644 --- a/src/ios +++ b/src/ios @@ -17,10 +17,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "cstddef" -#include "locale" -#include "iosfwd" +#include +#include +#include +#include #ifndef __HEADER_STD_IOS #define __HEADER_STD_IOS 1 diff --git a/src/ios.cpp b/src/ios.cpp index 10d19b75..6d83cefd 100644 --- a/src/ios.cpp +++ b/src/ios.cpp @@ -19,10 +19,10 @@ #define __UCLIBCXX_COMPILE_IOS__ 1 -#include "ios" -#include "ostream" -#include "istream" -#include "cstdio" +#include +#include +#include +#include namespace std{ diff --git a/src/iosfwd b/src/iosfwd index ff013356..2c14725e 100644 --- a/src/iosfwd +++ b/src/iosfwd @@ -17,9 +17,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "char_traits" -#include "memory" +#include +#include +#include #ifndef __HEADER_STD_IOSFWD diff --git a/src/iostream b/src/iostream index e95447b7..64b5f06f 100644 --- a/src/iostream +++ b/src/iostream @@ -17,16 +17,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" +#include #ifndef __HEADER_STD_IOSTREAM #define __HEADER_STD_IOSTREAM 1 -#include "iosfwd" -#include "ios" -#include "istream" -#include "ostream" -#include "string_iostream" +#include +#include +#include +#include +#include #pragma GCC visibility push(default) diff --git a/src/iostream.cpp b/src/iostream.cpp index a7e32666..7a190a2b 100644 --- a/src/iostream.cpp +++ b/src/iostream.cpp @@ -19,7 +19,7 @@ #define __UCLIBCXX_COMPILE_IOSTREAM__ 1 -#include "iostream" +#include namespace std{ diff --git a/src/istream b/src/istream index 1ad7dc2a..2d58abd9 100644 --- a/src/istream +++ b/src/istream @@ -17,11 +17,11 @@ USA. */ -#include "ios" -#include "cctype" -#include "streambuf" -#include "istream_helpers" -#include "ostream" +#include +#include +#include +#include +#include #ifndef __STD_HEADER_ISTREAM #define __STD_HEADER_ISTREAM 1 diff --git a/src/istream.cpp b/src/istream.cpp index 81feed3f..9e961397 100644 --- a/src/istream.cpp +++ b/src/istream.cpp @@ -20,7 +20,7 @@ #define __UCLIBCXX_COMPILE_ISTREAM__ 1 -#include "istream" +#include namespace std{ diff --git a/src/istream_helpers b/src/istream_helpers index c3fdf1c1..cb40e85a 100644 --- a/src/istream_helpers +++ b/src/istream_helpers @@ -17,10 +17,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ios" -#include "cctype" +#include +#include -#include "string" +#include #ifndef __STD_HEADER_ISTREAM_HELPERS #define __STD_HEADER_ISTREAM_HELPERS 1 diff --git a/src/iterator b/src/iterator index 2c8e3124..2edca406 100644 --- a/src/iterator +++ b/src/iterator @@ -17,11 +17,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "iosfwd" -#include "cstddef" -#include "char_traits" -#include "iterator_base" +#include +#include +#include +#include +#include diff --git a/src/iterator.cpp b/src/iterator.cpp index 517a1d2f..2e21517a 100644 --- a/src/iterator.cpp +++ b/src/iterator.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "iterator" +#include namespace std{ diff --git a/src/iterator_base b/src/iterator_base index 32855961..e112a7f3 100644 --- a/src/iterator_base +++ b/src/iterator_base @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" +#include #ifndef __STD_HEADER_ITERATOR_BASE #define __STD_HEADER_ITERATOR_BASE 1 diff --git a/src/limits b/src/limits index 4747f82b..e275eb5e 100644 --- a/src/limits +++ b/src/limits @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "climits" +#include #ifndef __STD_HEADER_LIMITS #define __STD_HEADER_LIMITS 1 diff --git a/src/limits.cpp b/src/limits.cpp index 7f0f226e..0fd42d57 100644 --- a/src/limits.cpp +++ b/src/limits.cpp @@ -17,7 +17,7 @@ */ -#include "limits" +#include namespace std{ diff --git a/src/list b/src/list index 166aae86..bfe7e9ae 100644 --- a/src/list +++ b/src/list @@ -17,10 +17,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "memory" -#include "iterator" -#include "algorithm" -#include "initializer_list" +#include +#include +#include +#include #ifndef __STD_HEADER_LIST #define __STD_HEADER_LIST 1 diff --git a/src/list.cpp b/src/list.cpp index 716d8398..cfc44e07 100644 --- a/src/list.cpp +++ b/src/list.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "list" +#include namespace std{ diff --git a/src/locale b/src/locale index cb2ec144..ed4dfa36 100644 --- a/src/locale +++ b/src/locale @@ -17,9 +17,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "cstddef" -#include "string" +#include +#include +#include #ifndef __HEADER_STD_LOCALE #define __HEADER_STD_LOCALE 1 diff --git a/src/locale.cpp b/src/locale.cpp index bca1e20e..bc41792d 100644 --- a/src/locale.cpp +++ b/src/locale.cpp @@ -17,11 +17,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "locale" -#include "cstring" -#include "string" -#include "stdexcept" -#include "cctype" +#include +#include +#include +#include +#include namespace std{ diff --git a/src/map b/src/map index 2809ec99..44be7108 100644 --- a/src/map +++ b/src/map @@ -18,11 +18,11 @@ -#include "memory" -#include "utility" -#include "iterator" -#include "associative_base" -#include "initializer_list" +#include +#include +#include +#include +#include #ifndef __STD_HEADER_MAP diff --git a/src/map.cpp b/src/map.cpp index 7fd96bd9..06e56a0b 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -17,7 +17,7 @@ */ -#include "map" +#include namespace std{ diff --git a/src/memory b/src/memory index 2ce07e46..37ac637e 100644 --- a/src/memory +++ b/src/memory @@ -17,12 +17,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "new" -#include "cstddef" -#include "cstdlib" -#include "iterator_base" -#include "utility" -#include "cstdio" +#include +#include +#include +#include +#include +#include #ifndef HEADER_STD_MEMORY #define HEADER_STD_MEMORY 1 diff --git a/src/new b/src/new index 63fc8eda..1dc33a47 100644 --- a/src/new +++ b/src/new @@ -17,9 +17,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "exception" -#include "cstddef" +#include +#include +#include #ifndef __STD_NEW_OPERATOR #define __STD_NEW_OPERATOR 1 diff --git a/src/new_handler.cpp b/src/new_handler.cpp index 29615985..a6efb9cb 100644 --- a/src/new_handler.cpp +++ b/src/new_handler.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "new" +#include const std::nothrow_t std::nothrow = { }; diff --git a/src/new_opnt.cpp b/src/new_opnt.cpp index 3179663e..c37903e0 100644 --- a/src/new_opnt.cpp +++ b/src/new_opnt.cpp @@ -17,9 +17,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "new" -#include "cstdlib" -#include "func_exception" +#include +#include +#include #ifndef NO_NOTHROW _UCXXEXPORT void* operator new(std::size_t numBytes, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT{ diff --git a/src/new_opvnt.cpp b/src/new_opvnt.cpp index a4013f48..4874a7f6 100644 --- a/src/new_opvnt.cpp +++ b/src/new_opvnt.cpp @@ -17,9 +17,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "new" -#include "cstdlib" -#include "func_exception" +#include +#include +#include #ifndef NO_NOTHROW _UCXXEXPORT void* operator new[](std::size_t numBytes, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT{ diff --git a/src/numeric b/src/numeric index c980eed5..25d1b274 100644 --- a/src/numeric +++ b/src/numeric @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "exception" +#include +#include #ifndef __STD_NUMERIC_HEADER #define __STD_NUMERIC_HEADER 1 diff --git a/src/numeric.cpp b/src/numeric.cpp index aa6b8bde..eb93f2eb 100644 --- a/src/numeric.cpp +++ b/src/numeric.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "numeric" +#include namespace std{ diff --git a/src/ostream b/src/ostream index a5dd3c5c..30725898 100644 --- a/src/ostream +++ b/src/ostream @@ -17,15 +17,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" +#include #ifndef STD_HEADER_OSTREAM #define STD_HEADER_OSTREAM 1 -#include "iosfwd" -#include "streambuf" -#include "cstdio" -#include "ostream_helpers" +#include +#include +#include +#include #pragma GCC visibility push(default) diff --git a/src/ostream.cpp b/src/ostream.cpp index 62047692..0973871b 100644 --- a/src/ostream.cpp +++ b/src/ostream.cpp @@ -19,7 +19,7 @@ #define __UCLIBCXX_COMPILE_OSTREAM__ 1 -#include "ostream" +#include namespace std{ diff --git a/src/ostream_helpers b/src/ostream_helpers index 66b74f90..cbff3c48 100644 --- a/src/ostream_helpers +++ b/src/ostream_helpers @@ -18,11 +18,11 @@ */ #include -#include "basic_definitions" -#include "cstddef" -#include "ios" -#include "cctype" -#include "string" +#include +#include +#include +#include +#include #include // for floor() #ifndef __STD_HEADER_OSTREAM_HELPERS diff --git a/src/ostream_helpers.cpp b/src/ostream_helpers.cpp index 68499f0b..004ce6f1 100644 --- a/src/ostream_helpers.cpp +++ b/src/ostream_helpers.cpp @@ -6,7 +6,7 @@ * */ -#include "ostream_helpers" +#include #include namespace std { diff --git a/src/queue b/src/queue index 26f17817..b817b1df 100644 --- a/src/queue +++ b/src/queue @@ -15,10 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "deque" -#include "vector" -#include "functional" +#include +#include +#include +#include #ifndef __HEADER_STD_QUEUE #define __HEADER_STD_QUEUE 1 diff --git a/src/queue.cpp b/src/queue.cpp index 99eaedea..356efeb1 100644 --- a/src/queue.cpp +++ b/src/queue.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "queue" +#include namespace std{ diff --git a/src/serstream b/src/serstream index a09a727d..b6eb7bda 100644 --- a/src/serstream +++ b/src/serstream @@ -43,13 +43,13 @@ #ifndef __810370EC_AD69_4ef7_91F5_B1AA16F14712 #define __810370EC_AD69_4ef7_91F5_B1AA16F14712 -#include "basic_definitions" +#include -#include "iosfwd" -#include "ios" -#include "istream" -#include "ostream" -#include "iostream" +#include +#include +#include +#include +#include #include namespace std diff --git a/src/set b/src/set index 3da7af1e..f376e470 100644 --- a/src/set +++ b/src/set @@ -18,12 +18,12 @@ -#include "memory" -#include "utility" -#include "iterator" -#include "deque" -#include "functional" -#include "associative_base" +#include +#include +#include +#include +#include +#include #ifndef __STD_HEADER_SET #define __STD_HEADER_SET diff --git a/src/set.cpp b/src/set.cpp index 251de506..61ec56a7 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -17,7 +17,7 @@ */ -#include "set" +#include namespace std{ diff --git a/src/sstream b/src/sstream index f419c641..29698537 100644 --- a/src/sstream +++ b/src/sstream @@ -17,17 +17,17 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" +#include #ifndef HEADER_STD_SSTREAM #define HEADER_STD_SSTREAM 1 -#include "iosfwd" -#include "ios" -#include "istream" -#include "ostream" -#include "iostream" -#include "string" +#include +#include +#include +#include +#include +#include #pragma GCC visibility push(default) diff --git a/src/sstream.cpp b/src/sstream.cpp index c8c30d43..e712b676 100644 --- a/src/sstream.cpp +++ b/src/sstream.cpp @@ -19,7 +19,7 @@ #define __UCLIBCXX_COMPILE_SSTREAM__ 1 -#include "sstream" +#include namespace std{ diff --git a/src/stack b/src/stack index 724b7ea3..ea697f18 100644 --- a/src/stack +++ b/src/stack @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "deque" +#include +#include #ifndef __HEADER_STD_STACK #define __HEADER_STD_STACK 1 diff --git a/src/stack.cpp b/src/stack.cpp index 4e37ba0d..53a21bba 100644 --- a/src/stack.cpp +++ b/src/stack.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "stack" +#include namespace std{ diff --git a/src/stdexcept b/src/stdexcept index 8a975c2a..76c38706 100644 --- a/src/stdexcept +++ b/src/stdexcept @@ -17,9 +17,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "exception" -#include "string" +#include +#include +#include #ifndef HEADER_STD_EXCEPTIONS #define HEADER_STD_EXCEPTIONS 1 diff --git a/src/stdexcept.cpp b/src/stdexcept.cpp index a8e7cedd..b812b6f7 100644 --- a/src/stdexcept.cpp +++ b/src/stdexcept.cpp @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "exception" -#include "stdexcept" +#include +#include #ifdef __UCLIBCXX_EXCEPTION_SUPPORT__ diff --git a/src/streambuf b/src/streambuf index b2481ca0..0daa388f 100644 --- a/src/streambuf +++ b/src/streambuf @@ -17,15 +17,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "locale" -#include "string" -#include "iosfwd" +#include +#include +#include +#include #ifndef HEADER_STD_STREAMBUF #define HEADER_STD_STREAMBUF 1 -#include "ios" +#include #pragma GCC visibility push(default) diff --git a/src/streambuf.cpp b/src/streambuf.cpp index 1647b602..54173245 100644 --- a/src/streambuf.cpp +++ b/src/streambuf.cpp @@ -19,7 +19,7 @@ #define __UCLIBCXX_COMPILE_STREAMBUF__ 1 -#include "streambuf" +#include namespace std{ diff --git a/src/string b/src/string index 17b3c14c..d3ad2e1d 100644 --- a/src/string +++ b/src/string @@ -17,17 +17,17 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" -#include "char_traits" +#include +#include #include -#include "func_exception" -#include "memory" -#include "vector" +#include +#include +#include #ifdef __UCLIBCXX_HAS_WCHAR__ -#include "cwchar" -#include "cwctype" +#include +#include #endif #ifndef __HEADER_STD_STRING diff --git a/src/string.cpp b/src/string.cpp index 73c3eb6b..1edf69b5 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -19,12 +19,12 @@ #define __UCLIBCXX_COMPILE_STRING__ 1 -#include "basic_definitions" -#include "char_traits" -#include "string" -#include "string_iostream" +#include +#include +#include +#include #include -#include "ostream" +#include namespace std{ diff --git a/src/string_iostream b/src/string_iostream index ebbe65d9..355fd58a 100644 --- a/src/string_iostream +++ b/src/string_iostream @@ -17,13 +17,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "istream" -#include "ostream" -#include "string" +#include +#include +#include #ifdef __UCLIBCXX_HAS_WCHAR__ -#include "cwchar" -#include "cwctype" +#include +#include #endif #ifndef __HEADER_STD_STRING_IOSTREAM diff --git a/src/support b/src/support index 1c06faf8..9279987a 100644 --- a/src/support +++ b/src/support @@ -17,9 +17,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "exception" -#include "cstdlib" -#include "typeinfo" +#include +#include +#include #ifndef HEADER_ULC_SUPPORT #define HEADER_ULC_SUPPORT 1 diff --git a/src/support.cpp b/src/support.cpp index 24989e17..1ec02645 100644 --- a/src/support.cpp +++ b/src/support.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "support" +#include /*extern "C" void *__cxa_allocate_exception(size_t thrown_size){ void * retval; diff --git a/src/type_traits b/src/type_traits index b97950f1..fa1de40c 100644 --- a/src/type_traits +++ b/src/type_traits @@ -16,11 +16,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" +#include #include -#include "exception" -#include "memory" -#include "char_traits" +#include +#include +#include #ifndef __HEADER_TYPE_TRAITS #define __HEADER_TYPE_TRAITS 1 diff --git a/src/typeinfo b/src/typeinfo index a8943911..7863af27 100644 --- a/src/typeinfo +++ b/src/typeinfo @@ -35,7 +35,7 @@ #ifndef __TYPEINFO__ #define __TYPEINFO__ -#include "exception" +#include extern "C++" { diff --git a/src/typeinfo.cpp b/src/typeinfo.cpp index 1c3bc751..c9f9d23f 100644 --- a/src/typeinfo.cpp +++ b/src/typeinfo.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "typeinfo" +#include namespace std{ diff --git a/src/unwind-cxx.h b/src/unwind-cxx.h index 8d562a80..660d3c3f 100644 --- a/src/unwind-cxx.h +++ b/src/unwind-cxx.h @@ -1,4 +1,3 @@ -// -*- C++ -*- Exception handling and frame unwind runtime interface routines. // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of GCC. @@ -35,9 +34,9 @@ // Level 2: C++ ABI -#include "typeinfo" -#include "exception" -#include "cstddef" +#include +#include +#include #include "unwind.h" #ifdef __aarch64__ diff --git a/src/utility b/src/utility index 8e7081d6..0da354e2 100644 --- a/src/utility +++ b/src/utility @@ -18,7 +18,7 @@ */ -#include "basic_definitions" +#include #ifndef __STD_HEADER_UTILITY diff --git a/src/utility.cpp b/src/utility.cpp index 6b792a68..b2f8995d 100644 --- a/src/utility.cpp +++ b/src/utility.cpp @@ -18,7 +18,7 @@ */ -#include "utility" +#include namespace std{ diff --git a/src/valarray b/src/valarray index 316c90ef..09d929c4 100644 --- a/src/valarray +++ b/src/valarray @@ -17,13 +17,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "basic_definitions" +#include #ifndef __HEADER_STD_VALARRAY #define __HEADER_STD_VALARRAY 1 -#include "cstddef" -#include "cmath" +#include +#include #pragma GCC visibility push(default) diff --git a/src/valarray.cpp b/src/valarray.cpp index c0c2c1a8..e4bd504c 100644 --- a/src/valarray.cpp +++ b/src/valarray.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "valarray" +#include namespace std{ diff --git a/src/vector b/src/vector index 3b0aaf86..4e4d498d 100644 --- a/src/vector +++ b/src/vector @@ -18,13 +18,13 @@ */ -#include "basic_definitions" -#include "memory" -#include "iterator" -#include "func_exception" -#include "algorithm" -#include "type_traits" -#include "initializer_list" +#include +#include +#include +#include +#include +#include +#include #ifndef __STD_HEADER_VECTOR #define __STD_HEADER_VECTOR diff --git a/src/vector.cpp b/src/vector.cpp index 224d0cbd..5ee0de18 100644 --- a/src/vector.cpp +++ b/src/vector.cpp @@ -20,7 +20,7 @@ #define __UCLIBCXX_COMPILE_VECTOR__ 1 -#include "vector" +#include namespace std{ From 7e5274f3af558d5f6009f200795830d47a7156ef Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Mon, 10 Jan 2022 12:30:32 +0100 Subject: [PATCH 2/2] fix: Only define new/del when AVR core does not provide Since AVR core 1.8.3, it provides an (incomplete) new header that breaks compilation of the uclibc++ new/delete .cpp files. Since 1.8.4 it provides a complete new header, but that also introduces a linker duplicate symbol issue for std::nothrow. This commit adds a USING_NEW_FROM_UCLIBC define to our new include file, which allows detecting which version of the new include is used. That define is used to completely skip all new/delete code (all new_*.cpp and del_*.cpp files) when the new header from the AVR-core is used. This should fix all conflicts, except: - On AVR core 1.8.3, new/delete is now incomplete. However, the missing functions (array placement new, placement delete, nothrow versions and delete with size) are probably not commonly used. - If another library *also* offers , then things might break in different ways. Again, this is a rare corner case. - This no longer provides set_new_handler, which the AVR core declares but does not define. However, since the uclibc++ version did not actually *use* the handler passed, not defining it is probably better. --- src/del_op.cpp | 7 ++----- src/del_opnt.cpp | 4 ++-- src/del_ops.cpp | 2 ++ src/del_opv.cpp | 7 ++----- src/del_opvnt.cpp | 4 ++-- src/del_opvs.cpp | 2 ++ src/new | 2 ++ src/new_handler.cpp | 2 ++ src/new_op.cpp | 7 ++----- src/new_opnt.cpp | 4 ++-- src/new_opv.cpp | 6 ++---- src/new_opvnt.cpp | 4 ++-- 12 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/del_op.cpp b/src/del_op.cpp index 588743da..17ba4954 100644 --- a/src/del_op.cpp +++ b/src/del_op.cpp @@ -17,15 +17,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// Arduino 1.0 contains an implementation for this. -#if ARDUINO < 100 - #include #include #include +#if defined(USING_NEW_FROM_UCLIBC) && ARDUINO < 100 _UCXXEXPORT void operator delete(void* ptr) _UCXX_USE_NOEXCEPT{ free(ptr); } - -#endif +#endif // defined(USING_NEW_FROM_UCLIBC) && ARDUINO < 100 diff --git a/src/del_opnt.cpp b/src/del_opnt.cpp index 48259129..40cdcb39 100644 --- a/src/del_opnt.cpp +++ b/src/del_opnt.cpp @@ -21,8 +21,8 @@ #include #include -#ifndef NO_NOTHROW +#if defined(USING_NEW_FROM_UCLIBC) && !defined(NO_NOTHROW) _UCXXEXPORT void operator delete(void* ptr, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT { free(ptr); } -#endif +#endif // defined(USING_NEW_FROM_UCLIBC) && !defined(NO_NOTHROW) diff --git a/src/del_ops.cpp b/src/del_ops.cpp index b914fc59..c51cdb9a 100644 --- a/src/del_ops.cpp +++ b/src/del_ops.cpp @@ -22,6 +22,8 @@ #include #include +#if defined(USING_NEW_FROM_UCLIBC) _UCXXEXPORT void operator delete(void* ptr, std::size_t) _UCXX_USE_NOEXCEPT{ ::operator delete (ptr); } +#endif // defined(USING_NEW_FROM_UCLIBC) diff --git a/src/del_opv.cpp b/src/del_opv.cpp index a24c72d1..3bf10aa1 100644 --- a/src/del_opv.cpp +++ b/src/del_opv.cpp @@ -17,9 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// Arduino 1.0 contains an implementation for this. -#if ARDUINO < 100 - +#if defined(USING_NEW_FROM_UCLIBC) && ARDUINO < 100 #include #include #include @@ -27,5 +25,4 @@ _UCXXEXPORT void operator delete[](void * ptr) _UCXX_USE_NOEXCEPT{ free(ptr); } - -#endif +#endif // defined(USING_NEW_FROM_UCLIBC) && ARDUINO < 100 diff --git a/src/del_opvnt.cpp b/src/del_opvnt.cpp index 71b7631b..d12dcea5 100644 --- a/src/del_opvnt.cpp +++ b/src/del_opvnt.cpp @@ -21,8 +21,8 @@ #include #include -#ifndef NO_NOTHROW +#if defined(USING_NEW_FROM_UCLIBC) && !defined(NO_NOTHROW) _UCXXEXPORT void operator delete[](void* ptr, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT{ free(ptr); } -#endif +#endif // defined(USING_NEW_FROM_UCLIBC) && !defined(NO_NOTHROW) diff --git a/src/del_opvs.cpp b/src/del_opvs.cpp index 53ab7cc9..8f2bb67e 100644 --- a/src/del_opvs.cpp +++ b/src/del_opvs.cpp @@ -22,6 +22,8 @@ #include #include +#if defined(USING_NEW_FROM_UCLIBC) _UCXXEXPORT void operator delete[](void * ptr, std::size_t) _UCXX_USE_NOEXCEPT{ ::operator delete[] (ptr); } +#endif // defined(USING_NEW_FROM_UCLIBC) diff --git a/src/new b/src/new index 1dc33a47..a07f4a65 100644 --- a/src/new +++ b/src/new @@ -24,6 +24,8 @@ #ifndef __STD_NEW_OPERATOR #define __STD_NEW_OPERATOR 1 +#define USING_NEW_FROM_UCLIBC + #pragma GCC visibility push(default) namespace std{ diff --git a/src/new_handler.cpp b/src/new_handler.cpp index a6efb9cb..938df992 100644 --- a/src/new_handler.cpp +++ b/src/new_handler.cpp @@ -19,6 +19,7 @@ #include +#if defined(USING_NEW_FROM_UCLIBC) const std::nothrow_t std::nothrow = { }; //Name selected to be compatable with g++ code @@ -29,3 +30,4 @@ _UCXXEXPORT std::new_handler std::set_new_handler(std::new_handler new_p) _UCXX_ __new_handler = new_p; return retval; } +#endif // defined(USING_NEW_FROM_UCLIBC) diff --git a/src/new_op.cpp b/src/new_op.cpp index 5232b1ec..e58b59a1 100644 --- a/src/new_op.cpp +++ b/src/new_op.cpp @@ -17,13 +17,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// Arduino 1.0 contains an implementation for this. -#if ARDUINO < 100 - #include #include #include +#if defined(USING_NEW_FROM_UCLIBC) && ARDUINO < 100 _UCXXEXPORT void* operator new(std::size_t numBytes) _UCXX_THROW(std::bad_alloc) { //C++ stardard 5.3.4.8 requires that a valid pointer be returned for @@ -37,5 +35,4 @@ _UCXXEXPORT void* operator new(std::size_t numBytes) _UCXX_THROW(std::bad_alloc) } return p; } - -#endif +#endif // defined(USING_NEW_FROM_UCLIBC) && ARDUINO < 100 diff --git a/src/new_opnt.cpp b/src/new_opnt.cpp index c37903e0..46c9e696 100644 --- a/src/new_opnt.cpp +++ b/src/new_opnt.cpp @@ -21,8 +21,8 @@ #include #include -#ifndef NO_NOTHROW +#if defined(USING_NEW_FROM_UCLIBC) && !defined(NO_NOTHROW) _UCXXEXPORT void* operator new(std::size_t numBytes, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT{ return malloc(numBytes); } -#endif +#endif // defined(USING_NEW_FROM_UCLIBC) && !defined(NO_NOTHROW) diff --git a/src/new_opv.cpp b/src/new_opv.cpp index 89a6a2aa..95c74d70 100644 --- a/src/new_opv.cpp +++ b/src/new_opv.cpp @@ -17,13 +17,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// Arduino 1.0 contains an implementation for this. -#if ARDUINO < 100 - #include #include #include +#if defined(USING_NEW_FROM_UCLIBC) && ARDUINO < 100 _UCXXEXPORT void* operator new[](std::size_t numBytes)_UCXX_THROW(std::bad_alloc){ //C++ stardard 5.3.4.8 requires that a valid pointer be returned for //a call to new(0). Thus: @@ -37,4 +35,4 @@ _UCXXEXPORT void* operator new[](std::size_t numBytes)_UCXX_THROW(std::bad_alloc return p; } -#endif +#endif // defined(USING_NEW_FROM_UCLIBC) && ARDUINO < 100 diff --git a/src/new_opvnt.cpp b/src/new_opvnt.cpp index 4874a7f6..8b60ad37 100644 --- a/src/new_opvnt.cpp +++ b/src/new_opvnt.cpp @@ -21,8 +21,8 @@ #include #include -#ifndef NO_NOTHROW +#if defined(USING_NEW_FROM_UCLIBC) && !defined(NO_NOTHROW) _UCXXEXPORT void* operator new[](std::size_t numBytes, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT{ return malloc(numBytes); } -#endif +#endif // defined(USING_NEW_FROM_UCLIBC) && !defined(NO_NOTHROW)