]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/libstdc++/libsupc++/new_handler.cc
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / libstdc++ / 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
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 2, 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 // You should have received a copy of the GNU General Public License
20 // along with GCC; see the file COPYING.  If not, write to
21 // the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 // Boston, MA 02110-1301, USA. 
23 //
24 // As a special exception, you may use this file as part of a free software
25 // library without restriction.  Specifically, if other files instantiate
26 // templates or use macros or inline functions from this file, or you compile
27 // this file and link it with other files to produce an executable, this
28 // file does not by itself cause the resulting executable to be covered by
29 // the GNU General Public License.  This exception does not however
30 // invalidate any other reasons why the executable file might be covered by
31 // the GNU General Public License.
32
33 #include "new"
34
35 const std::nothrow_t std::nothrow = { };
36
37 using std::new_handler;
38 new_handler __new_handler;
39
40 new_handler
41 std::set_new_handler (new_handler handler) throw()
42 {
43   new_handler prev_handler = __new_handler;
44   __new_handler = handler;
45   return prev_handler;
46 }
47
48 std::bad_alloc::~bad_alloc() throw() { }
49
50 const char* 
51 std::bad_alloc::what() const throw()
52 {
53   return "std::bad_alloc";
54 }