ArduinoSTL
ArduinoSTL copied to clipboard
Omit all new and delete implementation when AVR core provides it
This fixes remaining issues with new/delete conflicts between this library and the AVR core by simply omitting all new-related stuff from this library when the AVR core provides it.
For more info, see https://github.com/arduino-libraries/Arduino_AVRSTL/pull/2#issuecomment-1008798285 and the commit message of the main commit of this PR:
Since AVR core 1.8.3, it provides an (incomplete) new header that breaks
compilation of the uclibc++ new/delete .cpp files. Since 1.8.4 it
provides a complete new header, but that also introduces a linker
duplicate symbol issue for std::nothrow.
This commit adds a USING_NEW_FROM_UCLIBC define to our new include file,
which allows detecting which version of the new include is used. That
define is used to completely skip all new/delete code (all new_*.cpp and
del_*.cpp files) when the new header from the AVR-core is used.
This should fix all conflicts, except:
- On AVR core 1.8.3, new/delete is now incomplete. However, the missing
functions (array placement new, placement delete, nothrow versions
and delete with size) are probably not commonly used.
- If another library *also* offers <new>, then things might break in
different ways. Again, this is a rare corner case.
- This no longer provides set_new_handler, which the AVR core declares
but does not define. However, since the uclibc++ version did not
actually *use* the handler passed, not defining it is probably
better.
This PR was previously submitted against Arduino_AVRSTL, but since this repo seems to be a bit more active again and Arduino stopped maintaining their fork, I'm resubmitting this here.
@mike-matera You have no activities on this repository for 7 months. Do you need help? I desperately want this branch to be merged.
ping @mike-matera