39
39
#include " bits/c++config.h"
40
40
// #include <exception>
41
41
42
+ #include < new.h> // Arduino's version of the <new> header
43
+
42
44
#pragma GCC visibility push(default)
43
45
44
46
extern " C++" {
@@ -86,6 +88,7 @@ namespace std
86
88
enum class align_val_t : size_t {};
87
89
#endif
88
90
91
+ #if !defined(NEW_H) || defined(__AVR_ATmega4809__) // already defined in Arduino's version of <new>
89
92
struct nothrow_t
90
93
{
91
94
#if __cplusplus >= 201103L
@@ -107,9 +110,11 @@ namespace std
107
110
// / Return the current new handler.
108
111
new_handler get_new_handler () noexcept ;
109
112
#endif
113
+ #endif // NEW_H
110
114
} // namespace std
111
115
112
116
// @{
117
+ #if !defined(NEW_H) || defined(__AVR_ATmega4809__) // already defined in Arduino's version of <new>
113
118
/* * These are replaceable signatures:
114
119
* - normal single new and delete (no arguments, throw @c bad_alloc on error)
115
120
* - normal array new and delete (same)
@@ -120,6 +125,7 @@ namespace std
120
125
* Placement new and delete signatures (take a memory address argument,
121
126
* does nothing) may not be replaced by a user's program.
122
127
*/
128
+ #ifndef __AVR_ATmega4809__
123
129
void * operator new (std::size_t ) _GLIBCXX_THROW (std::bad_alloc)
124
130
__attribute__ ((__externally_visible__));
125
131
void * operator new [](std::size_t ) _GLIBCXX_THROW (std::bad_alloc)
@@ -128,6 +134,7 @@ void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
128
134
__attribute__ ((__externally_visible__));
129
135
void operator delete[] (void *) _GLIBCXX_USE_NOEXCEPT
130
136
__attribute__ ((__externally_visible__));
137
+ #endif
131
138
#if __cpp_sized_deallocation
132
139
void operator delete (void *, std::size_t ) _GLIBCXX_USE_NOEXCEPT
133
140
__attribute__ ((__externally_visible__));
@@ -176,6 +183,7 @@ inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
176
183
// Default placement versions of operator delete.
177
184
inline void operator delete (void *, void *) _GLIBCXX_USE_NOEXCEPT { }
178
185
inline void operator delete[] (void *, void *) _GLIBCXX_USE_NOEXCEPT { }
186
+ #endif // NEW_H
179
187
// @}
180
188
} // extern "C++"
181
189
0 commit comments