aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/new.cpp
AgeCommit message (Collapse)Author
2020-09-17Use std::size_t in new/deleteMatthijs Kooijman
The standard dictates that `std::size_t` is used, rather than the plain `size_t` type. Even though these types are usually, if not always, exactly the same type, other code might assume that `std::size_t` is actually used and thus also available under that name after including `<new>`. This fixes that by using the right type. One challenge is that it is usually declared in headers that we do not have available, so this just defines the `std::size_t` type in the `<new>` header to work around that.
2020-09-17Optionally let new terminate on allocation failureMatthijs Kooijman
This is currently disabled, keeping the old behavior of returning NULL on failure, but should probably be enabled in the future as code that does want to do a null check has had a chance to switch to the more portable nothrow versions. When enabled, allocation failure calls the weak `std::terminate()`, which calls `abort()` by default, but can be replaced by user code to do more specific handling. To enable this, a macro must be defined (in new.cpp or on the compiler commandline). This fixes part of #287.
2020-09-17Make zero-sized new standards-compliantMatthijs Kooijman
This fixes part of #287.
2020-09-17Clean up and complete `<new>` headerMatthijs Kooijman
This makes this header complete up to including C++14, except two exception classes that cannot be defined without `<exception>`. The functions related to the "new_handler" are declared but not actually defined, to prevent overhead and complexity. They are still declared to allow implementing them in user code if needed. This makes the implementation of all operator new and delete functions comply with the C++11/C++14 specification in terms of which should be actually implemented and which should be delegate to other functions. There are still some areas where these implementations are not entirely standards-compliant, which will be fixed in subsequent commits. This fixes part of #287 and fixes #47.
2018-10-26Add noexcept specifier to placement new operatorPharap
The standard mandates that placement new should be have a noexcept specifier.
2018-08-18Prevent possible compiler warningPharap
Casting to void is a well known trick for prevening 'unused parameter' warnings.
2018-08-18Add placement new operatorPharap
2014-09-06Fixed license for new.cpp and small cosmetic changesCristian Maglie
2014-09-06Correct implementation of gcc specific internal functionsCristian Maglie
The following empty stubs has been replaced by the gcc flag -fno-threadsafe-static: int __cxa_guard_acquire(__guard *); void __cxa_guard_release (__guard *); void __cxa_guard_abort (__guard *); The following empty stubs has been moved into their specific module abi.cpp: void __cxa_pure_virtual(void) __attribute ((noreturn)); void __cxa_deleted_virtual(void) __attribute ((noreturn)); Fix #107
2012-12-16Add trivial new[] and delete[] operators (Justin R. Cutler)Cristian Maglie
Fixes #73 Fixes #883
2011-04-10Added virtual destructor to Printable, which also requires new and delete ↵amcewen
operators to be added