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
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. */
19 operator new (std::size_t s
)
21 void *p
= calloc (1, s
);
26 operator delete (void *p
)
31 #pragma GCC diagnostic push
32 #pragma GCC diagnostic ignored "-Wc++14-compat"
34 operator delete (void *p
, size_t)
38 #pragma GCC diagnostic pop
41 operator new[] (std::size_t s
)
43 return ::operator new (s
);
47 operator delete[] (void *p
)
49 ::operator delete (p
);
52 /* Nothrow versions, provided only for completeness in the fallback array. */
55 operator new (std::size_t s
, const std::nothrow_t
&)
57 void *p
= calloc (1, s
);
62 operator delete (void *p
, const std::nothrow_t
&)
68 operator new[] (std::size_t s
, const std::nothrow_t
&nt
)
70 return ::operator new (s
, nt
);
74 operator delete[] (void *p
, const std::nothrow_t
&nt
)
76 ::operator delete (p
, nt
);
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
92 struct per_process_cxx_malloc default_cygwin_cxx_malloc
=
101 &(operator delete[]),