Import gcc-4.4.1
[dragonfly.git] / contrib / gcc-4.4 / libstdc++-v3 / libsupc++ / new_handler.cc
1 // Implementation file for the -*- C++ -*- dynamic memory management header.
2
3 // Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 // 2005, 2006, 2007, 2009
5 // Free Software Foundation
6 //
7 // This file is part of GCC.
8 //
9 // GCC is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 3, or (at your option)
12 // any later version.
13 //
14 // GCC is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 // Under Section 7 of GPL version 3, you are granted additional
20 // permissions described in the GCC Runtime Library Exception, version
21 // 3.1, as published by the Free Software Foundation.
22
23 // You should have received a copy of the GNU General Public License and
24 // a copy of the GCC Runtime Library Exception along with this program;
25 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
26 // <http://www.gnu.org/licenses/>.
27
28 #include "new"
29
30 const std::nothrow_t std::nothrow = { };
31
32 using std::new_handler;
33 new_handler __new_handler;
34
35 new_handler
36 std::set_new_handler (new_handler handler) throw()
37 {
38   new_handler prev_handler = __new_handler;
39   __new_handler = handler;
40   return prev_handler;
41 }
42
43 std::bad_alloc::~bad_alloc() throw() { }
44
45 const char* 
46 std::bad_alloc::what() const throw()
47 {
48   return "std::bad_alloc";
49 }