1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +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:
Gunar Schorcht 2022-01-06 09:21:54 +01:00
parent 3c5c351ef5
commit eaf3a4c81a
2 changed files with 1 additions and 16 deletions

View File

@ -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

View File

@ -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,