Welcome to mirror list, hosted at ThFree Co, Russian Federation.

libstdcxx_wrapper.cc « cygwin « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a6492f24394ddc614f10d4fd279ee8ea1dbeb801 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* libstdcxx_wrapper.cc

   Copyright 2009 Red Hat, Inc.

This file is part of Cygwin.

This software is a copyrighted work licensed under the terms of the
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
details.  */


/* We provide these stubs to call into a user's
   provided ONDEE replacement if there is one - otherwise
   it must fall back to the standard libstdc++ version.  */

#include "winsup.h"
#include "cygwin-cxx.h"
#include "perprocess.h"

/* We are declaring asm names for the functions we define here, as we want
   to define the wrappers in this file.  GCC links everything with wrappers
   around the standard C++ memory management operators; these are the wrappers,
   but we want the compiler to know they are the malloc operators and not have
   it think they're just any old function matching 'extern "C" _wrap_*'.  */

extern void *operator new(std::size_t sz) throw (std::bad_alloc)
			__asm__ ("___wrap__Znwj");
extern void *operator new[](std::size_t sz) throw (std::bad_alloc)
			__asm__ ("___wrap__Znaj");
extern void operator delete(void *p) throw()
			__asm__ ("___wrap__ZdlPv");
extern void operator delete[](void *p) throw()
			__asm__ ("___wrap__ZdaPv");
extern void *operator new(std::size_t sz, const std::nothrow_t &nt) throw()
			__asm__ ("___wrap__ZnwjRKSt9nothrow_t");
extern void *operator new[](std::size_t sz, const std::nothrow_t &nt) throw()
			__asm__ ("___wrap__ZnajRKSt9nothrow_t");
extern void operator delete(void *p, const std::nothrow_t &nt) throw()
			__asm__ ("___wrap__ZdlPvRKSt9nothrow_t");
extern void operator delete[](void *p, const std::nothrow_t &nt) throw()
			__asm__ ("___wrap__ZdaPvRKSt9nothrow_t");

extern void *
operator new(std::size_t sz) throw (std::bad_alloc)
{
  return (*user_data->cxx_malloc->oper_new) (sz);
}

extern void *
operator new[](std::size_t sz) throw (std::bad_alloc)
{
  return (*user_data->cxx_malloc->oper_new__) (sz);
}

extern void
operator delete(void *p) throw()
{
  (*user_data->cxx_malloc->oper_delete) (p);
}

extern void
operator delete[](void *p) throw()
{
  (*user_data->cxx_malloc->oper_delete__) (p);
}

extern void *
operator new(std::size_t sz, const std::nothrow_t &nt) throw()
{
  return (*user_data->cxx_malloc->oper_new_nt) (sz, nt);
}

extern void *
operator new[](std::size_t sz, const std::nothrow_t &nt) throw()
{
  return (*user_data->cxx_malloc->oper_new___nt) (sz, nt);
}

extern void
operator delete(void *p, const std::nothrow_t &nt) throw()
{
  (*user_data->cxx_malloc->oper_delete_nt) (p, nt);
}

extern void
operator delete[](void *p, const std::nothrow_t &nt) throw()
{
  (*user_data->cxx_malloc->oper_delete___nt) (p, nt);
}