* cp-tree.def (SCOPE_STMT): Take one operand.
[official-gcc.git] / gcc / cp / new2.cc
blobd1aab7b2efb04c3621285efbc184d003261ef8eb
1 // Boilerplate support routines for -*- C++ -*- dynamic memory management.
2 // Copyright (C) 1997, 1998, 1999 Free Software Foundation
4 // This file is part of GNU CC.
6 // GNU CC is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2, or (at your option)
9 // any later version.
11 // GNU CC is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with GNU CC; see the file COPYING. If not, write to
18 // the Free Software Foundation, 59 Temple Place - Suite 330,
19 // Boston, MA 02111-1307, USA.
21 // As a special exception, if you link this library with other files,
22 // some of which are compiled with GCC, to produce an executable,
23 // this library does not by itself cause the resulting executable
24 // to be covered by the GNU General Public License.
25 // This exception does not however invalidate any other reasons why
26 // the executable file might be covered by the GNU General Public License.
28 #include "new"
30 extern "C" void free (void *);
32 #define WEAK(x) \
33 x __attribute__ ((weak)); \
36 #ifdef L_op_vnew
37 WEAK(void * operator new[] (size_t sz) throw (std::bad_alloc))
39 return ::operator new(sz);
41 #endif
43 #ifdef L_op_vnewnt
44 WEAK(void *operator new[] (size_t sz, const std::nothrow_t& nothrow) throw())
46 return ::operator new(sz, nothrow);
48 #endif
50 #ifdef L_op_delete
51 WEAK (void operator delete (void *ptr) throw ())
53 if (ptr)
54 free (ptr);
56 #endif
58 #ifdef L_op_vdel
59 WEAK (void operator delete[] (void *ptr) throw ())
61 if (ptr)
62 free (ptr);
64 #endif
66 #ifdef L_op_delnt
67 WEAK (void operator delete (void *ptr, const std::nothrow_t&) throw ())
69 if (ptr)
70 free (ptr);
72 #endif
74 #ifdef L_op_vdelnt
75 WEAK (void operator delete[] (void *ptr, const std::nothrow_t&) throw ())
77 if (ptr)
78 free (ptr);
80 #endif