xref: /openbsd-src/gnu/lib/libstdc++/libstdc++/libsupc++/new_handler.cc (revision 03a78d155d6fff5698289342b62759a75b20d130)
1*03a78d15Sespie // Implementation file for the -*- C++ -*- dynamic memory management header.
2*03a78d15Sespie 
3*03a78d15Sespie // Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002
4*03a78d15Sespie // Free Software Foundation
5*03a78d15Sespie //
6*03a78d15Sespie // This file is part of GNU CC.
7*03a78d15Sespie //
8*03a78d15Sespie // GNU CC is free software; you can redistribute it and/or modify
9*03a78d15Sespie // it under the terms of the GNU General Public License as published by
10*03a78d15Sespie // the Free Software Foundation; either version 2, or (at your option)
11*03a78d15Sespie // any later version.
12*03a78d15Sespie //
13*03a78d15Sespie // GNU CC is distributed in the hope that it will be useful,
14*03a78d15Sespie // but WITHOUT ANY WARRANTY; without even the implied warranty of
15*03a78d15Sespie // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*03a78d15Sespie // GNU General Public License for more details.
17*03a78d15Sespie //
18*03a78d15Sespie // You should have received a copy of the GNU General Public License
19*03a78d15Sespie // along with GNU CC; see the file COPYING.  If not, write to
20*03a78d15Sespie // the Free Software Foundation, 59 Temple Place - Suite 330,
21*03a78d15Sespie // Boston, MA 02111-1307, USA.
22*03a78d15Sespie //
23*03a78d15Sespie // As a special exception, you may use this file as part of a free software
24*03a78d15Sespie // library without restriction.  Specifically, if other files instantiate
25*03a78d15Sespie // templates or use macros or inline functions from this file, or you compile
26*03a78d15Sespie // this file and link it with other files to produce an executable, this
27*03a78d15Sespie // file does not by itself cause the resulting executable to be covered by
28*03a78d15Sespie // the GNU General Public License.  This exception does not however
29*03a78d15Sespie // invalidate any other reasons why the executable file might be covered by
30*03a78d15Sespie // the GNU General Public License.
31*03a78d15Sespie 
32*03a78d15Sespie #include "new"
33*03a78d15Sespie 
34*03a78d15Sespie const std::nothrow_t std::nothrow = { };
35*03a78d15Sespie 
36*03a78d15Sespie using std::new_handler;
37*03a78d15Sespie new_handler __new_handler;
38*03a78d15Sespie 
39*03a78d15Sespie new_handler
set_new_handler(new_handler handler)40*03a78d15Sespie std::set_new_handler (new_handler handler) throw()
41*03a78d15Sespie {
42*03a78d15Sespie   new_handler prev_handler = __new_handler;
43*03a78d15Sespie   __new_handler = handler;
44*03a78d15Sespie   return prev_handler;
45*03a78d15Sespie }
46*03a78d15Sespie 
~bad_alloc()47*03a78d15Sespie std::bad_alloc::~bad_alloc() throw() { }
48