From c852a65ecc8ad33452cc36dfe290e1891f9312ef Mon Sep 17 00:00:00 2001 From: Sencer <21215231+aramoki@users.noreply.github.com> Date: Sun, 29 Jan 2023 19:40:01 +0100 Subject: [PATCH] define option to disable cpp allocation overrides (#1145) Setting `PICO_CXX_DISABLE_ALLOCATION_OVERRIDES=1` will prevent `new` etc. operators being overridden --- src/rp2_common/pico_standard_link/new_delete.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rp2_common/pico_standard_link/new_delete.cpp b/src/rp2_common/pico_standard_link/new_delete.cpp index c122dc0..6d632e2 100644 --- a/src/rp2_common/pico_standard_link/new_delete.cpp +++ b/src/rp2_common/pico_standard_link/new_delete.cpp @@ -4,9 +4,10 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#if !PICO_CXX_ENABLE_EXCEPTIONS +#if !PICO_CXX_ENABLE_EXCEPTIONS // Override the standard allocators to use regular malloc/free +#if !PICO_CXX_DISABLE_ALLOCATION_OVERRIDES // Let user override #include 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