[git commit] C++14 sized allocation

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Sat Mar 5 23:28:56 UTC 2016


commit: https://git.uclibc.org/uClibc++/commit/?id=288302797b8d9aa2c8b060159fcdd7acc4dc80f2
branch: https://git.uclibc.org/uClibc++/commit/?id=refs/heads/master

Fixes linking with gcc-6.0

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 Rules.mak        |  2 ++
 include/new      |  6 ++++++
 src/Makefile.in  |  3 +++
 src/del_ops.cpp  | 27 +++++++++++++++++++++++++++
 src/del_opvs.cpp | 27 +++++++++++++++++++++++++++
 5 files changed, 65 insertions(+)

diff --git a/Rules.mak b/Rules.mak
index d87aa36..f4a30df 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -197,6 +197,8 @@ OPTIMIZATION += $(CFLAG_-O2)
 endif
 
 $(eval $(call check-gxx-var,-fvisibility-inlines-hidden))
+$(eval $(call check-gxx-var,-std=gnu++14))
+$(eval $(call check-gxx-var,-Wno-sized-deallocation))
 
 # Add a bunch of extra pedantic annoyingly strict checks
 XWARNINGS=$(call qstrip,$(UCLIBCXX_WARNINGS)) -Wno-trigraphs -pedantic
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/Makefile.in b/src/Makefile.in
index 21c9a4a..a479d57 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -48,6 +48,9 @@ $(top_builddir)src/$(LIBNAME).a: $(libcxx-a-y)
 $(top_builddir)src/$(LIBNAME).so: $(libcxx-so-y)
 	$(call link.so,$(SRC_OUT)$(SHARED_FULLNAME),$(ABI_VERSION))
 
+CXXFLAGS-del_ops.o = $(CXXFLAG_-std=gnu++14) $(CXXFLAG_-Wno-sized-deallocation)
+CXXFLAGS-del_opvs.o = $(CXXFLAG_-std=gnu++14) $(CXXFLAG_-Wno-sized-deallocation)
+
 CLEAN_src:
 	$(do_rm) $(addprefix $(SRC_OUT), *.o abi/*.o libuClibc++* core)
 DISTCLEAN_src: DISTCLEAN_src/abi/libgcc_eh DISTCLEAN_src/abi/libsupc
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);
+}


More information about the uClibc-cvs mailing list