2000-10-11 01:43:26 +02:00
|
|
|
// The -*- C++ -*- dynamic memory management header.
|
2001-02-07 21:26:24 +01:00
|
|
|
|
2002-01-09 21:39:27 +01:00
|
|
|
// Copyright (C) 1994, 1996, 1997, 1998, 2000, 2001, 2002
|
|
|
|
// Free Software Foundation
|
2000-10-11 01:43:26 +02:00
|
|
|
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// This file is part of GCC.
|
2000-10-11 01:43:26 +02:00
|
|
|
//
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// GCC is free software; you can redistribute it and/or modify
|
2000-10-11 01:43:26 +02:00
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
// any later version.
|
|
|
|
//
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// GCC is distributed in the hope that it will be useful,
|
2000-10-11 01:43:26 +02:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// along with GCC; see the file COPYING. If not, write to
|
2000-10-11 01:43:26 +02:00
|
|
|
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
// Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
// As a special exception, you may use this file as part of a free software
|
|
|
|
// library without restriction. Specifically, if other files instantiate
|
|
|
|
// templates or use macros or inline functions from this file, or you compile
|
|
|
|
// this file and link it with other files to produce an executable, this
|
|
|
|
// file does not by itself cause the resulting executable to be covered by
|
|
|
|
// the GNU General Public License. This exception does not however
|
|
|
|
// invalidate any other reasons why the executable file might be covered by
|
|
|
|
// the GNU General Public License.
|
|
|
|
|
2001-07-11 21:35:49 +02:00
|
|
|
/** @file new
|
Makefile.am (doxygen, [...]): Tweak targets.
2002-01-28 Phil Edwards <pme@gcc.gnu.org>
* Makefile.am (doxygen, doxygen-maint, doxygen-man): Tweak targets.
* Makefile.in: Regenerate.
* docs/doxygen/run_doxygen: Update, mostly for man pages.
* docs/doxygen/Intro.3: Update.
* docs/doxygen/TODO: Update.
* docs/doxygen/doxygroups.cc: Add namespace hook for __gnu_cxx.
* docs/doxygen/mainpage.doxy: Update.
* docs/doxygen/user.cfg.in: Update for header rename. Also
regenerate comments and variables with 1.2.12.
* docs/doxygen/maint.cfg.in: Remove file.
* include/bits/stl_relops.h: Doxygenate.
* include/bits/stl_tempbuf.h (std::_Temporary_buffer): Likewise.
* include/c_std/std_cassert.h, include/c_std/std_cctype.h,
include/c_std/std_cerrno.h, include/c_std/std_cfloat.h,
include/c_std/std_ciso646.h, include/c_std/std_climits.h,
include/c_std/std_clocale.h, include/c_std/std_cmath.h,
include/c_std/std_csetjmp.h, include/c_std/std_csignal.h,
include/c_std/std_cstdarg.h, include/c_std/std_cstddef.h,
include/c_std/std_cstdio.h, include/c_std/std_cstdlib.h,
include/c_std/std_cstring.h, include/c_std/std_ctime.h,
include/c_std/std_cwchar.h, include/c_std/std_cwctype.h,
include/ext/algorithm, include/ext/functional, include/ext/hash_map,
include/ext/hash_set, include/ext/iterator, include/ext/memory,
include/ext/numeric, include/ext/rb_tree, include/ext/rope,
include/ext/ropeimpl.h, include/ext/slist, include/ext/stl_hash_fun.h,
include/ext/stl_hashtable.h, include/ext/stl_rope.h,
include/std/std_algorithm.h, include/std/std_bitset.h,
include/std/std_complex.h, include/std/std_deque.h,
include/std/std_fstream.h, include/std/std_functional.h,
include/std/std_iomanip.h, include/std/std_ios.h,
include/std/std_iosfwd.h, include/std/std_iostream.h,
include/std/std_istream.h, include/std/std_iterator.h,
include/std/std_limits.h, include/std/std_list.h,
include/std/std_locale.h, include/std/std_map.h,
include/std/std_memory.h, include/std/std_numeric.h,
include/std/std_ostream.h, include/std/std_queue.h,
include/std/std_set.h, include/std/std_sstream.h,
include/std/std_stack.h, include/std/std_stdexcept.h,
include/std/std_streambuf.h, include/std/std_string.h,
include/std/std_utility.h, include/std/std_valarray.h,
include/std/std_vector.h: Add/correct @file doxygen hook.
* include/ext/memory: Doxygenate most of rest of file.
* libsupc++/exception: Doxygen output formatting.
* libsupc++/new: Say which header it is.
* testsuite/lib/libstdc++-v3-dg.exp: Fix spacing.
* docs/html/19_diagnostics/howto.html: Describe concept-checks switch.
* docs/html/23_containers/howto.html: Describe O(n) list::size().
* docs/html/27_io/howto.html: Also link to Langer and Kreft text.
From-SVN: r49300
2002-01-28 23:13:12 +01:00
|
|
|
* The header @c new defines several functions to manage dynamic memory and
|
2001-07-11 21:35:49 +02:00
|
|
|
* handling memory allocation errors; see
|
|
|
|
* http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 for more.
|
|
|
|
*/
|
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifndef _NEW
|
|
|
|
#define _NEW
|
2000-10-11 01:43:26 +02:00
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <exception>
|
|
|
|
|
|
|
|
extern "C++" {
|
|
|
|
|
2001-02-07 21:26:24 +01:00
|
|
|
namespace std
|
|
|
|
{
|
abi.txt: New file.
2002-07-20 Phil Edwards <pme@gcc.gnu.org>
* docs/html/abi.txt: New file.
* docs/html/23_containers/howto.html: Tweak vector-overhead text.
* docs/html/ext/lwg-active.html, docs/html/ext/lwg-defects.html:
Import from upstream, R22.
* include/bits/char_traits.h, include/bits/stl_iterator.h,
include/bits/stl_iterator_base_types.h, libsupc++/exception,
libsupc++/new, libsupc++/typeinfo: Use @brief markup.
* include/bits/deque.tcc, include/bits/stl_alloc.h,
include/bits/stl_deque.h, include/bits/stl_list.h: Postpone removal
of deprecated functions until 3.4. (Same timeframe, different text.)
* include/bits/stl_vector.h: Ditto. Also do the same cleanups that
the other sequence classes received.
From-SVN: r55602
2002-07-20 08:26:27 +02:00
|
|
|
/**
|
|
|
|
* @brief Exception possibly thrown by @c new.
|
|
|
|
*
|
|
|
|
* @c bad_alloc (or classes derived from it) is used to report allocation
|
2001-07-11 21:35:49 +02:00
|
|
|
* errors from the throwing forms of @c new. */
|
2001-02-07 21:26:24 +01:00
|
|
|
class bad_alloc : public exception
|
|
|
|
{
|
2000-10-11 01:43:26 +02:00
|
|
|
public:
|
2001-03-13 20:32:00 +01:00
|
|
|
bad_alloc() throw() { }
|
2002-01-10 00:31:57 +01:00
|
|
|
// This declaration is not useless:
|
|
|
|
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
|
2002-01-09 21:39:27 +01:00
|
|
|
virtual ~bad_alloc() throw();
|
2000-10-11 01:43:26 +02:00
|
|
|
};
|
|
|
|
|
2001-02-07 21:26:24 +01:00
|
|
|
struct nothrow_t { };
|
2000-10-11 01:43:26 +02:00
|
|
|
extern const nothrow_t nothrow;
|
2001-07-11 21:35:49 +02:00
|
|
|
/** If you write your own error handler to be called by @c new, it must
|
|
|
|
* be of this type. */
|
2000-10-11 01:43:26 +02:00
|
|
|
typedef void (*new_handler)();
|
2001-07-11 21:35:49 +02:00
|
|
|
/// Takes a replacement handler as the argument, returns the previous handler.
|
2002-07-16 10:28:40 +02:00
|
|
|
new_handler set_new_handler(new_handler) throw();
|
2000-10-11 01:43:26 +02:00
|
|
|
} // namespace std
|
|
|
|
|
2001-07-11 21:35:49 +02:00
|
|
|
//@{
|
|
|
|
/** These are replaceable signatures:
|
|
|
|
* - normal single new and delete (no arguments, throw @c bad_alloc on error)
|
|
|
|
* - normal array new and delete (same)
|
|
|
|
* - @c nothrow single new and delete (take a @c nothrow argument, return
|
|
|
|
* @c NULL on error)
|
|
|
|
* - @c nothrow array new and delete (same)
|
|
|
|
*
|
|
|
|
* Placement new and delete signatures (take a memory address argument,
|
|
|
|
* does nothing) may not be replaced by a user's program.
|
|
|
|
*/
|
2002-04-16 02:45:36 +02:00
|
|
|
void* operator new(std::size_t) throw (std::bad_alloc);
|
|
|
|
void* operator new[](std::size_t) throw (std::bad_alloc);
|
|
|
|
void operator delete(void*) throw();
|
|
|
|
void operator delete[](void*) throw();
|
|
|
|
void* operator new(std::size_t, const std::nothrow_t&) throw();
|
|
|
|
void* operator new[](std::size_t, const std::nothrow_t&) throw();
|
|
|
|
void operator delete(void*, const std::nothrow_t&) throw();
|
|
|
|
void operator delete[](void*, const std::nothrow_t&) throw();
|
2000-10-11 01:43:26 +02:00
|
|
|
|
2001-02-07 21:26:24 +01:00
|
|
|
// Default placement versions of operator new.
|
2002-04-16 02:45:36 +02:00
|
|
|
inline void* operator new(std::size_t, void* __p) throw() { return __p; }
|
|
|
|
inline void* operator new[](std::size_t, void* __p) throw() { return __p; }
|
2002-07-24 21:49:21 +02:00
|
|
|
|
|
|
|
// Default placement versions of operator delete.
|
2002-12-28 00:03:03 +01:00
|
|
|
inline void operator delete (void*, void*) throw() { }
|
|
|
|
inline void operator delete[](void*, void*) throw() { }
|
2001-07-11 21:35:49 +02:00
|
|
|
//@}
|
2000-10-11 01:43:26 +02:00
|
|
|
} // extern "C++"
|
|
|
|
|
|
|
|
#endif
|