mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
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:
parent
6cf6c92b05
commit
cc418dd08f
@ -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"
|
||||
|
||||
@ -34,7 +34,8 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "utility.h"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
48
include/etl/private/new.h
Normal 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
|
||||
@ -34,7 +34,7 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "container.h"
|
||||
|
||||
@ -34,7 +34,7 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "mutex.h"
|
||||
|
||||
@ -34,7 +34,7 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "alignment.h"
|
||||
|
||||
@ -34,7 +34,7 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "alignment.h"
|
||||
|
||||
@ -34,7 +34,7 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "alignment.h"
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "container.h"
|
||||
|
||||
@ -34,7 +34,7 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "utility.h"
|
||||
|
||||
@ -37,7 +37,7 @@ SOFTWARE.
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user