OSDN Git Service

* path.cc (conv_path_list): Take cygwin_conv_path_t as third parameter.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / libstdcxx_wrapper.cc
1 /* libstdcxx_wrapper.cc
2
3    Copyright 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
12 /* We provide these stubs to call into a user's
13    provided ONDEE replacement if there is one - otherwise
14    it must fall back to the standard libstdc++ version.  */
15
16 #include "winsup.h"
17 #include "cygwin-cxx.h"
18 #include "perprocess.h"
19
20 /* We are declaring asm names for the functions we define here, as we want
21    to define the wrappers in this file.  GCC links everything with wrappers
22    around the standard C++ memory management operators; these are the wrappers,
23    but we want the compiler to know they are the malloc operators and not have
24    it think they're just any old function matching 'extern "C" _wrap_*'.  */
25
26 extern void *operator new(std::size_t sz) throw (std::bad_alloc)
27                         __asm__ ("___wrap__Znwj");
28 extern void *operator new[](std::size_t sz) throw (std::bad_alloc)
29                         __asm__ ("___wrap__Znaj");
30 extern void operator delete(void *p) throw()
31                         __asm__ ("___wrap__ZdlPv");
32 extern void operator delete[](void *p) throw()
33                         __asm__ ("___wrap__ZdaPv");
34 extern void *operator new(std::size_t sz, const std::nothrow_t &nt) throw()
35                         __asm__ ("___wrap__ZnwjRKSt9nothrow_t");
36 extern void *operator new[](std::size_t sz, const std::nothrow_t &nt) throw()
37                         __asm__ ("___wrap__ZnajRKSt9nothrow_t");
38 extern void operator delete(void *p, const std::nothrow_t &nt) throw()
39                         __asm__ ("___wrap__ZdlPvRKSt9nothrow_t");
40 extern void operator delete[](void *p, const std::nothrow_t &nt) throw()
41                         __asm__ ("___wrap__ZdaPvRKSt9nothrow_t");
42
43 extern void *
44 operator new(std::size_t sz) throw (std::bad_alloc)
45 {
46   return (*user_data->cxx_malloc->oper_new) (sz);
47 }
48
49 extern void *
50 operator new[](std::size_t sz) throw (std::bad_alloc)
51 {
52   return (*user_data->cxx_malloc->oper_new__) (sz);
53 }
54
55 extern void
56 operator delete(void *p) throw()
57 {
58   (*user_data->cxx_malloc->oper_delete) (p);
59 }
60
61 extern void
62 operator delete[](void *p) throw()
63 {
64   (*user_data->cxx_malloc->oper_delete__) (p);
65 }
66
67 extern void *
68 operator new(std::size_t sz, const std::nothrow_t &nt) throw()
69 {
70   return (*user_data->cxx_malloc->oper_new_nt) (sz, nt);
71 }
72
73 extern void *
74 operator new[](std::size_t sz, const std::nothrow_t &nt) throw()
75 {
76   return (*user_data->cxx_malloc->oper_new___nt) (sz, nt);
77 }
78
79 extern void
80 operator delete(void *p, const std::nothrow_t &nt) throw()
81 {
82   (*user_data->cxx_malloc->oper_delete_nt) (p, nt);
83 }
84
85 extern void
86 operator delete[](void *p, const std::nothrow_t &nt) throw()
87 {
88   (*user_data->cxx_malloc->oper_delete___nt) (p, nt);
89 }
90