From 15b71e66797fb4f2705532da0d08bd656b8c621c Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 21 Apr 2009 18:24:59 +0000 Subject: 2009-04-21 Mark Mitchell * libc/include/_ansi.h: Move C++ defines to top of file. (_NOTHROW): New macro. (_EXFUN_NOTHROW): Likewise. * libc/include/stdlib.h (calloc): Declare with _EXFUN_NOTHROW. (free): Likewise. (malloc): Likewise. (realloc): Likewise. (_malloc_r): Likewise. (_callor_r): Likewise. (_free_r): Likewise. (_realloc_r): Likewise. --- newlib/libc/include/_ansi.h | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'newlib/libc/include/_ansi.h') diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index 3ece8e184..5b2da4e4b 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -23,6 +23,31 @@ #define _HAVE_STDC #endif +/* ISO C++. */ + +#ifdef __cplusplus +#if !(defined(_BEGIN_STD_C) && defined(_END_STD_C)) +#ifdef _HAVE_STD_CXX +#define _BEGIN_STD_C namespace std { extern "C" { +#define _END_STD_C } } +#else +#define _BEGIN_STD_C extern "C" { +#define _END_STD_C } +#endif +#if defined(__GNUC__) && \ + ( (__GNUC__ >= 4) || \ + ( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 3) ) ) +#define _NOTHROW __attribute__ ((nothrow)) +#else +#define _NOTHROW throw() +#endif +#endif +#else +#define _BEGIN_STD_C +#define _END_STD_C +#define _NOTHROW +#endif + #ifdef _HAVE_STDC #define _PTR void * #define _AND , @@ -33,9 +58,11 @@ #define _DOTS , ... #define _VOID void #ifdef __CYGWIN__ +#define _EXFUN_NOTHROW(name, proto) __cdecl name proto _NOTHROW #define _EXFUN(name, proto) __cdecl name proto #define _EXPARM(name, proto) (* __cdecl name) proto #else +#define _EXFUN_NOTHROW(name, proto) name proto _NOTHROW #define _EXFUN(name, proto) name proto #define _EXPARM(name, proto) (* name) proto #endif @@ -61,6 +88,7 @@ #define _DOTS #define _VOID void #define _EXFUN(name, proto) name() +#define _EXFUN_NOTHROW(name, proto) name() #define _DEFUN(name, arglist, args) name arglist args; #define _DEFUN_VOID(name) name() #define _CAST_VOID @@ -100,21 +128,4 @@ #define _ELIDABLE_INLINE __inline__ #endif -/* ISO C++. */ - -#ifdef __cplusplus -#if !(defined(_BEGIN_STD_C) && defined(_END_STD_C)) -#ifdef _HAVE_STD_CXX -#define _BEGIN_STD_C namespace std { extern "C" { -#define _END_STD_C } } -#else -#define _BEGIN_STD_C extern "C" { -#define _END_STD_C } -#endif -#endif -#else -#define _BEGIN_STD_C -#define _END_STD_C -#endif - #endif /* _ANSIDECL_H_ */ -- cgit v1.2.3