Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2009-04-21 22:24:59 +0400
committerJeff Johnston <jjohnstn@redhat.com>2009-04-21 22:24:59 +0400
commit15b71e66797fb4f2705532da0d08bd656b8c621c (patch)
tree16c89947e62c7d707acca34404cec7f09599870f /newlib/libc/include/_ansi.h
parent6e9c1e8dd52d8b43e57b8b664e4cd087b0566cd2 (diff)
2009-04-21 Mark Mitchell <mark@codesourcery.com>
* 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.
Diffstat (limited to 'newlib/libc/include/_ansi.h')
-rw-r--r--newlib/libc/include/_ansi.h45
1 files changed, 28 insertions, 17 deletions
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_ */