libxx: New sized delete operators are only for C++14

This commit is contained in:
Gregory Nutt 2017-08-14 14:26:59 -06:00
parent f383308a02
commit d0343565c0
3 changed files with 183 additions and 153 deletions

View File

@ -76,6 +76,14 @@
# define CONFIG_HAVE_BUILTIN_CLZ 1 # define CONFIG_HAVE_BUILTIN_CLZ 1
#endif #endif
/* C++ support */
#if __cplusplus == 201402L
# define CONFIG_HAVE_CXX14 1
#else
# undef CONFIG_HAVE_CXX14
#endif
/* Attributes /* Attributes
* *
* GCC supports weak symbols which can be used to reduce code size because * GCC supports weak symbols which can be used to reduce code size because
@ -130,7 +138,7 @@
# define inline_function __attribute__ ((always_inline,no_instrument_function)) # define inline_function __attribute__ ((always_inline,no_instrument_function))
# define noinline_function __attribute__ ((noinline)) # define noinline_function __attribute__ ((noinline))
/* GCC has does not use storage classes to qualify addressing */ /* GCC does not use storage classes to qualify addressing */
# define FAR # define FAR
# define NEAR # define NEAR
@ -281,6 +289,10 @@
# pragma disable_warning 85 # pragma disable_warning 85
/* C++ support */
# undef CONFIG_HAVE_CXX14
/* Attributes /* Attributes
* *
* SDCC does not support weak symbols */ * SDCC does not support weak symbols */
@ -399,6 +411,10 @@
# define IOBJ # define IOBJ
# define IPTR # define IPTR
/* C++ support */
# undef CONFIG_HAVE_CXX14
/* Attributes /* Attributes
* *
* The Zilog compiler does not support weak symbols * The Zilog compiler does not support weak symbols
@ -529,6 +545,10 @@
# pragma section = ".data_init" # pragma section = ".data_init"
# pragma section = ".text" # pragma section = ".text"
/* C++ support */
# undef CONFIG_HAVE_CXX14
/* Unknown compiler *********************************************************/ /* Unknown compiler *********************************************************/
#else #else
@ -538,6 +558,7 @@
# undef CONFIG_HAVE_FUNCTIONNAME # undef CONFIG_HAVE_FUNCTIONNAME
# undef CONFIG_HAVE_FILENAME # undef CONFIG_HAVE_FILENAME
# undef CONFIG_HAVE_WEAKFUNCTIONS # undef CONFIG_HAVE_WEAKFUNCTIONS
# undef CONFIG_HAVE_CXX14
# define weak_alias(name, aliasname) # define weak_alias(name, aliasname)
# define weak_function # define weak_function
# define weak_const_function # define weak_const_function

View File

@ -37,10 +37,12 @@
// Included Files // Included Files
//*************************************************************************** //***************************************************************************
#include <nuttx/config.h> #include <nuttx/compiler.h>
#include "libxx.hxx" #include "libxx.hxx"
#ifdef CONFIG_HAVE_CXX14
//*************************************************************************** //***************************************************************************
// Operators // Operators
//*************************************************************************** //***************************************************************************
@ -68,3 +70,5 @@ void operator delete(FAR void *ptr, unsigned int size)
{ {
lib_free(ptr); lib_free(ptr);
} }
#endif /* CONFIG_HAVE_CXX14 */

View File

@ -38,9 +38,12 @@
//*************************************************************************** //***************************************************************************
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/compiler.h>
#include "libxx.hxx" #include "libxx.hxx"
#ifdef CONFIG_HAVE_CXX14
//*************************************************************************** //***************************************************************************
// Operators // Operators
//*************************************************************************** //***************************************************************************
@ -58,3 +61,5 @@ void operator delete[](FAR void *ptr, unsigned int size)
{ {
lib_free(ptr); lib_free(ptr);
} }
#endif /* CONFIG_HAVE_CXX14 */