Cygwin: (mostly) drop NT4 and Samba < 3.0 support
[newlib-cygwin.git] / winsup / cygwin / libstdcxx_wrapper.cc
blob34911d0e11a51437f2209d3a1e15968c6717f5f3
1 /* libstdcxx_wrapper.cc
3 This file is part of Cygwin.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
7 details. */
10 /* We provide these stubs to call into a user's
11 provided ONDEE replacement if there is one - otherwise
12 it must fall back to the standard libstdc++ version. */
14 #include "winsup.h"
15 #include "cygwin-cxx.h"
16 #include "perprocess.h"
18 /* We are declaring asm names for the functions we define here, as we want
19 to define the wrappers in this file. GCC links everything with wrappers
20 around the standard C++ memory management operators; these are the wrappers,
21 but we want the compiler to know they are the malloc operators and not have
22 it think they're just any old function matching 'extern "C" _wrap_*'. */
23 #define MANGLED_ZNWX "__wrap__Znwm"
24 #define MANGLED_ZNAX "__wrap__Znam"
25 #define MANGLED_ZNWX_NOTHROW_T "__wrap__ZnwmRKSt9nothrow_t"
26 #define MANGLED_ZNAX_NOTHROW_T "__wrap__ZnamRKSt9nothrow_t"
28 extern void *operator new(std::size_t sz) noexcept (false)
29 __asm__ (MANGLED_ZNWX);
30 extern void *operator new[](std::size_t sz) noexcept (false)
31 __asm__ (MANGLED_ZNAX);
32 extern void operator delete(void *p) noexcept (true)
33 __asm__ (_SYMSTR (__wrap__ZdlPv));
34 extern void operator delete[](void *p) noexcept (true)
35 __asm__ (_SYMSTR (__wrap__ZdaPv));
36 extern void *operator new(std::size_t sz, const std::nothrow_t &nt) noexcept (true)
37 __asm__ (MANGLED_ZNWX_NOTHROW_T);
38 extern void *operator new[](std::size_t sz, const std::nothrow_t &nt) noexcept (true)
39 __asm__ (MANGLED_ZNAX_NOTHROW_T);
40 extern void operator delete(void *p, const std::nothrow_t &nt) noexcept (true)
41 __asm__ (_SYMSTR (__wrap__ZdlPvRKSt9nothrow_t));
42 extern void operator delete[](void *p, const std::nothrow_t &nt) noexcept (true)
43 __asm__ (_SYMSTR (__wrap__ZdaPvRKSt9nothrow_t));
45 extern void *
46 operator new(std::size_t sz) noexcept (false)
48 return (*user_data->cxx_malloc->oper_new) (sz);
51 extern void *
52 operator new[](std::size_t sz) noexcept (false)
54 return (*user_data->cxx_malloc->oper_new__) (sz);
57 extern void
58 operator delete(void *p) noexcept (true)
60 (*user_data->cxx_malloc->oper_delete) (p);
63 extern void
64 operator delete[](void *p) noexcept (true)
66 (*user_data->cxx_malloc->oper_delete__) (p);
69 extern void *
70 operator new(std::size_t sz, const std::nothrow_t &nt) noexcept (true)
72 return (*user_data->cxx_malloc->oper_new_nt) (sz, nt);
75 extern void *
76 operator new[](std::size_t sz, const std::nothrow_t &nt) noexcept (true)
78 return (*user_data->cxx_malloc->oper_new___nt) (sz, nt);
81 extern void
82 operator delete(void *p, const std::nothrow_t &nt) noexcept (true)
84 (*user_data->cxx_malloc->oper_delete_nt) (p, nt);
87 extern void
88 operator delete[](void *p, const std::nothrow_t &nt) noexcept (true)
90 (*user_data->cxx_malloc->oper_delete___nt) (p, nt);