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:
parent
2a9c59925a
commit
c852a65ecc
@ -4,9 +4,10 @@
|
|||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* 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
|
// 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
|
||||||
|
Loading…
Reference in New Issue
Block a user