Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*      Copyright (C) 2004 Garrett A. Kajmowicz
  2.  
  3.         This file is part of the uClibc++ Library.
  4.  
  5.         This library is free software; you can redistribute it and/or
  6.         modify it under the terms of the GNU Lesser General Public
  7.         License as published by the Free Software Foundation; either
  8.         version 2.1 of the License, or (at your option) any later version.
  9.  
  10.         This library is distributed in the hope that it will be useful,
  11.         but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.         Lesser General Public License for more details.
  14.  
  15.         You should have received a copy of the GNU Lesser General Public
  16.         License along with this library; if not, write to the Free Software
  17.         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. */
  19.  
  20. #include <basic_definitions>
  21. #include <exception>
  22. #include <cstddef>
  23.  
  24. #ifndef __STD_NEW_OPERATOR
  25. #define __STD_NEW_OPERATOR 1
  26.  
  27. #pragma GCC visibility push(default)
  28.  
  29. namespace std{
  30.         class _UCXXEXPORT bad_alloc : public exception {};
  31.  
  32.         struct _UCXXEXPORT nothrow_t {};
  33.         extern const nothrow_t nothrow;
  34.  
  35.         typedef void (*new_handler)();
  36.         _UCXXEXPORT new_handler set_new_handler(new_handler new_p) throw();
  37. }
  38.  
  39.  
  40. _UCXXEXPORT void* operator new(std::size_t numBytes) throw(std::bad_alloc);
  41. _UCXXEXPORT void operator delete(void* ptr) throw();
  42.  
  43. _UCXXEXPORT void* operator new[](std::size_t numBytes) throw(std::bad_alloc);
  44. _UCXXEXPORT void operator delete[](void * ptr) throw();
  45.  
  46. #ifndef NO_NOTHROW
  47. _UCXXEXPORT void* operator new(std::size_t numBytes, const std::nothrow_t& ) throw();
  48. _UCXXEXPORT void operator delete(void* ptr, const std::nothrow_t& ) throw();
  49.  
  50. _UCXXEXPORT void* operator new[](std::size_t numBytes, const std::nothrow_t& ) throw();
  51. _UCXXEXPORT void operator delete[](void* ptr, const std::nothrow_t& ) throw();
  52. #endif
  53.  
  54.         /* Placement operators */
  55. inline void* operator new(std::size_t, void* ptr) throw() {return ptr; }
  56. inline void operator delete(void* , void *) throw() { }
  57.        
  58. inline void* operator new[](std::size_t, void *p) throw() { return p; }
  59. inline void operator delete[](void* , void *) throw() {}
  60.  
  61. #pragma GCC visibility pop
  62.  
  63. #endif
  64.  
  65.