Include new on megaAVR Boards (Arduino Nano Every) (#313)

* Change new to new.h

* Only include <new> header if ETL supports STL

* Adding a flag to define placement new if necessary

Co-authored-by: Heinz-Peter Liechtenecker <h.liechtenecker@fh-kaernten.at>
This commit is contained in:
Heinz-Peter Liechtenecker 2020-12-04 13:45:21 +01:00 committed by GitHub
parent 6cf6c92b05
commit cc418dd08f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 80 additions and 32 deletions

View File

@ -30,7 +30,8 @@ SOFTWARE.
#define ETL_CALLBACK_TIMER_INCLUDED
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "algorithm.h"

View File

@ -34,7 +34,8 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "utility.h"

View File

@ -31,7 +31,7 @@ SOFTWARE.
#ifndef ETL_FLAT_MAP_INCLUDED
#define ETL_FLAT_MAP_INCLUDED
#include <new>
#include "private/new.h"
#include "platform.h"
#include "reference_flat_map.h"

View File

@ -31,7 +31,7 @@ SOFTWARE.
#ifndef ETL_FLAT_MULTMAP_INCLUDED
#define ETL_FLAT_MULTMAP_INCLUDED
#include <new>
#include "private/new.h"
#include "platform.h"
#include "reference_flat_multimap.h"

View File

@ -31,7 +31,7 @@ SOFTWARE.
#ifndef ETL_FLAT_SET_INCLUDED
#define ETL_FLAT_SET_INCLUDED
#include <new>
#include "private/new.h"
#include "platform.h"
#include "reference_flat_set.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"

View File

@ -64,7 +64,7 @@ cog.outl("//********************************************************************
#define ETL_MESSAGE_ROUTER_INCLUDED
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "message.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"

View File

@ -38,13 +38,11 @@ SOFTWARE.
#include "utility.h"
#include "nullptr.h"
#include "alignment.h"
#include "private/new.h"
#include <assert.h>
#include <string.h>
#include <new>
#if ETL_USING_STL
#include <memory>
#endif

View File

@ -52,7 +52,7 @@ SOFTWARE.
#define ETL_MESSAGE_ROUTER_INCLUDED
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "message.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"

View File

@ -31,7 +31,7 @@ SOFTWARE.
#ifndef ETL_OPTIONAL_INCLUDED
#define ETL_OPTIONAL_INCLUDED
#include <new>
#include "private/new.h"
#include "platform.h"
#include "alignment.h"

View File

@ -31,7 +31,7 @@ SOFTWARE.
#ifndef ETL_PACKET_INCLUDED
#define ETL_PACKET_INCLUDED
#include <new>
#include "private/new.h"
#include "platform.h"
#include "static_assert.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include "platform.h"
#include <new>
#include "private/new.h"
#include "algorithm.h"
#include "iterator.h"

48
include/etl/private/new.h Normal file
View File

@ -0,0 +1,48 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2019 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_NEW_INCLUDED
#define ETL_NEW_INCLUDED
///\ingroup private
#include "../platform.h"
#ifdef ETL_NO_NEW_HEADER_AVAILABLE
// Define placement new if no new header is available
inline void* operator new(size_t, void* const __p){ return __p; }
inline void* operator new[](size_t, void* const __p){ return __p; }
inline void operator delete(void*, void* const){ }
inline void operator delete[](void*, void* const){ }
#else
#include <new>
#endif
#endif

View File

@ -34,7 +34,7 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "container.h"

View File

@ -34,7 +34,7 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "mutex.h"

View File

@ -34,7 +34,7 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "alignment.h"

View File

@ -34,7 +34,7 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "alignment.h"

View File

@ -34,7 +34,7 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "alignment.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "container.h"

View File

@ -34,7 +34,7 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "algorithm.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "algorithm.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "algorithm.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "algorithm.h"

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <stdint.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "utility.h"

View File

@ -37,7 +37,7 @@ SOFTWARE.
#include <stdint.h>
#include <stddef.h>
#include <new>
#include "private/new.h"
#include "platform.h"
#include "algorithm.h"