diff options
Diffstat (limited to 'libstdc++-v3/libsupc++')
-rw-r--r-- | libstdc++-v3/libsupc++/Makefile.am | 32 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/Makefile.in | 40 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/del_opa.cc | 54 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/del_opant.cc | 33 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/del_opsa.cc | 33 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/del_opva.cc | 36 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/del_opvant.cc | 33 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/del_opvsa.cc | 33 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/new | 28 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/new_opa.cc | 85 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/new_opant.cc | 42 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/new_opva.cc | 33 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/new_opvant.cc | 42 |
13 files changed, 521 insertions, 3 deletions
diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am index ba4eac1e3f8..2df31ff668e 100644 --- a/libstdc++-v3/libsupc++/Makefile.am +++ b/libstdc++-v3/libsupc++/Makefile.am @@ -88,6 +88,16 @@ sources = \ new_opnt.cc \ new_opv.cc \ new_opvnt.cc \ + new_opa.cc \ + new_opant.cc \ + new_opva.cc \ + new_opvant.cc \ + del_opa.cc \ + del_opant.cc \ + del_opsa.cc \ + del_opva.cc \ + del_opvant.cc \ + del_opvsa.cc \ pbase_type_info.cc \ pmem_type_info.cc \ pointer_type_info.cc \ @@ -189,6 +199,28 @@ del_opvs.lo: del_opvs.cc del_opvs.o: del_opvs.cc $(CXXCOMPILE) -std=gnu++14 -Wno-sized-deallocation -c $< +# Use special rules for the C++17 sources so that the proper flags are passed. +new_opa.lo: new_opa.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +new_opant.lo: new_opant.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +new_opva.lo: new_opva.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +new_opvant.lo: new_opvant.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opa.lo: del_opa.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opant.lo: del_opant.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opsa.lo: del_opsa.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opva.lo: del_opva.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opvant.lo: del_opvant.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opvsa.lo: del_opvsa.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< + # AM_CXXFLAGS needs to be in each subdirectory so that it can be # modified in a per-library or per-sub-library way. Need to manually # set this option because CONFIG_CXXFLAGS has to be after diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index 3fb9d16e527..e828ed909ca 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -125,9 +125,11 @@ am__objects_1 = array_type_info.lo atexit_arm.lo atexit_thread.lo \ function_type_info.lo fundamental_type_info.lo guard.lo \ guard_error.lo hash_bytes.lo nested_exception.lo \ new_handler.lo new_op.lo new_opnt.lo new_opv.lo new_opvnt.lo \ - pbase_type_info.lo pmem_type_info.lo pointer_type_info.lo \ - pure.lo si_class_type_info.lo tinfo.lo tinfo2.lo vec.lo \ - vmi_class_type_info.lo vterminate.lo + new_opa.lo new_opant.lo new_opva.lo new_opvant.lo del_opa.lo \ + del_opant.lo del_opsa.lo del_opva.lo del_opvant.lo \ + del_opvsa.lo pbase_type_info.lo pmem_type_info.lo \ + pointer_type_info.lo pure.lo si_class_type_info.lo tinfo.lo \ + tinfo2.lo vec.lo vmi_class_type_info.lo vterminate.lo @GLIBCXX_HOSTED_TRUE@am__objects_2 = cp-demangle.lo @ENABLE_VTABLE_VERIFY_TRUE@@VTV_CYGMIN_FALSE@am__objects_3 = \ @ENABLE_VTABLE_VERIFY_TRUE@@VTV_CYGMIN_FALSE@ vtv_stubs.lo @@ -445,6 +447,16 @@ sources = \ new_opnt.cc \ new_opv.cc \ new_opvnt.cc \ + new_opa.cc \ + new_opant.cc \ + new_opva.cc \ + new_opvant.cc \ + del_opa.cc \ + del_opant.cc \ + del_opsa.cc \ + del_opva.cc \ + del_opvant.cc \ + del_opvsa.cc \ pbase_type_info.cc \ pmem_type_info.cc \ pointer_type_info.cc \ @@ -916,6 +928,28 @@ del_opvs.lo: del_opvs.cc del_opvs.o: del_opvs.cc $(CXXCOMPILE) -std=gnu++14 -Wno-sized-deallocation -c $< +# Use special rules for the C++17 sources so that the proper flags are passed. +new_opa.lo: new_opa.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +new_opant.lo: new_opant.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +new_opva.lo: new_opva.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +new_opvant.lo: new_opvant.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opa.lo: del_opa.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opant.lo: del_opant.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opsa.lo: del_opsa.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opva.lo: del_opva.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opvant.lo: del_opvant.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< +del_opvsa.lo: del_opvsa.cc + $(LTCXXCOMPILE) -std=gnu++1z -c $< + install-stdHEADERS: $(std_HEADERS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(stddir) diff --git a/libstdc++-v3/libsupc++/del_opa.cc b/libstdc++-v3/libsupc++/del_opa.cc new file mode 100644 index 00000000000..889bdb71935 --- /dev/null +++ b/libstdc++-v3/libsupc++/del_opa.cc @@ -0,0 +1,54 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997-2016 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC 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 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 and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include <bits/c++config.h> + +#if !_GLIBCXX_HOSTED +// A freestanding C runtime may not provide "free" -- but there is no +// other reasonable way to implement "operator delete". +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + extern "C" void free(void*); +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +#else +# include <cstdlib> +#endif + +#include "new" + +// The sized deletes are defined in other files. +#pragma GCC diagnostic ignored "-Wsized-deallocation" + +_GLIBCXX_WEAK_DEFINITION void +operator delete(void* ptr, std::align_val_t) _GLIBCXX_USE_NOEXCEPT +{ +#if !_GLIBCXX_HAVE_ALIGNED_ALLOC && _GLIBCXX_HAVE__ALIGNED_MALLOC + _aligned_free (ptr); +#else + std::free(ptr); +#endif +} diff --git a/libstdc++-v3/libsupc++/del_opant.cc b/libstdc++-v3/libsupc++/del_opant.cc new file mode 100644 index 00000000000..1b1919ce927 --- /dev/null +++ b/libstdc++-v3/libsupc++/del_opant.cc @@ -0,0 +1,33 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997-2016 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC 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 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 and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include <bits/c++config.h> +#include "new" + +_GLIBCXX_WEAK_DEFINITION void +operator delete (void *ptr, std::align_val_t al, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT +{ + ::operator delete (ptr, al); +} diff --git a/libstdc++-v3/libsupc++/del_opsa.cc b/libstdc++-v3/libsupc++/del_opsa.cc new file mode 100644 index 00000000000..7880efeb279 --- /dev/null +++ b/libstdc++-v3/libsupc++/del_opsa.cc @@ -0,0 +1,33 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997-2016 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC 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 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 and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include <bits/c++config.h> +#include "new" + +_GLIBCXX_WEAK_DEFINITION void +operator delete(void* ptr, std::size_t, std::align_val_t al) _GLIBCXX_USE_NOEXCEPT +{ + ::operator delete (ptr, al); +} diff --git a/libstdc++-v3/libsupc++/del_opva.cc b/libstdc++-v3/libsupc++/del_opva.cc new file mode 100644 index 00000000000..95d2a3f8d24 --- /dev/null +++ b/libstdc++-v3/libsupc++/del_opva.cc @@ -0,0 +1,36 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997-2016 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC 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 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 and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include <bits/c++config.h> +#include "new" + +// The sized deletes are defined in other files. +#pragma GCC diagnostic ignored "-Wsized-deallocation" + +_GLIBCXX_WEAK_DEFINITION void +operator delete[] (void *ptr, std::align_val_t al) _GLIBCXX_USE_NOEXCEPT +{ + ::operator delete (ptr, al); +} diff --git a/libstdc++-v3/libsupc++/del_opvant.cc b/libstdc++-v3/libsupc++/del_opvant.cc new file mode 100644 index 00000000000..5840c8f70e0 --- /dev/null +++ b/libstdc++-v3/libsupc++/del_opvant.cc @@ -0,0 +1,33 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997-2016 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC 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 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 and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include <bits/c++config.h> +#include "new" + +_GLIBCXX_WEAK_DEFINITION void +operator delete[] (void *ptr, std::align_val_t al, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT +{ + ::operator delete[] (ptr, al); +} diff --git a/libstdc++-v3/libsupc++/del_opvsa.cc b/libstdc++-v3/libsupc++/del_opvsa.cc new file mode 100644 index 00000000000..61586b06e11 --- /dev/null +++ b/libstdc++-v3/libsupc++/del_opvsa.cc @@ -0,0 +1,33 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997-2016 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC 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 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 and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include <bits/c++config.h> +#include "new" + +_GLIBCXX_WEAK_DEFINITION void +operator delete[] (void *ptr, std::size_t, std::align_val_t al) _GLIBCXX_USE_NOEXCEPT +{ + ::operator delete[] (ptr, al); +} diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new index 8e8a3272a8d..477fadc218c 100644 --- a/libstdc++-v3/libsupc++/new +++ b/libstdc++-v3/libsupc++/new @@ -79,6 +79,10 @@ namespace std }; #endif +#if __cpp_aligned_new + enum class align_val_t: size_t {}; +#endif + struct nothrow_t { #if __cplusplus >= 201103L @@ -135,6 +139,30 @@ void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +#if __cpp_aligned_new +void* operator new(std::size_t, std::align_val_t) + __attribute__((__externally_visible__)); +void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +void operator delete(void*, std::align_val_t) + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +void operator delete(void*, std::align_val_t, const std::nothrow_t&) + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +void* operator new[](std::size_t, std::align_val_t) + __attribute__((__externally_visible__)); +void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +void operator delete[](void*, std::align_val_t) + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +void operator delete[](void*, std::align_val_t, const std::nothrow_t&) + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +#if __cpp_sized_deallocation +void operator delete(void*, std::size_t, std::align_val_t) + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +void operator delete[](void*, std::size_t, std::align_val_t) + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +#endif // __cpp_sized_deallocation +#endif // __cpp_aligned_new // Default placement versions of operator new. inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc new file mode 100644 index 00000000000..91e53a8b360 --- /dev/null +++ b/libstdc++-v3/libsupc++/new_opa.cc @@ -0,0 +1,85 @@ +// Support routines for the -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997-2016 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC 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 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 and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include <bits/c++config.h> +#include <stdlib.h> +#include <bits/exception_defines.h> +#include "new" + +using std::new_handler; +using std::bad_alloc; + +#if !_GLIBCXX_HAVE_ALIGNED_ALLOC +#if _GLIBCXX_HAVE__ALIGNED_MALLOC +#define aligned_alloc(al,sz) _aligned_malloc(sz,al) +#elif _GLIBCXX_HAVE_POSIX_MEMALIGN +static inline void* +aligned_alloc (std::size_t al, std::size_t sz) +{ + void *ptr; + // The value of alignment shall be a power of two multiple of sizeof(void *). + if (al < sizeof(void*)) + al = sizeof(void*); + int ret = posix_memalign (&ptr, al, sz); + if (ret == 0) + return ptr; + return nullptr; +} +#elif _GLIBCXX_HAVE_MEMALIGN +#include <malloc.h> +#define aligned_alloc memalign +#else +// The C library doesn't provide any aligned allocation functions, declare +// aligned_alloc and get a link failure if aligned new is used. +extern "C" void *aligned_alloc(std::size_t, std::size_t); +#endif +#endif + +_GLIBCXX_WEAK_DEFINITION void * +operator new (std::size_t sz, std::align_val_t al) +{ + void *p; + std::size_t align = (std::size_t)al; + + /* malloc (0) is unpredictable; avoid it. */ + if (sz == 0) + sz = 1; + +#if _GLIBCXX_HAVE_ALIGNED_ALLOC + /* C11: the value of size shall be an integral multiple of alignment. */ + if (std::size_t rem = sz & (align - 1)) + sz += align - rem; +#endif + + while (__builtin_expect ((p = aligned_alloc (align, sz)) == 0, false)) + { + new_handler handler = std::get_new_handler (); + if (! handler) + _GLIBCXX_THROW_OR_ABORT(bad_alloc()); + handler (); + } + + return p; +} diff --git a/libstdc++-v3/libsupc++/new_opant.cc b/libstdc++-v3/libsupc++/new_opant.cc new file mode 100644 index 00000000000..1c6ccab809e --- /dev/null +++ b/libstdc++-v3/libsupc++/new_opant.cc @@ -0,0 +1,42 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997-2016 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC 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 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 and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include <bits/c++config.h> +#include <bits/exception_defines.h> +#include "new" + +_GLIBCXX_WEAK_DEFINITION void* +operator new(std::size_t sz, std::align_val_t al, const std::nothrow_t&) + _GLIBCXX_USE_NOEXCEPT +{ + __try + { + return operator new(sz, al); + } + __catch(...) + { + return 0; + } +} diff --git a/libstdc++-v3/libsupc++/new_opva.cc b/libstdc++-v3/libsupc++/new_opva.cc new file mode 100644 index 00000000000..7109431b269 --- /dev/null +++ b/libstdc++-v3/libsupc++/new_opva.cc @@ -0,0 +1,33 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997-2016 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC 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 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 and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include <bits/c++config.h> +#include "new" + +_GLIBCXX_WEAK_DEFINITION void* +operator new[] (std::size_t sz, std::align_val_t al) +{ + return ::operator new(sz, al); +} diff --git a/libstdc++-v3/libsupc++/new_opvant.cc b/libstdc++-v3/libsupc++/new_opvant.cc new file mode 100644 index 00000000000..2b295472120 --- /dev/null +++ b/libstdc++-v3/libsupc++/new_opvant.cc @@ -0,0 +1,42 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997-2016 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC 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 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 and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include <bits/c++config.h> +#include <bits/exception_defines.h> +#include "new" + +_GLIBCXX_WEAK_DEFINITION void* +operator new[] (std::size_t sz, std::align_val_t al, const std::nothrow_t&) + _GLIBCXX_USE_NOEXCEPT +{ + __try + { + return ::operator new[](sz, al); + } + __catch(...) + { + return 0; + } +} |