Cygwin: (mostly) drop NT4 and Samba < 3.0 support
[newlib-cygwin.git] / winsup / cygwin / cxx.cc
blobb69524acadc20036a8528d5611844b6ba7d6f36e
1 /* cxx.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. */
9 #if (__GNUC__ >= 3)
11 #include "winsup.h"
12 #include "cygwin-cxx.h"
14 /* These implementations of operators new and delete are used internally by
15 the DLL, and are kept separate from the user's/libstdc++'s versions by
16 use of LD's --wrap option. */
18 void *
19 operator new (std::size_t s)
21 void *p = calloc (1, s);
22 return p;
25 void
26 operator delete (void *p)
28 free (p);
31 #pragma GCC diagnostic push
32 #pragma GCC diagnostic ignored "-Wc++14-compat"
33 void
34 operator delete (void *p, size_t)
36 ::operator delete(p);
38 #pragma GCC diagnostic pop
40 void *
41 operator new[] (std::size_t s)
43 return ::operator new (s);
46 void
47 operator delete[] (void *p)
49 ::operator delete (p);
52 /* Nothrow versions, provided only for completeness in the fallback array. */
54 void *
55 operator new (std::size_t s, const std::nothrow_t &)
57 void *p = calloc (1, s);
58 return p;
61 void
62 operator delete (void *p, const std::nothrow_t &)
64 free (p);
67 void *
68 operator new[] (std::size_t s, const std::nothrow_t &nt)
70 return ::operator new (s, nt);
73 void
74 operator delete[] (void *p, const std::nothrow_t &nt)
76 ::operator delete (p, nt);
80 extern "C" void
81 __cxa_pure_virtual (void)
83 api_fatal ("pure virtual method called");
86 /* These routines are made available as last-resort fallbacks
87 for the application. Should not be used in practice; the
88 entries in this struct get overwritten by each DLL as it
89 is loaded, and libstdc++ will override the whole lot first
90 thing of all. */
92 struct per_process_cxx_malloc default_cygwin_cxx_malloc =
94 &(operator new),
95 &(operator new[]),
96 &(operator delete),
97 &(operator delete[]),
98 &(operator new),
99 &(operator new[]),
100 &(operator delete),
101 &(operator delete[]),
105 #endif