OSDN Git Service

* globals.cc (enum exit_states::ES_GLOBAL_DTORS): Delete.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / cxx.cc
1 /* cxx.cc
2
3    Copyright 2002, 2003, 2005, 2009 Red Hat, Inc.
4
5 This file is part of Cygwin.
6
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
9 details. */
10
11 #if (__GNUC__ >= 3)
12
13 #include "winsup.h"
14 #include "cygwin-cxx.h"
15
16 /* These implementations of operators new and delete are used internally by
17    the DLL, and are kept separate from the user's/libstdc++'s versions by
18    use of LD's --wrap option.  */
19
20 void *
21 operator new (std::size_t s)
22 {
23   void *p = calloc (1, s);
24   return p;
25 }
26
27 void
28 operator delete (void *p)
29 {
30   free (p);
31 }
32
33 void *
34 operator new[] (std::size_t s)
35 {
36   return ::operator new (s);
37 }
38
39 void
40 operator delete[] (void *p)
41 {
42   ::operator delete (p);
43 }
44
45 /* Nothrow versions, provided only for completeness in the fallback array.  */
46
47 void *
48 operator new (std::size_t s, const std::nothrow_t &)
49 {
50   void *p = calloc (1, s);
51   return p;
52 }
53
54 void
55 operator delete (void *p, const std::nothrow_t &)
56 {
57   free (p);
58 }
59
60 void *
61 operator new[] (std::size_t s, const std::nothrow_t &nt)
62 {
63   return ::operator new (s, nt);
64 }
65
66 void
67 operator delete[] (void *p, const std::nothrow_t &nt)
68 {
69   ::operator delete (p, nt);
70 }
71
72
73 extern "C" void
74 __cxa_pure_virtual (void)
75 {
76   api_fatal ("pure virtual method called");
77 }
78
79 extern "C" void
80 __cxa_guard_acquire ()
81 {
82 }
83
84 extern "C" void
85 __cxa_guard_release ()
86 {
87 }
88
89 /* These routines are made available as last-resort fallbacks
90    for the application.  Should not be used in practice.  */
91
92 struct per_process_cxx_malloc default_cygwin_cxx_malloc = 
93 {
94   &(operator new),
95   &(operator new[]),
96   &(operator delete),
97   &(operator delete[]),
98   &(operator new),
99   &(operator new[]),
100   &(operator delete),
101   &(operator delete[]),
102 };
103
104
105 #endif