mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 10:12:45 +01:00
sys/cpp11-compat: use new/delete from sys/cpp_new_delete
The `new` and `delete` operators that don't need `libtsdc++` are also provided by module `sys/cpp_new_delete` for platforms that don't have the `libstdc++`. Since these operators in `sys/cpp11-compat` are just wrappers for standard `malloc`/`free` functions like in `sys/cpp_new_delete`, the `new`/`delete` operators that don't need `libstdc++` are used from `sys/cpp_new_delete`. Only the `new`/`delete` operators that require the `libstd++` are left in `sys/cpp11-compat`. So it is sufficient for the use of the (re)defined `new`/`delete` operators that an application uses the module `sys/cpp_new_delete` instead of `sys/cpp11-compat` and thus also works on platforms without `libstdc++`.
This commit is contained in:
parent
3c5c351ef5
commit
eaf3a4c81a
@ -337,6 +337,7 @@ ifneq (,$(filter log_%,$(USEMODULE)))
|
||||
endif
|
||||
|
||||
ifneq (,$(filter cpp11-compat,$(USEMODULE)))
|
||||
USEMODULE += cpp_new_delete
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += timex
|
||||
FEATURES_REQUIRED += cpp
|
||||
|
@ -106,22 +106,6 @@ void __verbose_terminate_handler()
|
||||
Elegant Invention
|
||||
*/
|
||||
|
||||
void* operator new(std::size_t size) {
|
||||
return std::malloc(size);
|
||||
}
|
||||
|
||||
void* operator new[](std::size_t size) {
|
||||
return std::malloc(size);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr) noexcept {
|
||||
std::free(ptr);
|
||||
}
|
||||
|
||||
void operator delete[](void* ptr) noexcept {
|
||||
std::free(ptr);
|
||||
}
|
||||
|
||||
/* Optionally you can override the 'nothrow' versions as well.
|
||||
This is useful if you want to catch failed allocs with your
|
||||
own debug code, or keep track of heap usage for example,
|
||||
|
Loading…
Reference in New Issue
Block a user