xref: /freebsd-src/contrib/llvm-project/libcxx/src/new_helpers.cpp (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1*06c3fb27SDimitry Andric //===----------------------------------------------------------------------===//
2*06c3fb27SDimitry Andric //
3*06c3fb27SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*06c3fb27SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*06c3fb27SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*06c3fb27SDimitry Andric //
7*06c3fb27SDimitry Andric //===----------------------------------------------------------------------===//
8*06c3fb27SDimitry Andric 
9*06c3fb27SDimitry Andric #include <cstdlib>
10*06c3fb27SDimitry Andric #include <new>
11*06c3fb27SDimitry Andric 
12*06c3fb27SDimitry Andric namespace std { // purposefully not versioned
13*06c3fb27SDimitry Andric 
14*06c3fb27SDimitry Andric #ifndef __GLIBCXX__
15*06c3fb27SDimitry Andric const nothrow_t nothrow{};
16*06c3fb27SDimitry Andric #endif
17*06c3fb27SDimitry Andric 
18*06c3fb27SDimitry Andric #ifndef LIBSTDCXX
19*06c3fb27SDimitry Andric 
20*06c3fb27SDimitry Andric void __throw_bad_alloc() {
21*06c3fb27SDimitry Andric #  ifndef _LIBCPP_HAS_NO_EXCEPTIONS
22*06c3fb27SDimitry Andric   throw bad_alloc();
23*06c3fb27SDimitry Andric #  else
24*06c3fb27SDimitry Andric   std::abort();
25*06c3fb27SDimitry Andric #  endif
26*06c3fb27SDimitry Andric }
27*06c3fb27SDimitry Andric 
28*06c3fb27SDimitry Andric #endif // !LIBSTDCXX
29*06c3fb27SDimitry Andric 
30*06c3fb27SDimitry Andric } // namespace std
31