avr-libc icon indicating copy to clipboard operation
avr-libc copied to clipboard

[patch #7467] Add support for c++ new and delete operators

Open avrs-admin opened this issue 3 years ago • 2 comments

Thu 17 Feb 2011 05:06:48 AM CET

Patch adds support to avr-libc for the c++ operators new and delete.

This patch wraps the malloc and free c functions in the new and delete operators, and as such does not support exceptions as the standard c++ new and delete do.

The patch adds c++ compilation support to configure.ac so that the file new.cc is compiled into the library. new.cc is added to stdlib. devtools files Device.am and Architecture.am are updated to fix AM_CXXFLAGS to include -mmcu and other AVR specific compile options.

This patch includes updating the faq documentation c++ support section to update the information about new and delete.

Tested on avr-libc from svn 2217 on system with avr c++ support

Todo: test compiling avr-libc on system without avr c++ support. It should simply not compile and add new.cc to libc

file #22707: stdlib_new_delete.patch

This issue was migrated from https://savannah.nongnu.org/patch/?7467

avrs-admin avatar Jan 31 '22 08:01 avrs-admin

Eric Weddington Fri 13 May 2011 01:17:33 AM CEST

We need to decide if we even want C++ code in avr-libc. Though I understand the usefulness of this patch since we still don't have libstdc++ built yet.

avrs-admin avatar Jan 31 '22 08:01 avrs-admin

Bradley Jarvis <bradley_jarvis> Fri 13 May 2011 05:31:50 AM CEST

I say yes, but I am biased. It would save me having to add my patch every time I update avrlibc. And since I use gentoo it would be a bit of a pain to do this for each update (I currently compile/install avrlibc manually).

c++ support is also mentioned in the avrlibc FAQ, which technically is a gcc issue since that is where libstdc++ resides.

At the end of the day all it does is add an extra feature avr gcc support that if not wanted can be compiled out (simply compile library without c++ support).

The C++ support added to the avrlibc compilation files has been done in a standard way too (not just a hack fix) even if the patch in itself is a hack fix.

avrs-admin avatar Jan 31 '22 08:01 avrs-admin