This allows some packages like crtmpserver to compile with uClibc++. Only patches that fix bugs were added. Upstream added a bunch of build changes that I kept out to keep things simple.
Upstreamed patches start at 100. Signed-off-by: Rosen Penev <ros...@gmail.com> --- https://github.com/openwrt/packages/pull/7512 for more info Patch 109 in this commit fixes the issue. package/libs/uclibc++/Makefile | 2 +- .../libs/uclibc++/patches/006-eabi_fix.patch | 20 - .../uclibc++/patches/020-template-fix.patch | 22 - .../patches/030-memory_corruption_fix.patch | 114 --- .../uclibc++/patches/040-delete-c++14.patch | 20 - ...-erase-on-derived-__base_associative.patch | 40 - ...00-unwind-Fix-ARM-EABI-build-failure.patch | 71 ++ ...initions-avoid-redefinition-warnings.patch | 32 + .../patches/102-string-Silence-warning.patch | 29 + ...-add-missing-operator-implementation.patch | 36 + ...m-fix-string-getline-to-set-noskipws.patch | 30 + ...o-gets-was-removed-from-C11-LWG-2249.patch | 27 + .../patches/106-C-14-sized-allocation.patch | 105 +++ ...stream-ostream-Fix-building-with-g-5.patch | 48 + .../108-string-assign-fix-two-bugs.patch | 131 +++ ...09-algorithm-Fix-decl-of-stable_sort.patch | 109 +++ .../110-add-refcounted-exceptions.patch | 158 ++++ ...plice-to-empty-list-from-other.begin.patch | 84 ++ .../112-cstdio-conditionalize-tmpnam.patch | 41 + ...amic-exception-specification-depreca.patch | 831 ++++++++++++++++++ .../patches/114-silence-some-warnings.patch | 109 +++ ...-erase-on-derived-__base_associative.patch | 91 ++ 22 files changed, 1933 insertions(+), 217 deletions(-) delete mode 100644 package/libs/uclibc++/patches/020-template-fix.patch delete mode 100644 package/libs/uclibc++/patches/030-memory_corruption_fix.patch delete mode 100644 package/libs/uclibc++/patches/040-delete-c++14.patch delete mode 100644 package/libs/uclibc++/patches/050-Bugfix-erase-on-derived-__base_associative.patch create mode 100644 package/libs/uclibc++/patches/100-unwind-Fix-ARM-EABI-build-failure.patch create mode 100644 package/libs/uclibc++/patches/101-basic_definitions-avoid-redefinition-warnings.patch create mode 100644 package/libs/uclibc++/patches/102-string-Silence-warning.patch create mode 100644 package/libs/uclibc++/patches/103-istream-add-missing-operator-implementation.patch create mode 100644 package/libs/uclibc++/patches/104-iostream-fix-string-getline-to-set-noskipws.patch create mode 100644 package/libs/uclibc++/patches/105-cstdio-gets-was-removed-from-C11-LWG-2249.patch create mode 100644 package/libs/uclibc++/patches/106-C-14-sized-allocation.patch create mode 100644 package/libs/uclibc++/patches/107-istream-ostream-Fix-building-with-g-5.patch create mode 100644 package/libs/uclibc++/patches/108-string-assign-fix-two-bugs.patch create mode 100644 package/libs/uclibc++/patches/109-algorithm-Fix-decl-of-stable_sort.patch create mode 100644 package/libs/uclibc++/patches/110-add-refcounted-exceptions.patch create mode 100644 package/libs/uclibc++/patches/111-list-fix-splice-to-empty-list-from-other.begin.patch create mode 100644 package/libs/uclibc++/patches/112-cstdio-conditionalize-tmpnam.patch create mode 100644 package/libs/uclibc++/patches/113-silence-c-11-dynamic-exception-specification-depreca.patch create mode 100644 package/libs/uclibc++/patches/114-silence-some-warnings.patch create mode 100644 package/libs/uclibc++/patches/115-Fix-erase-on-derived-__base_associative.patch diff --git a/package/libs/uclibc++/Makefile b/package/libs/uclibc++/Makefile index 7133a7ef33..cdd64591e4 100644 --- a/package/libs/uclibc++/Makefile +++ b/package/libs/uclibc++/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uclibc++ PKG_VERSION:=0.2.4 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://cxx.uclibc.org/src/ diff --git a/package/libs/uclibc++/patches/006-eabi_fix.patch b/package/libs/uclibc++/patches/006-eabi_fix.patch index 893c2d60b6..4f8e57c5c5 100644 --- a/package/libs/uclibc++/patches/006-eabi_fix.patch +++ b/package/libs/uclibc++/patches/006-eabi_fix.patch @@ -16,23 +16,3 @@ namespace std { ---- a/include/unwind-cxx.h -+++ b/include/unwind-cxx.h -@@ -173,6 +173,7 @@ extern std::unexpected_handler __unexpec - - // This is the exception class we report -- "GNUCC++\0". - const _Unwind_Exception_Class __gxx_exception_class -+#ifndef __ARM_EABI_UNWINDER__ - = ((((((((_Unwind_Exception_Class) 'G' - << 8 | (_Unwind_Exception_Class) 'N') - << 8 | (_Unwind_Exception_Class) 'U') -@@ -181,6 +182,9 @@ const _Unwind_Exception_Class __gxx_exce - << 8 | (_Unwind_Exception_Class) '+') - << 8 | (_Unwind_Exception_Class) '+') - << 8 | (_Unwind_Exception_Class) '\0'); -+#else -+= "GNUC++"; -+#endif - - // GNU C++ personality routine, Version 0. - extern "C" _Unwind_Reason_Code __gxx_personality_v0 diff --git a/package/libs/uclibc++/patches/020-template-fix.patch b/package/libs/uclibc++/patches/020-template-fix.patch deleted file mode 100644 index f7cc09e140..0000000000 --- a/package/libs/uclibc++/patches/020-template-fix.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/include/ostream -+++ b/include/ostream -@@ -294,7 +294,7 @@ namespace std { - #endif - #endif - -- template <class charT,class traits = char_traits<charT> > -+ template <class charT,class traits> - class _UCXXEXPORT basic_ostream<charT,traits>::sentry - { - bool ok; ---- a/include/istream -+++ b/include/istream -@@ -340,7 +340,7 @@ namespace std{ - - }; - -- template <class charT,class traits = char_traits<charT> > class _UCXXEXPORT basic_istream<charT,traits>::sentry { -+ template <class charT,class traits> class _UCXXEXPORT basic_istream<charT,traits>::sentry { - bool ok; - public: - explicit _UCXXEXPORT sentry(basic_istream<charT,traits>& os, bool noskipws = false){ diff --git a/package/libs/uclibc++/patches/030-memory_corruption_fix.patch b/package/libs/uclibc++/patches/030-memory_corruption_fix.patch deleted file mode 100644 index e34efdbb15..0000000000 --- a/package/libs/uclibc++/patches/030-memory_corruption_fix.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 1dc865b8bbb3911abc8ce53c7ae8a59dc90f6fc3 Mon Sep 17 00:00:00 2001 -From: Ivan Kold <pixus...@gmail.com> -Date: Thu, 3 Mar 2016 12:56:30 -0800 -Subject: [PATCH] Fix throw statement causing memory corruption - -The __cxxabiv1::__cxa_throw in the GCC's libsupc++ expects -sizeof(__cxa_refcounted_exception) bytes be allocated before -exception object. -uClibc++ allocates only sizeof(__cxa_exception) before an -exception object. -The __cxxabiv1::__cxa_throw writes in memory before allocated: -// gcc-5.2.0/libstdc++-v3/libsupc++/eh_throw.cc:69 -__cxa_refcounted_exception *header - = __get_refcounted_exception_header_from_obj (obj); -header->referenceCount = 1; - -Signed-off-by: Ivan Kold <pixus...@gmail.com> ---- - include/unwind-cxx.h | 34 +++++++++++++++++++++++++++++++++- - src/eh_alloc.cpp | 8 ++++---- - 2 files changed, 37 insertions(+), 5 deletions(-) - ---- a/include/unwind-cxx.h -+++ b/include/unwind-cxx.h -@@ -1,5 +1,5 @@ - // -*- C++ -*- Exception handling and frame unwind runtime interface routines. --// Copyright (C) 2001 Free Software Foundation, Inc. -+// Copyright (C) 2001-2015 Free Software Foundation, Inc. - // - // This file is part of GCC. - // -@@ -13,6 +13,10 @@ - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - // GNU General Public License for more details. - // -+// Under Section 7 of GPL version 3, you are granted additional -+// permissions described in the GCC Runtime Library Exception, version -+// 3.1, as published by the Free Software Foundation. -+// - // You should have received a copy of the GNU General Public License - // along with GCC; see the file COPYING. If not, write to - // the Free Software Foundation, 59 Temple Place - Suite 330, -@@ -40,6 +44,12 @@ - #include <cstddef> - #include "unwind.h" - -+// Original unwind-cxx.h also includes bits/atomic_word.h which is CPU-specific, -+// but always defines _Atomic_word as typedef int . -+// Only thing that differs is memory-barrier macroses. -+typedef int _Atomic_word; -+ -+ - #pragma GCC visibility push(default) - - namespace __cxxabiv1 -@@ -79,6 +89,13 @@ struct __cxa_exception - _Unwind_Exception unwindHeader; - }; - -+struct __cxa_refcounted_exception -+{ -+ // Manage this header. -+ _Atomic_word referenceCount; -+ // __cxa_exception must be last, and no padding can be after it. -+ __cxa_exception exc; -+}; - - // A dependent C++ exception object consists of a header, which is a wrapper - // around an unwind object header with additional C++ specific information, -@@ -210,6 +227,21 @@ __get_exception_header_from_ue (_Unwind_ - return reinterpret_cast<__cxa_exception *>(exc + 1) - 1; - } - -+// Acquire the C++ refcounted exception header from the C++ object. -+static inline __cxa_refcounted_exception * -+__get_refcounted_exception_header_from_obj (void *ptr) -+{ -+ return reinterpret_cast<__cxa_refcounted_exception *>(ptr) - 1; -+} -+ -+// Acquire the C++ refcounted exception header from the generic exception -+// header. -+static inline __cxa_refcounted_exception * -+__get_refcounted_exception_header_from_ue (_Unwind_Exception *exc) -+{ -+ return reinterpret_cast<__cxa_refcounted_exception *>(exc + 1) - 1; -+} -+ - } /* namespace __cxxabiv1 */ - - #pragma GCC visibility pop ---- a/src/eh_alloc.cpp -+++ b/src/eh_alloc.cpp -@@ -30,16 +30,16 @@ extern "C" void * __cxa_allocate_excepti - void *retval; - //The sizeof crap is required by Itanium ABI because we need to provide space for - //accounting information which is implementaion (gcc) specified -- retval = malloc (thrown_size + sizeof(__cxa_exception)); -+ retval = malloc (thrown_size + sizeof(__cxa_refcounted_exception)); - if (0 == retval){ - std::terminate(); - } -- memset (retval, 0, sizeof(__cxa_exception)); -- return (void *)((unsigned char *)retval + sizeof(__cxa_exception)); -+ memset (retval, 0, sizeof(__cxa_refcounted_exception)); -+ return (void *)((unsigned char *)retval + sizeof(__cxa_refcounted_exception)); - } - - extern "C" void __cxa_free_exception(void *vptr) throw(){ -- free( (char *)(vptr) - sizeof(__cxa_exception) ); -+ free( (char *)(vptr) - sizeof(__cxa_refcounted_exception) ); - } - - diff --git a/package/libs/uclibc++/patches/040-delete-c++14.patch b/package/libs/uclibc++/patches/040-delete-c++14.patch deleted file mode 100644 index f48a78f0a4..0000000000 --- a/package/libs/uclibc++/patches/040-delete-c++14.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/src/del_op.cpp -+++ b/src/del_op.cpp -@@ -24,3 +24,7 @@ - _UCXXEXPORT void operator delete(void* ptr) throw(){ - free(ptr); - } -+ -+_UCXXEXPORT void operator delete(void* ptr, size_t size) throw(){ -+ free(ptr); -+} ---- a/src/del_opv.cpp -+++ b/src/del_opv.cpp -@@ -24,3 +24,7 @@ - _UCXXEXPORT void operator delete[](void * ptr) throw(){ - free(ptr); - } -+ -+_UCXXEXPORT void operator delete[](void * ptr, size_t size) throw(){ -+ free(ptr); -+} diff --git a/package/libs/uclibc++/patches/050-Bugfix-erase-on-derived-__base_associative.patch b/package/libs/uclibc++/patches/050-Bugfix-erase-on-derived-__base_associative.patch deleted file mode 100644 index 2ddb8a984e..0000000000 --- a/package/libs/uclibc++/patches/050-Bugfix-erase-on-derived-__base_associative.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 946b29e62927eadfc4e87f27b8d30e5974b78c4c Mon Sep 17 00:00:00 2001 -From: Ben Kelly <b...@benjii.net> -Date: Mon, 6 Feb 2017 13:08:25 +0200 -Subject: [PATCH] Bugfix erase() on derived __base_associative - -When calling erase() on a containers derived from __base_associative -(e.g. multimap) and providing a pair of iterators a segfault will -occur. - -Example code to reproduce: - - typedef std::multimap<int, int> testmap; - testmap t; - t.insert(std::pair<int, int>(1, 1)); - t.insert(std::pair<int, int>(2, 1)); - t.insert(std::pair<int, int>(3, 1)); - t.erase(t.begin(), t.end()); - -Signed-off-by: Ben Kelly <b...@benjii.net> ---- - include/associative_base | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/include/associative_base b/include/associative_base -index 27ae0ef..be8b27f 100644 ---- a/include/associative_base -+++ b/include/associative_base -@@ -200,8 +200,7 @@ public: - } - void erase(iterator first, iterator last){ - while(first != last){ -- backing.erase(first.base_iterator()); -- ++first; -+ first = backing.erase(first.base_iterator()); - } - } - --- -2.7.4 - diff --git a/package/libs/uclibc++/patches/100-unwind-Fix-ARM-EABI-build-failure.patch b/package/libs/uclibc++/patches/100-unwind-Fix-ARM-EABI-build-failure.patch new file mode 100644 index 0000000000..52de241d2d --- /dev/null +++ b/package/libs/uclibc++/patches/100-unwind-Fix-ARM-EABI-build-failure.patch @@ -0,0 +1,71 @@ +From cf73cb907c03ca2fb22bfe7fe2f732c10714b9ad Mon Sep 17 00:00:00 2001 +From: Felix Fietkau <n...@openwrt.org> +Date: Thu, 14 Jun 2012 13:02:14 +0200 +Subject: [PATCH] unwind: Fix ARM EABI build failure + +uClibc++ current does not build using an ARM EABI toolchain with the +following build failure: +eh_alloc.cpp +In file included from ../include/basic_definitions:21:0, + from ../include/cstdlib:20, + from eh_alloc.cpp:20: +../include/system_configuration.h:17:0: warning: "__WARNINGS__" redefined [enabled by default] +/opt/toolchains/armeabi-uclibc-std-0.9.30.2-gcc-4.6.0-binutils-2.20.1/arm-linux-uclibcgnueabi/sysroot/usr/include/bits/uClibc_config.h:223:0: note: this is the location of the previous definition +In file included from eh_alloc.cpp:25:0: +../include/unwind-cxx.h:176:36: error: ISO C++ forbids casting to an array type '_Unwind_Exception_Class' +../include/unwind-cxx.h:177:36: error: ISO C++ forbids casting to an array type '_Unwind_Exception_Class' +../include/unwind-cxx.h:178:35: error: ISO C++ forbids casting to an array type '_Unwind_Exception_Class' +../include/unwind-cxx.h:179:41: error: ISO C++ forbids casting to an array type '_Unwind_Exception_Class' +../include/unwind-cxx.h:180:40: error: ISO C++ forbids casting to an array type '_Unwind_Exception_Class' +../include/unwind-cxx.h:181:39: error: ISO C++ forbids casting to an array type '_Unwind_Exception_Class' +../include/unwind-cxx.h:182:38: error: ISO C++ forbids casting to an array type '_Unwind_Exception_Class' +../include/unwind-cxx.h:183:37: error: ISO C++ forbids casting to an array type '_Unwind_Exception_Class' +make[1]: *** [eh_alloc.o] Error 1 +make[1]: Leaving directory `/home/florian/dev/uclibcxx/uClibc++/src' + +Workaround this by direclty using the string "GNUCC++". + +Signed-off-by: Felix Fietkau <n...@openwrt.org> +Signed-off-by: Florian Fainelli <flor...@openwrt.org> +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + ChangeLog | 3 +++ + include/unwind-cxx.h | 4 ++++ + 2 files changed, 7 insertions(+) + +diff --git a/ChangeLog b/ChangeLog +index 58b66fa..195caf8 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,6 @@ ++0.2.5 ++- unwind: Fix for __ARM_EABI_UNWINDER__ ++ + 0.2.4 + - valarray: Fix operator=(const valarray<T>&) DR 630 + - valarray: Adjust constness of operator[](size_t) +diff --git a/include/unwind-cxx.h b/include/unwind-cxx.h +index 4a8961a..b773259 100644 +--- a/include/unwind-cxx.h ++++ b/include/unwind-cxx.h +@@ -173,6 +173,7 @@ extern std::unexpected_handler __unexpected_handler; + + // This is the exception class we report -- "GNUCC++\0". + const _Unwind_Exception_Class __gxx_exception_class ++#ifndef __ARM_EABI_UNWINDER__ + = ((((((((_Unwind_Exception_Class) 'G' + << 8 | (_Unwind_Exception_Class) 'N') + << 8 | (_Unwind_Exception_Class) 'U') +@@ -181,6 +182,9 @@ const _Unwind_Exception_Class __gxx_exception_class + << 8 | (_Unwind_Exception_Class) '+') + << 8 | (_Unwind_Exception_Class) '+') + << 8 | (_Unwind_Exception_Class) '\0'); ++#else ++= "GNUCC++"; ++#endif + + // GNU C++ personality routine, Version 0. + extern "C" _Unwind_Reason_Code __gxx_personality_v0 +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/101-basic_definitions-avoid-redefinition-warnings.patch b/package/libs/uclibc++/patches/101-basic_definitions-avoid-redefinition-warnings.patch new file mode 100644 index 0000000000..79661fb9dc --- /dev/null +++ b/package/libs/uclibc++/patches/101-basic_definitions-avoid-redefinition-warnings.patch @@ -0,0 +1,32 @@ +From 8100f081cc3d9e378aded6f8077197e3f943080b Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Mon, 18 Jun 2012 10:20:56 +0200 +Subject: [PATCH] basic_definitions: avoid redefinition warnings + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/basic_definitions | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/include/basic_definitions b/include/basic_definitions +index e0392b8..d4b6cd5 100644 +--- a/include/basic_definitions ++++ b/include/basic_definitions +@@ -56,11 +56,9 @@ namespace std{ + + #pragma GCC visibility pop + +-#endif +- +- +-#ifdef __DODEBUG__ ++# ifdef __DODEBUG__ + #define UCLIBCXX_DEBUG 1 +-#else ++# else + #define UCLIBCXX_DEBUG 0 ++# endif + #endif +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/102-string-Silence-warning.patch b/package/libs/uclibc++/patches/102-string-Silence-warning.patch new file mode 100644 index 0000000000..d19c81d463 --- /dev/null +++ b/package/libs/uclibc++/patches/102-string-Silence-warning.patch @@ -0,0 +1,29 @@ +From 57e3652aec12098446f1faf80dc53d386251a0b3 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Fri, 19 Jul 2013 12:57:28 +0200 +Subject: [PATCH] string: Silence warning + +include/string:85:3: warning: ordered comparison of pointer with integer +zero [-Wextra] + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/string | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/string b/include/string +index 7826ce7..313288d 100644 +--- a/include/string ++++ b/include/string +@@ -82,7 +82,7 @@ public: + if(n == npos){ + __throw_out_of_range(); + } +- if(s > 0){ ++ if (*s > 0){ + resize(n); + Tr::copy(vector<Ch, A>::data, s, vector<Ch, A>::elements); + } +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/103-istream-add-missing-operator-implementation.patch b/package/libs/uclibc++/patches/103-istream-add-missing-operator-implementation.patch new file mode 100644 index 0000000000..0eb33b127f --- /dev/null +++ b/package/libs/uclibc++/patches/103-istream-add-missing-operator-implementation.patch @@ -0,0 +1,36 @@ +From 0b09938d5d4b9108b76e6d5d5d6d07d38eacd323 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= <proyv...@moondrake.org> +Date: Tue, 28 May 2013 00:31:33 +0200 +Subject: [PATCH] istream: add missing operator >> implementation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Per Øyvind Karlsen <proyv...@moondrake.org> +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/istream | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/include/istream b/include/istream +index d67f48f..59d7f6e 100644 +--- a/include/istream ++++ b/include/istream +@@ -554,6 +554,14 @@ namespace std{ + return *this; + } + ++ template <class charT, class traits> _UCXXEXPORT basic_istream<charT,traits>& ++ basic_istream<charT,traits>::operator>>(ios_base& (*pf)(ios_base&)) ++ { ++ sentry(*this); ++ pf(*this); ++ return *this; ++ } ++ + template <class charT, class traits> _UCXXEXPORT basic_istream<charT,traits>& + ws(basic_istream<charT,traits>& is) + { +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/104-iostream-fix-string-getline-to-set-noskipws.patch b/package/libs/uclibc++/patches/104-iostream-fix-string-getline-to-set-noskipws.patch new file mode 100644 index 0000000000..57ff07337e --- /dev/null +++ b/package/libs/uclibc++/patches/104-iostream-fix-string-getline-to-set-noskipws.patch @@ -0,0 +1,30 @@ +From 7c90261eb9e5cff4ea3a4e5580e4f2bc7543cb21 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= <proyv...@moondrake.org> +Date: Tue, 28 May 2013 00:38:28 +0200 +Subject: [PATCH] iostream: fix string getline to set noskipws +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Per Øyvind Karlsen <proyv...@moondrake.org> +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/string_iostream | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/string_iostream b/include/string_iostream +index 4ef3b60..355fd58 100644 +--- a/include/string_iostream ++++ b/include/string_iostream +@@ -83,7 +83,7 @@ template<class charT, class traits, class Allocator> _UCXXEXPORT basic_istream<c + template<class charT, class traits, class Allocator> _UCXXEXPORT basic_istream<charT,traits>& + getline(basic_istream<charT,traits>& is, basic_string<charT,traits,Allocator>& str, charT delim) + { +- typename basic_istream<charT,traits>::sentry s(is); ++ typename basic_istream<charT,traits>::sentry s(is, true); + if(s == false){ + return is; + } +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/105-cstdio-gets-was-removed-from-C11-LWG-2249.patch b/package/libs/uclibc++/patches/105-cstdio-gets-was-removed-from-C11-LWG-2249.patch new file mode 100644 index 0000000000..afafd74a6f --- /dev/null +++ b/package/libs/uclibc++/patches/105-cstdio-gets-was-removed-from-C11-LWG-2249.patch @@ -0,0 +1,27 @@ +From 86d442a589dcfa1910c480d36730cb9c850ea326 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Sat, 5 Mar 2016 21:18:25 +0100 +Subject: [PATCH] cstdio: gets was removed from C11, LWG 2249 + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/cstdio | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/cstdio b/include/cstdio +index aab1283..8f4df27 100644 +--- a/include/cstdio ++++ b/include/cstdio +@@ -47,7 +47,9 @@ namespace std{ + using ::fwrite; + using ::getc; + using ::getchar; ++#if __cplusplus <= 201103L + using ::gets; ++#endif + using ::perror; + using ::printf; + using ::putc; +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/106-C-14-sized-allocation.patch b/package/libs/uclibc++/patches/106-C-14-sized-allocation.patch new file mode 100644 index 0000000000..135b6fe9c9 --- /dev/null +++ b/package/libs/uclibc++/patches/106-C-14-sized-allocation.patch @@ -0,0 +1,105 @@ +From 288302797b8d9aa2c8b060159fcdd7acc4dc80f2 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Sun, 6 Mar 2016 00:28:56 +0100 +Subject: [PATCH] C++14 sized allocation + +Fixes linking with gcc-6.0 + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/new | 6 ++++++ + src/del_ops.cpp | 27 +++++++++++++++++++++++++++ + src/del_opvs.cpp | 27 +++++++++++++++++++++++++++ + 3 files changed, 60 insertions(+) + create mode 100644 src/del_ops.cpp + create mode 100644 src/del_opvs.cpp + +diff --git a/include/new b/include/new +index 665e783..0949a09 100644 +--- a/include/new ++++ b/include/new +@@ -39,9 +39,15 @@ namespace std{ + + _UCXXEXPORT void* operator new(std::size_t numBytes) throw(std::bad_alloc); + _UCXXEXPORT void operator delete(void* ptr) throw(); ++#if __cpp_sized_deallocation ++_UCXXEXPORT void operator delete(void* ptr, std::size_t) throw(); ++#endif + + _UCXXEXPORT void* operator new[](std::size_t numBytes) throw(std::bad_alloc); + _UCXXEXPORT void operator delete[](void * ptr) throw(); ++#if __cpp_sized_deallocation ++_UCXXEXPORT void operator delete[](void * ptr, std::size_t) throw(); ++#endif + + #ifndef NO_NOTHROW + _UCXXEXPORT void* operator new(std::size_t numBytes, const std::nothrow_t& ) throw(); +diff --git a/src/del_ops.cpp b/src/del_ops.cpp +new file mode 100644 +index 0000000..e292b03 +--- /dev/null ++++ b/src/del_ops.cpp +@@ -0,0 +1,27 @@ ++/* Copyright (C) 2015 Bernhard Reutner-Fischer ++ ++ This file is part of the uClibc++ Library. ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++*/ ++/* C++14 sized deallocation */ ++ ++#include <new> ++#include <cstdlib> ++#include <func_exception> ++ ++_UCXXEXPORT void operator delete(void* ptr, std::size_t) throw(){ ++ ::operator delete (ptr); ++} +diff --git a/src/del_opvs.cpp b/src/del_opvs.cpp +new file mode 100644 +index 0000000..1c92d1f +--- /dev/null ++++ b/src/del_opvs.cpp +@@ -0,0 +1,27 @@ ++/* Copyright (C) 2015 Bernhard Reutner-Fischer ++ ++ This file is part of the uClibc++ Library. ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++*/ ++/* C++14 sized deallocation */ ++ ++#include <new> ++#include <cstdlib> ++#include <func_exception> ++ ++_UCXXEXPORT void operator delete[](void * ptr, std::size_t) throw(){ ++ ::operator delete[] (ptr); ++} +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/107-istream-ostream-Fix-building-with-g-5.patch b/package/libs/uclibc++/patches/107-istream-ostream-Fix-building-with-g-5.patch new file mode 100644 index 0000000000..dfdef28fb1 --- /dev/null +++ b/package/libs/uclibc++/patches/107-istream-ostream-Fix-building-with-g-5.patch @@ -0,0 +1,48 @@ +From d841ce2fdff4d28e28992dc3d4594694b6cf3516 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Sun, 6 Mar 2016 00:33:24 +0100 +Subject: [PATCH] istream, ostream: Fix building with g++ >= 5 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +include/ostream:298:50: error: default argument for template parameter for class enclosing ‘class std::basic_ostream<charT, traits>::sentry’ +include/istream:343:107: error: default argument for template parameter for class enclosing ‘class std::basic_istream<charT, traits>::sentry’ + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/istream | 4 +++- + include/ostream | 2 +- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/include/istream b/include/istream +index 59d7f6e..a6fe3de 100644 +--- a/include/istream ++++ b/include/istream +@@ -340,7 +340,9 @@ namespace std{ + + }; + +- template <class charT,class traits = char_traits<charT> > class _UCXXEXPORT basic_istream<charT,traits>::sentry { ++ template <class charT,class traits> ++ class _UCXXEXPORT basic_istream<charT,traits>::sentry ++ { + bool ok; + public: + explicit _UCXXEXPORT sentry(basic_istream<charT,traits>& os, bool noskipws = false){ +diff --git a/include/ostream b/include/ostream +index bc9a44a..b112e94 100644 +--- a/include/ostream ++++ b/include/ostream +@@ -294,7 +294,7 @@ namespace std { + #endif + #endif + +- template <class charT,class traits = char_traits<charT> > ++ template <class charT,class traits> + class _UCXXEXPORT basic_ostream<charT,traits>::sentry + { + bool ok; +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/108-string-assign-fix-two-bugs.patch b/package/libs/uclibc++/patches/108-string-assign-fix-two-bugs.patch new file mode 100644 index 0000000000..3449e73adc --- /dev/null +++ b/package/libs/uclibc++/patches/108-string-assign-fix-two-bugs.patch @@ -0,0 +1,131 @@ +From 26deb1776d5811b45308946f416135783290233a Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Sun, 6 Mar 2016 12:42:39 +0100 +Subject: [PATCH] string: assign(): fix two bugs + +std::string a.assign(10, '+'); +did not work (now checkAssignFillChar). + +assign(iterator::begin(), iterator::end()) relied on permissive +(checkAssignIterator). + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/string | 5 +-- + tests/stringtest.cpp | 55 ++++++++++++++++++++++++++++++++ + tests/testoutput/stringtest.good | 4 +-- + 3 files changed, 60 insertions(+), 4 deletions(-) + +diff --git a/include/string b/include/string +index 313288d..a790715 100644 +--- a/include/string ++++ b/include/string +@@ -219,14 +219,15 @@ public: + + _UCXXEXPORT basic_string& assign(size_type n, Ch c){ + vector<Ch, A>::clear(); +- vector<Ch, A>::resize(n, Ch() ); ++ vector<Ch, A>::resize(n, c); + return *this; + } + + template<class InputIterator> _UCXXEXPORT basic_string& assign(InputIterator first, InputIterator last){ + vector<Ch, A>::resize(0, Ch()); + while (first != last){ +- append(*first); ++ const Ch x = *first; ++ append(&x); + ++first; + } + return *this; +diff --git a/tests/stringtest.cpp b/tests/stringtest.cpp +index a69813c..85d451b 100644 +--- a/tests/stringtest.cpp ++++ b/tests/stringtest.cpp +@@ -391,6 +391,53 @@ bool checkInsertAtInteractor() { + return true; + } + ++bool checkAssignFillType() { ++ return true; ++#if 0 ++ std::string a; ++ a.assign<int>(10, 0x2B); ++ return a == "++++++++++"; ++#endif ++} ++ ++bool checkAssignFillChar() { ++ std::string a; ++ a.assign(10, '+'); ++ return a == "++++++++++"; ++} ++ ++bool checkAssignString() { ++ std::string a = "This is a string"; ++ std::string b; ++ b.assign(a); ++ return b == a; ++} ++bool checkAssignSubstring() { ++ std::string a = "This is a string"; ++ std::string b; ++ b.assign(a, 2, 5); ++ return b == "is is"; ++} ++ ++bool checkAssignCstring() { ++ std::string a; ++ a.assign("This is a c string"); ++ return a == "This is a c string"; ++} ++ ++bool checkAssignBuffer() { ++ std::string a; ++ a.assign("This is a c string", 8); ++ return a == "This is "; ++} ++ ++bool checkAssignIterator() { ++ std::string a = "This is a string"; ++ std::string b; ++ b.assign(a.begin() + 2, a.end() - 6); ++ return b == "is is a "; ++} ++ + int main(){ + TestFramework::init(); + +@@ -491,6 +538,14 @@ int main(){ + + TestFramework::AssertReturns<bool>(checkInsertAtInteractor, true); + ++ TestFramework::AssertReturns<bool>(checkAssignFillType, true); ++ TestFramework::AssertReturns<bool>(checkAssignFillChar, true); ++ TestFramework::AssertReturns<bool>(checkAssignString, true); ++ TestFramework::AssertReturns<bool>(checkAssignSubstring, true); ++ TestFramework::AssertReturns<bool>(checkAssignCstring, true); ++ TestFramework::AssertReturns<bool>(checkAssignBuffer, true); ++ TestFramework::AssertReturns<bool>(checkAssignIterator, true); ++ + TestFramework::results(); + + return 0; +diff --git a/tests/testoutput/stringtest.good b/tests/testoutput/stringtest.good +index f27b917..78067ba 100644 +--- a/tests/testoutput/stringtest.good ++++ b/tests/testoutput/stringtest.good +@@ -8,8 +8,8 @@ a = b + c: This is test string bThis is test string c + a = "Test cstring" + b: Test cstringThis is test string b + Please enter a test string: + You entered: word1 +-......................................................... ++................................................................ + ------------------------------ +-Ran 57 tests ++Ran 64 tests + + OK +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/109-algorithm-Fix-decl-of-stable_sort.patch b/package/libs/uclibc++/patches/109-algorithm-Fix-decl-of-stable_sort.patch new file mode 100644 index 0000000000..d78f9d6db1 --- /dev/null +++ b/package/libs/uclibc++/patches/109-algorithm-Fix-decl-of-stable_sort.patch @@ -0,0 +1,109 @@ +From adb1d3558256864519771a9214789b75f00e2692 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Fri, 23 Sep 2016 15:29:34 +0200 +Subject: [PATCH] algorithm: Fix decl of stable_sort + +Moritz Warning reported that stable_sort needs to be declared before sort. + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/algorithm | 12 ++++++------ + tests/algotest.cpp | 31 +++++++++++++++++++++++++++++++ + tests/testoutput/algotest.good | 4 ++-- + 3 files changed, 39 insertions(+), 8 deletions(-) + +diff --git a/include/algorithm b/include/algorithm +index 5e8f139..af04f97 100644 +--- a/include/algorithm ++++ b/include/algorithm +@@ -830,12 +830,6 @@ namespace std{ + sort(first, last, c ); + } + +- template<class RandomAccessIterator, class Compare> _UCXXEXPORT +- void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp) +- { +- stable_sort(first, last, comp); +- } +- + template<class RandomAccessIterator> _UCXXEXPORT + void stable_sort(RandomAccessIterator first, RandomAccessIterator last) + { +@@ -861,6 +855,12 @@ namespace std{ + } + } + ++ template<class RandomAccessIterator, class Compare> _UCXXEXPORT ++ void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp) ++ { ++ stable_sort(first, last, comp); ++ } ++ + template<class RandomAccessIterator> _UCXXEXPORT + void partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last) + { +diff --git a/tests/algotest.cpp b/tests/algotest.cpp +index cda5919..23ba3ae 100644 +--- a/tests/algotest.cpp ++++ b/tests/algotest.cpp +@@ -389,6 +389,36 @@ bool testPartialSort(){ + return true; + } + ++bool testSort() { ++ struct _my_comp { ++ inline bool operator()(const int &a, const int &b) const { ++ return a > b; ++ } ++ }; ++ std::vector<int> a; ++ std::vector<int>::iterator i; ++ ++ a.push_back(5); ++ a.push_back(2); ++ a.push_back(4); ++ a.push_back(3); ++ a.push_back(1); ++ a.push_back(0); ++ ++ i = a.begin(); ++ ++ std::sort<std::vector<int>::iterator>(a.begin(), a.end(), _my_comp()); ++ ++ for (int j = 0; j < 6; ++j) { ++ if (a[j] != 5 - j) { ++ printf("Key %i should be %i but is %i\n", j, 5-j, a[j]); ++ return false; ++ } ++ } ++ ++ return true; ++} ++ + bool testInplaceMerge(){ + std::vector<int> a; + std::vector<int>::iterator i; +@@ -572,6 +602,7 @@ int main(){ + TestFramework::AssertReturns<bool>(testPushHeap, true); + TestFramework::AssertReturns<bool>(testSortHeap, true); + TestFramework::AssertReturns<bool>(testPartialSort, true); ++ TestFramework::AssertReturns<bool>(testSort, true); + TestFramework::AssertReturns<bool>(testInplaceMerge, true); + TestFramework::AssertReturns<bool>(testNextPermutation, true); + TestFramework::AssertReturns<bool>(testPrevPermutation, true); +diff --git a/tests/testoutput/algotest.good b/tests/testoutput/algotest.good +index 53f2bb5..4d30e0a 100644 +--- a/tests/testoutput/algotest.good ++++ b/tests/testoutput/algotest.good +@@ -1,6 +1,6 @@ + Beginning algorithm test +-.............. ++............... + ------------------------------ +-Ran 14 tests ++Ran 15 tests + + OK +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/110-add-refcounted-exceptions.patch b/package/libs/uclibc++/patches/110-add-refcounted-exceptions.patch new file mode 100644 index 0000000000..3689799c14 --- /dev/null +++ b/package/libs/uclibc++/patches/110-add-refcounted-exceptions.patch @@ -0,0 +1,158 @@ +From 2b58f77ee27c60842054fd0e5dd67f5d00e89eb8 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Fri, 23 Sep 2016 15:56:11 +0200 +Subject: [PATCH] add refcounted exceptions + +Fixes bugzilla #8741 + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/unwind-cxx.h | 32 +++++++++++++++++++++++++++++++- + src/eh_alloc.cpp | 28 ++++++++++++++++------------ + tests/newdeltest.cpp | 4 ++-- + 3 files changed, 49 insertions(+), 15 deletions(-) + +diff --git a/include/unwind-cxx.h b/include/unwind-cxx.h +index b773259..e001343 100644 +--- a/include/unwind-cxx.h ++++ b/include/unwind-cxx.h +@@ -40,6 +40,14 @@ + #include <cstddef> + #include "unwind.h" + ++#ifdef __aarch64__ ++typedef long _Atomic_word; ++#elif defined __cris__ ++typedef int _Atomic_word __attribute__ ((__aligned__ (4))); ++#else ++typedef int _Atomic_word; ++#endif ++ + #pragma GCC visibility push(default) + + namespace __cxxabiv1 +@@ -79,6 +87,13 @@ struct __cxa_exception + _Unwind_Exception unwindHeader; + }; + ++struct __cxa_refcounted_exception ++{ ++ // Manage this header. ++ _Atomic_word referenceCount; ++ // __cxa_exception must be last, and no padding can be after it. ++ __cxa_exception exc; ++}; + + // A dependent C++ exception object consists of a header, which is a wrapper + // around an unwind object header with additional C++ specific information, +@@ -162,7 +177,7 @@ extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn)); + + // Invokes given handler, dying appropriately if the user handler was + // so inconsiderate as to return. +-extern void __terminate(std::terminate_handler) __attribute__((noreturn)); ++extern void __terminate(std::terminate_handler) throw () __attribute__((noreturn)); + extern void __unexpected(std::unexpected_handler) __attribute__((noreturn)); + + // The current installed user handlers. +@@ -210,6 +225,21 @@ __get_exception_header_from_ue (_Unwind_Exception *exc) + return reinterpret_cast<__cxa_exception *>(exc + 1) - 1; + } + ++// Acquire the C++ refcounted exception header from the C++ object. ++static inline __cxa_refcounted_exception * ++__get_refcounted_exception_header_from_obj (void *ptr) ++{ ++ return reinterpret_cast<__cxa_refcounted_exception *>(ptr) - 1; ++} ++ ++// Acquire the C++ refcounted exception header from the generic exception ++// header. ++static inline __cxa_refcounted_exception * ++__get_refcounted_exception_header_from_ue (_Unwind_Exception *exc) ++{ ++ return reinterpret_cast<__cxa_refcounted_exception *>(exc + 1) - 1; ++} ++ + } /* namespace __cxxabiv1 */ + + #pragma GCC visibility pop +diff --git a/src/eh_alloc.cpp b/src/eh_alloc.cpp +index 5098196..cdf28e0 100644 +--- a/src/eh_alloc.cpp ++++ b/src/eh_alloc.cpp +@@ -24,29 +24,32 @@ + //This is a system-specific header which does all of the error-handling management + #include <unwind-cxx.h> + +-namespace __cxxabiv1{ ++namespace __cxxabiv1 ++{ + + extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw(){ +- void *retval; +- //The sizeof crap is required by Itanium ABI because we need to provide space for +- //accounting information which is implementaion (gcc) specified +- retval = malloc (thrown_size + sizeof(__cxa_exception)); +- if (0 == retval){ ++ void *e; ++ // The sizeof crap is required by Itanium ABI because we need to ++ // provide space for accounting information which is implementation ++ // (gcc) defined. ++ e = malloc (thrown_size + sizeof(__cxa_refcounted_exception)); ++ if (0 == e){ + std::terminate(); + } +- memset (retval, 0, sizeof(__cxa_exception)); +- return (void *)((unsigned char *)retval + sizeof(__cxa_exception)); ++ memset (e, 0, sizeof(__cxa_refcounted_exception)); ++ return (void *)((unsigned char *)e + sizeof(__cxa_refcounted_exception)); + } + + extern "C" void __cxa_free_exception(void *vptr) throw(){ +- free( (char *)(vptr) - sizeof(__cxa_exception) ); ++ free( (char *)(vptr) - sizeof(__cxa_refcounted_exception) ); + } + + + extern "C" __cxa_dependent_exception * __cxa_allocate_dependent_exception() throw(){ + __cxa_dependent_exception *retval; +- //The sizeof crap is required by Itanium ABI because we need to provide space for +- //accounting information which is implementaion (gcc) specified ++ // The sizeof crap is required by Itanium ABI because we need to ++ // provide space for accounting information which is implementation ++ // (gcc) defined. + retval = static_cast<__cxa_dependent_exception*>(malloc (sizeof(__cxa_dependent_exception))); + if (0 == retval){ + std::terminate(); +@@ -58,4 +61,5 @@ extern "C" __cxa_dependent_exception * __cxa_allocate_dependent_exception() thro + extern "C" void __cxa_free_dependent_exception(__cxa_dependent_exception *vptr) throw(){ + free( (char *)(vptr) ); + } +-} ++ ++} /* namespace __cxxabiv1 */ +diff --git a/tests/newdeltest.cpp b/tests/newdeltest.cpp +index 9f8d775..06e41a1 100644 +--- a/tests/newdeltest.cpp ++++ b/tests/newdeltest.cpp +@@ -15,7 +15,7 @@ public: + base() : a(0){ + printf("Executing default base class constructor. a: %i\n", a); + } +- ++ + virtual ~base(){ + printf("Executing base class destructor\n"); + } +@@ -75,7 +75,7 @@ int main(){ + b = new sub[1]; + b[0].print(); + delete [] b; +- b = 0; ++ b = 0; + + printf("Testing nothrow new\n"); + +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/111-list-fix-splice-to-empty-list-from-other.begin.patch b/package/libs/uclibc++/patches/111-list-fix-splice-to-empty-list-from-other.begin.patch new file mode 100644 index 0000000000..7f92413531 --- /dev/null +++ b/package/libs/uclibc++/patches/111-list-fix-splice-to-empty-list-from-other.begin.patch @@ -0,0 +1,84 @@ +From c2fd3e7bac717eb783ee046b9a5639d6badcb86c Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Sun, 30 Sep 2018 20:42:31 +0200 +Subject: [PATCH] list: fix splice to empty list from other.begin() + +Fixes bug 11361 + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/list | 4 ++-- + tests/listtest.cpp | 26 +++++++++++++++++++++++++- + tests/testoutput/listtest.good | 4 ++++ + 3 files changed, 31 insertions(+), 3 deletions(-) + +diff --git a/include/list b/include/list +index de8edad..1ef00fb 100644 +--- a/include/list ++++ b/include/list +@@ -604,8 +604,8 @@ namespace std{ + + //Insert at begining special case + if(position == begin()){ +- +- i.link_struct()->previous->next = i.link_struct()->next; ++ if (i.link_struct()->previous != 0) ++ i.link_struct()->previous->next = i.link_struct()->next; + i.link_struct()->next->previous = i.link_struct()->previous; + + i.link_struct()->previous = 0; +diff --git a/tests/listtest.cpp b/tests/listtest.cpp +index c8aa0dd..639654c 100644 +--- a/tests/listtest.cpp ++++ b/tests/listtest.cpp +@@ -337,7 +337,31 @@ int main(){ + ++list_iter_1; + } + std::cout << std::endl; +- ++ ++ ++ /* bug 11361: splice to empty list from other.begin() segfaulted */ ++ temp.clear(); ++ a.clear(); ++ temp.push_back(1.0); ++ temp.push_back(2.0); ++ a.splice(a.end(), temp, temp.begin()); ++ std::cout << "temp.size(): " << temp.size() << std::endl; ++ std::cout << "a.size(): " << a.size() << std::endl; ++ std::cout << "temp:"; ++ i = temp.begin(); ++ while(i != temp.end()){ ++ std::cout << " " << *i; ++ ++i; ++ } ++ std::cout << std::endl; ++ std::cout << "a:"; ++ i = a.begin(); ++ while(i != a.end()){ ++ std::cout << " " << *i; ++ ++i; ++ } ++ std::cout << std::endl; ++ + + std::cout << "Testing operator=()\n"; + temp.clear(); +diff --git a/tests/testoutput/listtest.good b/tests/testoutput/listtest.good +index f830dc8..2434490 100644 +--- a/tests/testoutput/listtest.good ++++ b/tests/testoutput/listtest.good +@@ -93,6 +93,10 @@ The following two lines should be identical + The following two lines should be identical + 1 3 4 2 + 1 3 4 2 ++temp.size(): 1 ++a.size(): 1 ++temp: 2 ++a: 1 + Testing operator=() + The following three lines should be identical + 12.8 22.4 37.9 48.5 21.2 85.4 24.6 69.7 +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/112-cstdio-conditionalize-tmpnam.patch b/package/libs/uclibc++/patches/112-cstdio-conditionalize-tmpnam.patch new file mode 100644 index 0000000000..fd1aa5cad9 --- /dev/null +++ b/package/libs/uclibc++/patches/112-cstdio-conditionalize-tmpnam.patch @@ -0,0 +1,41 @@ +From 26cf67ef536de3872c6cbab1f9a146415bc65940 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Sun, 30 Sep 2018 20:45:35 +0200 +Subject: [PATCH] cstdio: conditionalize tmpnam + +GCC added a configure check for tmpnam() in +e1150b06d0409baf4b71121be0cafeab180f2858 (a.k.a svn r207009) + +POSIX.1-2008 (SUSv4) marks tmpnam() as obsolescent. As such it is not +available in uClibc unless SUSv4 legacy stuff is enabled. + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/cstdio | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/include/cstdio b/include/cstdio +index 8f4df27..8699385 100644 +--- a/include/cstdio ++++ b/include/cstdio +@@ -48,6 +48,7 @@ namespace std{ + using ::getc; + using ::getchar; + #if __cplusplus <= 201103L ++ // LWG 2249 + using ::gets; + #endif + using ::perror; +@@ -64,7 +65,9 @@ namespace std{ + using ::sprintf; + using ::sscanf; + using ::tmpfile; ++#if _GLIBCXX_USE_TMPNAM + using ::tmpnam; ++#endif + using ::ungetc; + using ::vfprintf; + using ::vprintf; +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/113-silence-c-11-dynamic-exception-specification-depreca.patch b/package/libs/uclibc++/patches/113-silence-c-11-dynamic-exception-specification-depreca.patch new file mode 100644 index 0000000000..8d8f1be720 --- /dev/null +++ b/package/libs/uclibc++/patches/113-silence-c-11-dynamic-exception-specification-depreca.patch @@ -0,0 +1,831 @@ +From f1f6d566c93d6491e291044ddec2fd19d4ac0662 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Mon, 1 Oct 2018 21:39:02 +0200 +Subject: [PATCH] *: silence c++11 dynamic exception specification deprecation + +warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated] + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/basic_definitions | 22 ++++++++++++++++++++++ + include/exception | 16 ++++++++-------- + include/functional | 8 ++++---- + include/ios | 2 +- + include/iterator | 14 +++++++------- + include/locale | 10 +++++----- + include/memory | 34 +++++++++++++++++----------------- + include/new | 32 ++++++++++++++++---------------- + include/stdexcept | 24 ++++++++++++------------ + include/typeinfo | 8 ++++---- + include/unwind-cxx.h | 16 ++++++++-------- + src/del_op.cpp | 2 +- + src/del_opnt.cpp | 2 +- + src/del_ops.cpp | 2 +- + src/del_opv.cpp | 2 +- + src/del_opvnt.cpp | 2 +- + src/del_opvs.cpp | 2 +- + src/eh_alloc.cpp | 8 ++++---- + src/eh_globals.cpp | 4 ++-- + src/exception.cpp | 6 +++--- + src/new_handler.cpp | 2 +- + src/new_op.cpp | 3 ++- + src/new_opnt.cpp | 2 +- + src/new_opv.cpp | 2 +- + src/new_opvnt.cpp | 2 +- + src/stdexcept.cpp | 6 +++--- + src/typeinfo.cpp | 4 ++-- + 27 files changed, 130 insertions(+), 107 deletions(-) + +diff --git a/include/basic_definitions b/include/basic_definitions +index d4b6cd5..9936563 100644 +--- a/include/basic_definitions ++++ b/include/basic_definitions +@@ -39,6 +39,28 @@ + #define __UCLIBCXX_NORETURN + #endif + ++#ifdef __GCC__ ++# ifndef _UCXX_NOTHROW ++# ifndef __cplusplus ++# define _UCXX_NOTHROW __attribute__((__nothrow__)) ++# endif ++# endif ++#endif ++#ifdef __cplusplus ++# if __cplusplus >= 201103L ++# define _UCXX_NOEXCEPT noexcept ++# define _UCXX_USE_NOEXCEPT noexcept ++# define _UCXX_THROW(_EXCEPTION) ++# else ++# define _UCXX_NOEXCEPT ++# define _UCXX_USE_NOEXCEPT throw() ++# define _UCXX_THROW(_EXCEPTION) throw(_EXCEPTION) ++# endif ++# ifndef _UCXX_NOTHROW ++# define _UCXX_NOTHROW _UCXX_USE_NOEXCEPT ++# endif ++#endif ++ + #ifdef __UCLIBCXX_HAS_TLS__ + #define __UCLIBCXX_TLS __thread + #else +diff --git a/include/exception b/include/exception +index bdf393e..0cccc9c 100644 +--- a/include/exception ++++ b/include/exception +@@ -54,11 +54,11 @@ namespace std + class exception + { + public: +- exception() throw() { } +- virtual ~exception() throw(); ++ exception() _UCXX_NOTHROW { } ++ virtual ~exception() _UCXX_NOTHROW; + /** Returns a C-style character string describing the general cause + * of the current error. */ +- virtual const char* what() const throw(); ++ virtual const char* what() const _UCXX_NOTHROW; + }; + + /** If an %exception is thrown which is not listed in a function's +@@ -66,10 +66,10 @@ namespace std + class bad_exception : public exception + { + public: +- bad_exception() throw() { } ++ bad_exception() _UCXX_USE_NOEXCEPT { } + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 +- virtual ~bad_exception() throw(); ++ virtual ~bad_exception() _UCXX_USE_NOEXCEPT; + }; + + /// If you write a replacement %terminate handler, it must be of this type. +@@ -78,13 +78,13 @@ namespace std + typedef void (*unexpected_handler) (); + + /// Takes a new handler function as an argument, returns the old function. +- terminate_handler set_terminate(terminate_handler) throw(); ++ terminate_handler set_terminate(terminate_handler) _UCXX_USE_NOEXCEPT; + /** The runtime will call this function if %exception handling must be + * abandoned for any reason. */ + void terminate() __UCLIBCXX_NORETURN; + + /// Takes a new handler function as an argument, returns the old function. +- unexpected_handler set_unexpected(unexpected_handler) throw(); ++ unexpected_handler set_unexpected(unexpected_handler) _UCXX_USE_NOEXCEPT; + /** The runtime will call this function if an %exception is thrown which + * violates the function's %exception specification. */ + void unexpected() __UCLIBCXX_NORETURN; +@@ -99,7 +99,7 @@ namespace std + * 2: "When @c uncaught_exception() is true, throwing an %exception can + * result in a call of @c terminate() (15.5.1)." + */ +- bool uncaught_exception() throw(); ++ bool uncaught_exception() _UCXX_USE_NOEXCEPT; + } // namespace std + + namespace __gnu_cxx +diff --git a/include/functional b/include/functional +index b7932e2..ae9ed4b 100644 +--- a/include/functional ++++ b/include/functional +@@ -137,25 +137,25 @@ namespace std{ + }; + + template <class T> struct _UCXXEXPORT greater : binary_function<T,T,bool>{ +- bool operator()(const T& x, const T& y) const{ ++ bool operator()(const T& x, const T& y) const _UCXX_NOTHROW { + return (x > y); + } + }; + + template <class T> struct _UCXXEXPORT less : binary_function<T,T,bool>{ +- bool operator()(const T& x, const T& y) const{ ++ bool operator()(const T& x, const T& y) const _UCXX_NOTHROW { + return (x < y); + } + }; + + template <class T> struct _UCXXEXPORT greater_equal : binary_function<T,T,bool>{ +- bool operator()(const T& x, const T& y) const{ ++ bool operator()(const T& x, const T& y) const _UCXX_NOTHROW { + return (x >= y); + } + }; + + template <class T> struct _UCXXEXPORT less_equal : binary_function<T,T,bool>{ +- bool operator()(const T& x, const T& y) const{ ++ bool operator()(const T& x, const T& y) const _UCXX_NOTHROW { + return (x <= y); + } + }; +diff --git a/include/ios b/include/ios +index 63dc4ed..31f2211 100644 +--- a/include/ios ++++ b/include/ios +@@ -40,7 +40,7 @@ namespace std{ + public: + explicit failure(const std::string&) { } + explicit failure() { } +- virtual const char* what() const throw() { ++ virtual const char* what() const _UCXX_USE_NOEXCEPT { + return "std::ios_base failure exception"; + } + }; +diff --git a/include/iterator b/include/iterator +index b3d81b2..32d64aa 100644 +--- a/include/iterator ++++ b/include/iterator +@@ -145,10 +145,10 @@ namespace std{ + charT operator*() { return val; } + }; + +- istreambuf_iterator() throw() : sbuf(0) { } +- istreambuf_iterator(istream_type& s) throw() : sbuf(s.rdbuf()) { } +- istreambuf_iterator(streambuf_type* s) throw() : sbuf(s) { } +- istreambuf_iterator(const proxy& p) throw() : sbuf(&p.buf) { } ++ istreambuf_iterator() _UCXX_USE_NOEXCEPT : sbuf(0) { } ++ istreambuf_iterator(istream_type& s) _UCXX_USE_NOEXCEPT : sbuf(s.rdbuf()) { } ++ istreambuf_iterator(streambuf_type* s) _UCXX_USE_NOEXCEPT : sbuf(s) { } ++ istreambuf_iterator(const proxy& p) _UCXX_USE_NOEXCEPT : sbuf(&p.buf) { } + + charT operator*() const{ + return sbuf->sgetc(); +@@ -196,8 +196,8 @@ namespace std{ + typedef basic_streambuf<charT,traits> streambuf_type; + typedef basic_ostream<charT,traits> ostream_type; + public: +- ostreambuf_iterator(ostream_type& s) throw() : sbuf(s.rdbuf()), f(false) { } +- ostreambuf_iterator(streambuf_type* s) throw() : sbuf(s), f(false) { } ++ ostreambuf_iterator(ostream_type& s) _UCXX_USE_NOEXCEPT : sbuf(s.rdbuf()), f(false) { } ++ ostreambuf_iterator(streambuf_type* s) _UCXX_USE_NOEXCEPT : sbuf(s), f(false) { } + ostreambuf_iterator& operator=(charT c){ + if(failed() == false){ + if(sbuf->sputc(c) == traits::eof()){ +@@ -211,7 +211,7 @@ namespace std{ + } + ostreambuf_iterator& operator++() { return *this; } + ostreambuf_iterator operator++(int) { return *this; } +- bool failed() const throw(){ ++ bool failed() const _UCXX_USE_NOEXCEPT{ + return f; + } + +diff --git a/include/locale b/include/locale +index 96e6bc9..ed4dfa3 100644 +--- a/include/locale ++++ b/include/locale +@@ -42,21 +42,21 @@ namespace std{ + all = collate | ctype | monetary | numeric | time | messages; + + // construct/copy/destroy: +- locale() throw(){ ++ locale() _UCXX_USE_NOEXCEPT{ + return; + } +- locale(const locale& other) throw(){ ++ locale(const locale& other) _UCXX_USE_NOEXCEPT{ + (void)other; + return; + } +- locale(const char *) throw(){ ++ locale(const char *) _UCXX_USE_NOEXCEPT{ + return; + } +- ~locale() throw(){ ++ ~locale() _UCXX_USE_NOEXCEPT{ + return; + } + +- const locale& operator=(const locale&) throw(){ ++ const locale& operator=(const locale&) _UCXX_USE_NOEXCEPT{ + return *this; + } + std::string name() const { return "C"; } +diff --git a/include/memory b/include/memory +index 2a7ce8c..9ce6559 100644 +--- a/include/memory ++++ b/include/memory +@@ -57,9 +57,9 @@ public: + pointer address(reference r) const { return &r; } + const_pointer address(const_reference r) const { return &r; } + +- allocator() throw(){} +- template <class U> allocator(const allocator<U>& ) throw(); +- ~allocator() throw(){} ++ allocator() _UCXX_USE_NOEXCEPT{} ++ template <class U> allocator(const allocator<U>& ) _UCXX_USE_NOEXCEPT; ++ ~allocator() _UCXX_USE_NOEXCEPT{} + + //Space for n Ts + pointer allocate(size_type n, typename allocator<void>::const_pointer = 0){ +@@ -73,7 +73,7 @@ public: + void construct(pointer p, const T& val) { new((void*)p) T(val); } + void destroy(pointer p){ ((T*)p)->~T(); } //Call destructor + +- size_type max_size() const throw(); ++ size_type max_size() const _UCXX_USE_NOEXCEPT; + template<class U> struct rebind { typedef allocator<U> other; }; + + }; +@@ -128,13 +128,13 @@ public: + + typedef T element_type; + +- explicit auto_ptr(T* p =0) throw() : object(p){ } +- auto_ptr(auto_ptr& p) throw() : object(p.release()){ } +- auto_ptr(auto_ptr_ref<T> r) throw() : object(r.p){ ++ explicit auto_ptr(T* p =0) _UCXX_USE_NOEXCEPT : object(p){ } ++ auto_ptr(auto_ptr& p) _UCXX_USE_NOEXCEPT : object(p.release()){ } ++ auto_ptr(auto_ptr_ref<T> r) _UCXX_USE_NOEXCEPT : object(r.p){ + r.p = 0; + } +- template<class Y> auto_ptr(auto_ptr<Y>& p) throw() : object(p.release()){ } +- auto_ptr& operator=(auto_ptr& p) throw(){ ++ template<class Y> auto_ptr(auto_ptr<Y>& p) _UCXX_USE_NOEXCEPT : object(p.release()){ } ++ auto_ptr& operator=(auto_ptr& p) _UCXX_USE_NOEXCEPT{ + if(&p == this){ + return *this; + } +@@ -142,7 +142,7 @@ public: + object = p.release(); + return *this; + } +- template<class Y> auto_ptr& operator=(auto_ptr<Y>& p) throw(){ ++ template<class Y> auto_ptr& operator=(auto_ptr<Y>& p) _UCXX_USE_NOEXCEPT{ + if(&p == this){ + return *this; + } +@@ -154,33 +154,33 @@ public: + delete object; + } + +- T& operator*() const throw(){ ++ T& operator*() const _UCXX_USE_NOEXCEPT{ + return *object; + } +- T* operator->() const throw(){ ++ T* operator->() const _UCXX_USE_NOEXCEPT{ + return object; + } +- T* get() const throw(){ ++ T* get() const _UCXX_USE_NOEXCEPT{ + return object; + } +- T* release() throw(){ ++ T* release() _UCXX_USE_NOEXCEPT{ + T * temp(object); + object = 0; + return temp; + } +- void reset(T * p=0) throw(){ ++ void reset(T * p=0) _UCXX_USE_NOEXCEPT{ + if(p != object){ + delete object; + object = p; + } + } +- template<class Y> operator auto_ptr_ref<Y>() throw(){ ++ template<class Y> operator auto_ptr_ref<Y>() _UCXX_USE_NOEXCEPT{ + auto_ptr_ref<Y> retval; + retval.p = object; + object = 0; + return retval; + } +- template<class Y> operator auto_ptr<Y>() throw(){ ++ template<class Y> operator auto_ptr<Y>() _UCXX_USE_NOEXCEPT{ + auto_ptr<Y> retval(object); + object = 0; + return retval; +diff --git a/include/new b/include/new +index 0949a09..6214b11 100644 +--- a/include/new ++++ b/include/new +@@ -33,36 +33,36 @@ namespace std{ + extern const nothrow_t nothrow; + + typedef void (*new_handler)(); +- _UCXXEXPORT new_handler set_new_handler(new_handler new_p) throw(); ++ _UCXXEXPORT new_handler set_new_handler(new_handler new_p) _UCXX_USE_NOEXCEPT; + } + + +-_UCXXEXPORT void* operator new(std::size_t numBytes) throw(std::bad_alloc); +-_UCXXEXPORT void operator delete(void* ptr) throw(); ++_UCXXEXPORT void* operator new(std::size_t numBytes) _UCXX_THROW(std::bad_alloc); ++_UCXXEXPORT void operator delete(void* ptr) _UCXX_USE_NOEXCEPT; + #if __cpp_sized_deallocation +-_UCXXEXPORT void operator delete(void* ptr, std::size_t) throw(); ++_UCXXEXPORT void operator delete(void* ptr, std::size_t) _UCXX_USE_NOEXCEPT; + #endif + +-_UCXXEXPORT void* operator new[](std::size_t numBytes) throw(std::bad_alloc); +-_UCXXEXPORT void operator delete[](void * ptr) throw(); ++_UCXXEXPORT void* operator new[](std::size_t numBytes) _UCXX_THROW(std::bad_alloc); ++_UCXXEXPORT void operator delete[](void * ptr) _UCXX_USE_NOEXCEPT; + #if __cpp_sized_deallocation +-_UCXXEXPORT void operator delete[](void * ptr, std::size_t) throw(); ++_UCXXEXPORT void operator delete[](void * ptr, std::size_t) _UCXX_USE_NOEXCEPT; + #endif + + #ifndef NO_NOTHROW +-_UCXXEXPORT void* operator new(std::size_t numBytes, const std::nothrow_t& ) throw(); +-_UCXXEXPORT void operator delete(void* ptr, const std::nothrow_t& ) throw(); ++_UCXXEXPORT void* operator new(std::size_t numBytes, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT; ++_UCXXEXPORT void operator delete(void* ptr, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT; + +-_UCXXEXPORT void* operator new[](std::size_t numBytes, const std::nothrow_t& ) throw(); +-_UCXXEXPORT void operator delete[](void* ptr, const std::nothrow_t& ) throw(); ++_UCXXEXPORT void* operator new[](std::size_t numBytes, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT; ++_UCXXEXPORT void operator delete[](void* ptr, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT; + #endif + + /* Placement operators */ +-inline void* operator new(std::size_t, void* ptr) throw() {return ptr; } +-inline void operator delete(void* , void *) throw() { } +- +-inline void* operator new[](std::size_t, void *p) throw() { return p; } +-inline void operator delete[](void* , void *) throw() {} ++inline void* operator new(std::size_t, void* ptr) _UCXX_USE_NOEXCEPT {return ptr; } ++inline void operator delete(void* , void *) _UCXX_USE_NOEXCEPT { } ++ ++inline void* operator new[](std::size_t, void *p) _UCXX_USE_NOEXCEPT { return p; } ++inline void operator delete[](void* , void *) _UCXX_USE_NOEXCEPT {} + + #pragma GCC visibility pop + +diff --git a/include/stdexcept b/include/stdexcept +index 7557f24..76c3870 100644 +--- a/include/stdexcept ++++ b/include/stdexcept +@@ -37,11 +37,11 @@ class _UCXXEXPORT logic_error : public exception { + protected: + string mstring; + public: +- logic_error() throw(); ++ logic_error() _UCXX_USE_NOEXCEPT; + logic_error(const string& what_arg); + +- virtual ~logic_error() throw() {} +- virtual const char * what() const throw(); ++ virtual ~logic_error() _UCXX_USE_NOEXCEPT {} ++ virtual const char * what() const _UCXX_USE_NOEXCEPT; + + }; + +@@ -49,28 +49,28 @@ class _UCXXEXPORT domain_error : public logic_error { + public: + domain_error() : logic_error() {} + domain_error(const string& what_arg) : logic_error(what_arg) {} +- virtual ~domain_error() throw() {} ++ virtual ~domain_error() _UCXX_USE_NOEXCEPT {} + }; + + class _UCXXEXPORT invalid_argument : public logic_error { + public: + invalid_argument() : logic_error(){} + invalid_argument(const string& what_arg) : logic_error(what_arg){} +- virtual ~invalid_argument() throw() {} ++ virtual ~invalid_argument() _UCXX_USE_NOEXCEPT {} + }; + + class _UCXXEXPORT length_error : public logic_error { + public: + length_error() : logic_error(){} + length_error(const string& what_arg) : logic_error(what_arg){} +- virtual ~length_error() throw() {} ++ virtual ~length_error() _UCXX_USE_NOEXCEPT {} + }; + + class _UCXXEXPORT out_of_range : public logic_error{ + public: + out_of_range(); + out_of_range(const string & what_arg); +- virtual ~out_of_range() throw() {} ++ virtual ~out_of_range() _UCXX_USE_NOEXCEPT {} + + }; + +@@ -81,15 +81,15 @@ public: + runtime_error(); + runtime_error(const string& what_arg); + +- virtual ~runtime_error() throw() {} +- virtual const char * what() const throw(); ++ virtual ~runtime_error() _UCXX_USE_NOEXCEPT {} ++ virtual const char * what() const _UCXX_USE_NOEXCEPT; + }; + + class _UCXXEXPORT range_error : public runtime_error{ + public: + range_error() : runtime_error(){} + range_error(const string& what_arg) : runtime_error(what_arg) {} +- virtual ~range_error() throw(){ } ++ virtual ~range_error() _UCXX_USE_NOEXCEPT{ } + }; + + +@@ -97,14 +97,14 @@ class _UCXXEXPORT overflow_error : public runtime_error{ + public: + overflow_error() : runtime_error(){} + overflow_error(const string& what_arg) : runtime_error(what_arg) {} +- virtual ~overflow_error() throw(){} ++ virtual ~overflow_error() _UCXX_USE_NOEXCEPT{} + }; + + class _UCXXEXPORT underflow_error : public runtime_error{ + public: + underflow_error() : runtime_error(){} + underflow_error(const string& what_arg) : runtime_error(what_arg) {} +- virtual ~underflow_error() throw(){} ++ virtual ~underflow_error() _UCXX_USE_NOEXCEPT{} + }; + + +diff --git a/include/typeinfo b/include/typeinfo +index 88a2639..7863af2 100644 +--- a/include/typeinfo ++++ b/include/typeinfo +@@ -137,20 +137,20 @@ namespace std + class bad_cast : public exception + { + public: +- bad_cast() throw() { } ++ bad_cast() _UCXX_USE_NOEXCEPT { } + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 +- virtual ~bad_cast() throw(); ++ virtual ~bad_cast() _UCXX_USE_NOEXCEPT; + }; + + /** If you use a NULL pointer in a @c typeid expression, this is thrown. */ + class bad_typeid : public exception + { + public: +- bad_typeid () throw() { } ++ bad_typeid () _UCXX_USE_NOEXCEPT { } + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 +- virtual ~bad_typeid() throw(); ++ virtual ~bad_typeid() _UCXX_USE_NOEXCEPT; + }; + } // namespace std + +diff --git a/include/unwind-cxx.h b/include/unwind-cxx.h +index e001343..999aba3 100644 +--- a/include/unwind-cxx.h ++++ b/include/unwind-cxx.h +@@ -140,18 +140,18 @@ struct __cxa_eh_globals + // either of the following functions. The "fast" version assumes at least + // one prior call of __cxa_get_globals has been made from the current + // thread, so no initialization is necessary. +-extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); +-extern "C" __cxa_eh_globals *__cxa_get_globals_fast () throw(); ++extern "C" __cxa_eh_globals *__cxa_get_globals () _UCXX_USE_NOEXCEPT; ++extern "C" __cxa_eh_globals *__cxa_get_globals_fast () _UCXX_USE_NOEXCEPT; + + // Allocate memory for the primary exception plus the thrown object. +-extern "C" void *__cxa_allocate_exception(std::size_t thrown_size) throw(); ++extern "C" void *__cxa_allocate_exception(std::size_t thrown_size) _UCXX_USE_NOEXCEPT; + // Allocate memory for dependent exception. +-extern "C" __cxa_dependent_exception *__cxa_allocate_dependent_exception() throw(); ++extern "C" __cxa_dependent_exception *__cxa_allocate_dependent_exception() _UCXX_USE_NOEXCEPT; + + // Free the space allocated for the primary exception. +-extern "C" void __cxa_free_exception(void *thrown_exception) throw(); ++extern "C" void __cxa_free_exception(void *thrown_exception) _UCXX_USE_NOEXCEPT; + // Free the space allocated for the dependent exception. +-extern "C" void __cxa_free_dependent_exception(__cxa_dependent_exception *dependent_exception) throw(); ++extern "C" void __cxa_free_dependent_exception(__cxa_dependent_exception *dependent_exception) _UCXX_USE_NOEXCEPT; + + // Throw the exception. + extern "C" void __cxa_throw (void *thrown_exception, +@@ -160,7 +160,7 @@ extern "C" void __cxa_throw (void *thrown_exception, + __attribute__((noreturn)); + + // Used to implement exception handlers. +-extern "C" void *__cxa_begin_catch (void *) throw(); ++extern "C" void *__cxa_begin_catch (void *) _UCXX_USE_NOEXCEPT; + extern "C" void __cxa_end_catch (); + extern "C" void __cxa_rethrow () __attribute__((noreturn)); + +@@ -177,7 +177,7 @@ extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn)); + + // Invokes given handler, dying appropriately if the user handler was + // so inconsiderate as to return. +-extern void __terminate(std::terminate_handler) throw () __attribute__((noreturn)); ++extern void __terminate(std::terminate_handler) _UCXX_USE_NOEXCEPT __attribute__((noreturn)); + extern void __unexpected(std::unexpected_handler) __attribute__((noreturn)); + + // The current installed user handlers. +diff --git a/src/del_op.cpp b/src/del_op.cpp +index f5a3695..9485cee 100644 +--- a/src/del_op.cpp ++++ b/src/del_op.cpp +@@ -21,6 +21,6 @@ + #include <cstdlib> + #include <func_exception> + +-_UCXXEXPORT void operator delete(void* ptr) throw(){ ++_UCXXEXPORT void operator delete(void* ptr) _UCXX_USE_NOEXCEPT{ + free(ptr); + } +diff --git a/src/del_opnt.cpp b/src/del_opnt.cpp +index 96cb03b..4825912 100644 +--- a/src/del_opnt.cpp ++++ b/src/del_opnt.cpp +@@ -22,7 +22,7 @@ + #include <func_exception> + + #ifndef NO_NOTHROW +-_UCXXEXPORT void operator delete(void* ptr, const std::nothrow_t& ) throw() { ++_UCXXEXPORT void operator delete(void* ptr, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT { + free(ptr); + } + #endif +diff --git a/src/del_ops.cpp b/src/del_ops.cpp +index e292b03..b914fc5 100644 +--- a/src/del_ops.cpp ++++ b/src/del_ops.cpp +@@ -22,6 +22,6 @@ + #include <cstdlib> + #include <func_exception> + +-_UCXXEXPORT void operator delete(void* ptr, std::size_t) throw(){ ++_UCXXEXPORT void operator delete(void* ptr, std::size_t) _UCXX_USE_NOEXCEPT{ + ::operator delete (ptr); + } +diff --git a/src/del_opv.cpp b/src/del_opv.cpp +index 028e86f..deaad78 100644 +--- a/src/del_opv.cpp ++++ b/src/del_opv.cpp +@@ -21,6 +21,6 @@ + #include <cstdlib> + #include <func_exception> + +-_UCXXEXPORT void operator delete[](void * ptr) throw(){ ++_UCXXEXPORT void operator delete[](void * ptr) _UCXX_USE_NOEXCEPT{ + free(ptr); + } +diff --git a/src/del_opvnt.cpp b/src/del_opvnt.cpp +index f2a2a36..71b7631 100644 +--- a/src/del_opvnt.cpp ++++ b/src/del_opvnt.cpp +@@ -22,7 +22,7 @@ + #include <func_exception> + + #ifndef NO_NOTHROW +-_UCXXEXPORT void operator delete[](void* ptr, const std::nothrow_t& ) throw(){ ++_UCXXEXPORT void operator delete[](void* ptr, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT{ + free(ptr); + } + #endif +diff --git a/src/del_opvs.cpp b/src/del_opvs.cpp +index 1c92d1f..53ab7cc 100644 +--- a/src/del_opvs.cpp ++++ b/src/del_opvs.cpp +@@ -22,6 +22,6 @@ + #include <cstdlib> + #include <func_exception> + +-_UCXXEXPORT void operator delete[](void * ptr, std::size_t) throw(){ ++_UCXXEXPORT void operator delete[](void * ptr, std::size_t) _UCXX_USE_NOEXCEPT{ + ::operator delete[] (ptr); + } +diff --git a/src/eh_alloc.cpp b/src/eh_alloc.cpp +index cdf28e0..270ef10 100644 +--- a/src/eh_alloc.cpp ++++ b/src/eh_alloc.cpp +@@ -27,7 +27,7 @@ + namespace __cxxabiv1 + { + +-extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw(){ ++extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) _UCXX_USE_NOEXCEPT{ + void *e; + // The sizeof crap is required by Itanium ABI because we need to + // provide space for accounting information which is implementation +@@ -40,12 +40,12 @@ extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw(){ + return (void *)((unsigned char *)e + sizeof(__cxa_refcounted_exception)); + } + +-extern "C" void __cxa_free_exception(void *vptr) throw(){ ++extern "C" void __cxa_free_exception(void *vptr) _UCXX_USE_NOEXCEPT{ + free( (char *)(vptr) - sizeof(__cxa_refcounted_exception) ); + } + + +-extern "C" __cxa_dependent_exception * __cxa_allocate_dependent_exception() throw(){ ++extern "C" __cxa_dependent_exception * __cxa_allocate_dependent_exception() _UCXX_USE_NOEXCEPT{ + __cxa_dependent_exception *retval; + // The sizeof crap is required by Itanium ABI because we need to + // provide space for accounting information which is implementation +@@ -58,7 +58,7 @@ extern "C" __cxa_dependent_exception * __cxa_allocate_dependent_exception() thro + return retval; + } + +-extern "C" void __cxa_free_dependent_exception(__cxa_dependent_exception *vptr) throw(){ ++extern "C" void __cxa_free_dependent_exception(__cxa_dependent_exception *vptr) _UCXX_USE_NOEXCEPT{ + free( (char *)(vptr) ); + } + +diff --git a/src/eh_globals.cpp b/src/eh_globals.cpp +index 38d4583..9915433 100644 +--- a/src/eh_globals.cpp ++++ b/src/eh_globals.cpp +@@ -31,11 +31,11 @@ namespace __cxxabiv1{ + + static __UCLIBCXX_TLS __cxa_eh_globals eh_globals; + +-extern "C" __cxa_eh_globals* __cxa_get_globals() throw(){ ++extern "C" __cxa_eh_globals* __cxa_get_globals() _UCXX_USE_NOEXCEPT{ + return &eh_globals; + } + +-extern "C" __cxa_eh_globals* __cxa_get_globals_fast() throw(){ ++extern "C" __cxa_eh_globals* __cxa_get_globals_fast() _UCXX_USE_NOEXCEPT{ + return &eh_globals; + } + +diff --git a/src/exception.cpp b/src/exception.cpp +index 82021dd..5f4e896 100644 +--- a/src/exception.cpp ++++ b/src/exception.cpp +@@ -33,15 +33,15 @@ namespace std{ + //We are providing our own versions to be sneaky + + +- _UCXXEXPORT exception::~exception() throw(){ ++ _UCXXEXPORT exception::~exception() _UCXX_USE_NOEXCEPT{ + //Empty function + } + +- _UCXXEXPORT const char* exception::what() const throw(){ ++ _UCXXEXPORT const char* exception::what() const _UCXX_USE_NOEXCEPT{ + return __std_exception_what_value; + } + +- _UCXXEXPORT bad_exception::~bad_exception() throw(){ ++ _UCXXEXPORT bad_exception::~bad_exception() _UCXX_USE_NOEXCEPT{ + + } + +diff --git a/src/new_handler.cpp b/src/new_handler.cpp +index 1d85ee3..a6efb9c 100644 +--- a/src/new_handler.cpp ++++ b/src/new_handler.cpp +@@ -24,7 +24,7 @@ const std::nothrow_t std::nothrow = { }; + //Name selected to be compatable with g++ code + std::new_handler __new_handler; + +-_UCXXEXPORT std::new_handler std::set_new_handler(std::new_handler new_p) throw(){ ++_UCXXEXPORT std::new_handler std::set_new_handler(std::new_handler new_p) _UCXX_USE_NOEXCEPT{ + std::new_handler retval = __new_handler; + __new_handler = new_p; + return retval; +diff --git a/src/new_op.cpp b/src/new_op.cpp +index 764eb83..b0d2b78 100644 +--- a/src/new_op.cpp ++++ b/src/new_op.cpp +@@ -21,7 +21,8 @@ + #include <cstdlib> + #include <func_exception> + +-_UCXXEXPORT void* operator new(std::size_t numBytes) throw(std::bad_alloc){ ++_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: + if(numBytes == 0){ +diff --git a/src/new_opnt.cpp b/src/new_opnt.cpp +index cffce61..c37903e 100644 +--- a/src/new_opnt.cpp ++++ b/src/new_opnt.cpp +@@ -22,7 +22,7 @@ + #include <func_exception> + + #ifndef NO_NOTHROW +-_UCXXEXPORT void* operator new(std::size_t numBytes, const std::nothrow_t& ) throw(){ ++_UCXXEXPORT void* operator new(std::size_t numBytes, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT{ + return malloc(numBytes); + } + #endif +diff --git a/src/new_opv.cpp b/src/new_opv.cpp +index ef416e0..e39d5e5 100644 +--- a/src/new_opv.cpp ++++ b/src/new_opv.cpp +@@ -21,7 +21,7 @@ + #include <cstdlib> + #include <func_exception> + +-_UCXXEXPORT void* operator new[](std::size_t numBytes) throw(std::bad_alloc){ ++_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: + if(numBytes == 0){ +diff --git a/src/new_opvnt.cpp b/src/new_opvnt.cpp +index 3ea592a..4874a7f 100644 +--- a/src/new_opvnt.cpp ++++ b/src/new_opvnt.cpp +@@ -22,7 +22,7 @@ + #include <func_exception> + + #ifndef NO_NOTHROW +-_UCXXEXPORT void* operator new[](std::size_t numBytes, const std::nothrow_t& ) throw(){ ++_UCXXEXPORT void* operator new[](std::size_t numBytes, const std::nothrow_t& ) _UCXX_USE_NOEXCEPT{ + return malloc(numBytes); + } + #endif +diff --git a/src/stdexcept.cpp b/src/stdexcept.cpp +index 90dccc7..b812b6f 100644 +--- a/src/stdexcept.cpp ++++ b/src/stdexcept.cpp +@@ -24,7 +24,7 @@ + + namespace std{ + +- _UCXXEXPORT logic_error::logic_error() throw() : mstring(){ ++ _UCXXEXPORT logic_error::logic_error() _UCXX_USE_NOEXCEPT : mstring(){ + + } + +@@ -32,7 +32,7 @@ namespace std{ + + } + +- _UCXXEXPORT const char * logic_error::what() const throw(){ ++ _UCXXEXPORT const char * logic_error::what() const _UCXX_USE_NOEXCEPT{ + return mstring.c_str(); + } + +@@ -53,7 +53,7 @@ namespace std{ + + } + +- _UCXXEXPORT const char * runtime_error::what() const throw(){ ++ _UCXXEXPORT const char * runtime_error::what() const _UCXX_USE_NOEXCEPT{ + return mstring.c_str(); + } + +diff --git a/src/typeinfo.cpp b/src/typeinfo.cpp +index b8ea301..c9f9d23 100644 +--- a/src/typeinfo.cpp ++++ b/src/typeinfo.cpp +@@ -21,11 +21,11 @@ + + namespace std{ + +- _UCXXEXPORT bad_cast::~bad_cast() throw(){ ++ _UCXXEXPORT bad_cast::~bad_cast() _UCXX_USE_NOEXCEPT{ + + } + +- _UCXXEXPORT bad_typeid::~bad_typeid() throw(){ ++ _UCXXEXPORT bad_typeid::~bad_typeid() _UCXX_USE_NOEXCEPT{ + + } + +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/114-silence-some-warnings.patch b/package/libs/uclibc++/patches/114-silence-some-warnings.patch new file mode 100644 index 0000000000..9efbcd82b8 --- /dev/null +++ b/package/libs/uclibc++/patches/114-silence-some-warnings.patch @@ -0,0 +1,109 @@ +From e3c783264d1f11084f25f2fc527b054b524b72d6 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +Date: Mon, 1 Oct 2018 22:57:31 +0200 +Subject: [PATCH] *: silence some warnings + +in c++-98 mode as well as in c++-11 mode + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/fstream | 9 +++++---- + include/ios | 9 ++++++--- + include/istream | 3 ++- + include/iterator | 2 +- + 4 files changed, 14 insertions(+), 9 deletions(-) + +diff --git a/include/fstream b/include/fstream +index b8dd602..fddfa35 100644 +--- a/include/fstream ++++ b/include/fstream +@@ -66,9 +66,10 @@ namespace std{ + + //Constructors/destructor: + +- _UCXXEXPORT basic_filebuf() : basic_streambuf<charT, traits>(), fp(0), pbuffer(0), gbuffer(0) ++ _UCXXEXPORT basic_filebuf() ++ : basic_streambuf<charT, traits>(), fp(0), pbuffer(0), ++ gbuffer(0), append(false) + { +- append=false; + pbuffer = new char_type[__UCLIBCXX_IOSTREAM_BUFSIZE__]; + gbuffer = new char_type[__UCLIBCXX_IOSTREAM_BUFSIZE__]; + +@@ -375,12 +376,12 @@ namespace std{ + if(s == 0 && n == 0){ //Unbuffered + if(pbuffer !=0){ + delete [] pbuffer; ++ pbuffer = 0; + } + if(gbuffer !=0){ + delete [] gbuffer; ++ gbuffer = 0; + } +- pbuffer = 0; +- gbuffer = 0; + }else if(basic_streambuf<charT,traits>::gptr() !=0 && + basic_streambuf<charT,traits>::gptr()==basic_streambuf<charT,traits>::egptr()) + { +diff --git a/include/ios b/include/ios +index 31f2211..ac6566a 100644 +--- a/include/ios ++++ b/include/ios +@@ -139,13 +139,15 @@ namespace std{ + // long& iword(int index); + // void*& pword(int index); + +- _UCXXEXPORT ~ios_base() { } +- + enum event { erase_event, imbue_event, copyfmt_event }; + + typedef void (*event_callback)(event, ios_base&, int index); + // void register_callback(event_call_back fn, int index); + ++ virtual _UCXXEXPORT ~ios_base() { ++ /* would run erase_event callbacks here */ ++ } ++ + //We are going to wrap stdio so we don't need implementation of the following: + inline static bool sync_with_stdio(bool = true) { return true; } + +@@ -340,7 +342,8 @@ namespace std{ + throw_mask = except; + } + +- explicit _UCXXEXPORT basic_ios(basic_streambuf<charT,traits>* sb) : fill_char(' '), mtied(0), mstreambuf(0){ ++ explicit _UCXXEXPORT basic_ios(basic_streambuf<charT,traits>* sb) ++ : fill_char(' '), mtied(0), mstreambuf(0), throw_mask(0) { + init(sb); + } + +diff --git a/include/istream b/include/istream +index a6fe3de..850ac30 100644 +--- a/include/istream ++++ b/include/istream +@@ -345,7 +345,8 @@ namespace std{ + { + bool ok; + public: +- explicit _UCXXEXPORT sentry(basic_istream<charT,traits>& os, bool noskipws = false){ ++ explicit _UCXXEXPORT sentry(basic_istream<charT,traits>& os, bool noskipws = false) ++ : ok(false){ + if(os.good() !=0){ //Prepare for output + } + +diff --git a/include/iterator b/include/iterator +index 32d64aa..d65f467 100644 +--- a/include/iterator ++++ b/include/iterator +@@ -157,7 +157,7 @@ namespace std{ + sbuf->sbumpc(); + return *this; + } +- proxy operator++(int){ ++ istreambuf_iterator<charT,traits> operator++(int){ + istreambuf_iterator<charT,traits> tmp = *this; + sbuf->sbumpc(); + return(tmp); +-- +2.20.1 + diff --git a/package/libs/uclibc++/patches/115-Fix-erase-on-derived-__base_associative.patch b/package/libs/uclibc++/patches/115-Fix-erase-on-derived-__base_associative.patch new file mode 100644 index 0000000000..22da965f07 --- /dev/null +++ b/package/libs/uclibc++/patches/115-Fix-erase-on-derived-__base_associative.patch @@ -0,0 +1,91 @@ +From da23783634c57174bd3a19a3c0c0cc4626bdd219 Mon Sep 17 00:00:00 2001 +From: Ben Kelly <b...@benjii.net> +Date: Fri, 5 Oct 2018 01:09:37 +0200 +Subject: [PATCH] Fix erase() on derived __base_associative + +When calling erase() on a containers derived from __base_associative +(e.g. multimap) and providing a pair of iterators a segfault will +occur. + +Example code to reproduce: + + typedef std::multimap<int, int> testmap; + testmap t; + t.insert(std::pair<int, int>(1, 1)); + t.insert(std::pair<int, int>(2, 1)); + t.insert(std::pair<int, int>(3, 1)); + t.erase(t.begin(), t.end()); + +Signed-off-by: Ben Kelly <b...@benjii.net> +Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com> +--- + include/associative_base | 3 +-- + tests/mmaptest.cpp | 17 +++++++++++++++++ + tests/testoutput/mmaptest.good | 4 ++-- + 3 files changed, 20 insertions(+), 4 deletions(-) + +diff --git a/include/associative_base b/include/associative_base +index 27ae0ef..be8b27f 100644 +--- a/include/associative_base ++++ b/include/associative_base +@@ -200,8 +200,7 @@ public: + } + void erase(iterator first, iterator last){ + while(first != last){ +- backing.erase(first.base_iterator()); +- ++first; ++ first = backing.erase(first.base_iterator()); + } + } + +diff --git a/tests/mmaptest.cpp b/tests/mmaptest.cpp +index fa5af6d..ee621c3 100644 +--- a/tests/mmaptest.cpp ++++ b/tests/mmaptest.cpp +@@ -130,6 +130,22 @@ bool test_positioned_insert(){ + return true; + } + ++static bool erase_both_iters() { ++ typedef std::multimap<int, int> testmap; ++ testmap tst; ++ tst.insert(std::pair<int, int>(1, 1)); ++ tst.insert(std::pair<int, int>(2, 1)); ++ tst.insert(std::pair<int, int>(3, 1)); ++ tst.erase(tst.begin(), tst.end()); ++ if (tst.empty() == true ++ && tst.size() == 0 ++ && tst.rbegin() == tst.rend() ++ && tst.begin() == tst.end() ++ && tst.find(42) == tst.end()) ++ return true; ++ return false; ++} ++ + + int main(){ + +@@ -137,6 +153,7 @@ int main(){ + + TestFramework::AssertReturns<bool>(test_added_elements, true); + TestFramework::AssertReturns<bool>(test_positioned_insert, true); ++ TestFramework::AssertReturns<bool>(erase_both_iters, true); + + TestFramework::results(); + +diff --git a/tests/testoutput/mmaptest.good b/tests/testoutput/mmaptest.good +index 3c74927..a08c83e 100644 +--- a/tests/testoutput/mmaptest.good ++++ b/tests/testoutput/mmaptest.good +@@ -1,6 +1,6 @@ +-.. ++... + ------------------------------ +-Ran 2 tests ++Ran 3 tests + + OK + Start of multimap test +-- +2.20.1 + -- 2.20.1 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel