1
/* Provide support for both ANSI and non-ANSI environments. */
3
/* Some ANSI environments are "broken" in the sense that __STDC__ cannot be
4
relied upon to have it's intended meaning. Therefore we must use our own
5
concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib
8
To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will
9
"comment out" the non-ANSI parts of the ANSI header files (non-ANSI header
10
files aren't affected). */
16
#include <sys/config.h>
18
/* First try to figure out whether we really are in an ANSI C environment. */
19
/* FIXME: This probably needs some work. Perhaps sys/config.h can be
20
prevailed upon to give us a clue. */
29
#if !(defined(_BEGIN_STD_C) && defined(_END_STD_C))
31
#define _BEGIN_STD_C namespace std { extern "C" {
32
#define _END_STD_C } }
34
#define _BEGIN_STD_C extern "C" {
37
#if defined(__GNUC__) && \
38
( (__GNUC__ >= 4) || \
39
( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 3) ) )
40
#define _NOTHROW __attribute__ ((nothrow))
42
#define _NOTHROW throw()
56
#define _VOLATILE volatile
57
#define _SIGNED signed
61
#define _EXFUN_NOTHROW(name, proto) __cdecl name proto _NOTHROW
62
#define _EXFUN(name, proto) __cdecl name proto
63
#define _EXPARM(name, proto) (* __cdecl name) proto
64
#define _EXFNPTR(name, proto) (__cdecl * name) proto
66
#define _EXFUN_NOTHROW(name, proto) name proto _NOTHROW
67
#define _EXFUN(name, proto) name proto
68
#define _EXPARM(name, proto) (* name) proto
69
#define _EXFNPTR(name, proto) (* name) proto
71
#define _DEFUN(name, arglist, args) name(args)
72
#define _DEFUN_VOID(name) name(_NOARGS)
73
#define _CAST_VOID (void)
75
#define _LONG_DOUBLE long double
77
#ifndef _LONG_LONG_TYPE
78
#define _LONG_LONG_TYPE long long
81
#define _PARAMS(paramlist) paramlist
92
#define _EXFUN(name, proto) name()
93
#define _EXFUN_NOTHROW(name, proto) name()
94
#define _DEFUN(name, arglist, args) name arglist args;
95
#define _DEFUN_VOID(name) name()
97
#define _LONG_DOUBLE double
98
#define _LONG_LONG_TYPE long
100
#define _PARAMS(paramlist) ()
104
/* Support gcc's __attribute__ facility. */
106
#ifndef _ATTRIBUTE /* XXX Emscripten */
108
#define _ATTRIBUTE(attr) __attribute__ ((attr))
110
#define _ATTRIBUTE(attr)
112
#endif /* XXX Emscripten */
114
/* The traditional meaning of 'extern inline' for GCC is not
115
to emit the function body unless the address is explicitly
116
taken. However this behaviour is changing to match the C99
117
standard, which uses 'extern inline' to indicate that the
118
function body *must* be emitted. If we are using GCC, but do
119
not have the new behaviour, we need to use extern inline; if
120
we are using a new GCC with the C99-compatible behaviour, or
121
a non-GCC compiler (which we will have to hope is C99, since
122
there is no other way to achieve the effect of omitting the
123
function if it isn't referenced) we just use plain 'inline',
124
which c99 defines to mean more-or-less the same as the Gnu C
126
#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
127
/* We're using GCC, but without the new C99-compatible behaviour. */
128
#define _ELIDABLE_INLINE extern __inline__ _ATTRIBUTE ((__always_inline__))
130
/* We're using GCC in C99 mode, or an unknown compiler which
131
we just have to hope obeys the C99 semantics of inline. */
132
#define _ELIDABLE_INLINE __inline__
135
#endif /* _ANSIDECL_H_ */