define option to disable cpp allocation overrides (#1145)

Setting `PICO_CXX_DISABLE_ALLOCATION_OVERRIDES=1` will prevent `new` etc. operators being overridden
This commit is contained in:
Sencer 2023-01-29 19:40:01 +01:00 committed by GitHub
parent 2a9c59925a
commit c852a65ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@
#if !PICO_CXX_ENABLE_EXCEPTIONS #if !PICO_CXX_ENABLE_EXCEPTIONS
// Override the standard allocators to use regular malloc/free // Override the standard allocators to use regular malloc/free
#if !PICO_CXX_DISABLE_ALLOCATION_OVERRIDES // Let user override
#include <cstdlib> #include <cstdlib>
void *operator new(std::size_t n) { void *operator new(std::size_t n) {
@ -30,3 +31,5 @@ void operator delete[](void *p, __unused std::size_t n) noexcept { std::free(p);
#endif #endif
#endif #endif
#endif