2002-06-15 15:49:32 +00:00
|
|
|
/* Provide support for both ANSI and non-ANSI environments. */
|
|
|
|
|
|
|
|
/* Some ANSI environments are "broken" in the sense that __STDC__ cannot be
|
|
|
|
relied upon to have it's intended meaning. Therefore we must use our own
|
|
|
|
concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib
|
|
|
|
sources!
|
|
|
|
|
|
|
|
To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will
|
|
|
|
"comment out" the non-ANSI parts of the ANSI header files (non-ANSI header
|
|
|
|
files aren't affected). */
|
|
|
|
|
2010-02-22 21:24:09 +00:00
|
|
|
#ifndef _ANSIDECL_H_
|
|
|
|
#define _ANSIDECL_H_
|
2002-06-15 15:49:32 +00:00
|
|
|
|
|
|
|
/* First try to figure out whether we really are in an ANSI C environment. */
|
|
|
|
/* FIXME: This probably needs some work. Perhaps sys/config.h can be
|
|
|
|
prevailed upon to give us a clue. */
|
|
|
|
|
|
|
|
#ifdef __STDC__
|
|
|
|
#define _HAVE_STDC
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _HAVE_STDC
|
2010-02-22 21:24:09 +00:00
|
|
|
#define _PTR void *
|
|
|
|
#define _AND ,
|
|
|
|
#define _NOARGS void
|
|
|
|
#define _CONST const
|
|
|
|
#define _VOLATILE volatile
|
|
|
|
#define _SIGNED signed
|
|
|
|
#define _DOTS , ...
|
2002-06-15 15:49:32 +00:00
|
|
|
#define _VOID void
|
|
|
|
#ifdef __CYGWIN__
|
2010-02-22 21:24:09 +00:00
|
|
|
#define _EXFUN(name, proto) __cdecl name proto
|
|
|
|
#define _EXPARM(name, proto) (* __cdecl name) proto
|
2002-06-15 15:49:32 +00:00
|
|
|
#else
|
2010-02-22 21:24:09 +00:00
|
|
|
#define _EXFUN(name, proto) name proto
|
|
|
|
#define _EXPARM(name, proto) (* name) proto
|
2002-06-15 15:49:32 +00:00
|
|
|
#endif
|
2010-02-22 21:24:09 +00:00
|
|
|
#define _DEFUN(name, arglist, args) name(args)
|
|
|
|
#define _DEFUN_VOID(name) name(_NOARGS)
|
2002-06-15 15:49:32 +00:00
|
|
|
#define _CAST_VOID (void)
|
|
|
|
#ifndef _LONG_DOUBLE
|
|
|
|
#define _LONG_DOUBLE long double
|
|
|
|
#endif
|
|
|
|
#ifndef _PARAMS
|
2010-02-22 21:24:09 +00:00
|
|
|
#define _PARAMS(paramlist) paramlist
|
2002-06-15 15:49:32 +00:00
|
|
|
#endif
|
2010-02-22 21:24:09 +00:00
|
|
|
#else
|
|
|
|
#define _PTR char *
|
|
|
|
#define _AND ;
|
|
|
|
#define _NOARGS
|
|
|
|
#define _CONST
|
|
|
|
#define _VOLATILE
|
|
|
|
#define _SIGNED
|
|
|
|
#define _DOTS
|
2002-06-15 15:49:32 +00:00
|
|
|
#define _VOID void
|
2010-02-22 21:24:09 +00:00
|
|
|
#define _EXFUN(name, proto) name()
|
|
|
|
#define _DEFUN(name, arglist, args) name arglist args;
|
|
|
|
#define _DEFUN_VOID(name) name()
|
2002-06-15 15:49:32 +00:00
|
|
|
#define _CAST_VOID
|
|
|
|
#define _LONG_DOUBLE double
|
|
|
|
#ifndef _PARAMS
|
2010-02-22 21:24:09 +00:00
|
|
|
#define _PARAMS(paramlist) ()
|
2002-06-15 15:49:32 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Support gcc's __attribute__ facility. */
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#define _ATTRIBUTE(attrs) __attribute__ (attrs)
|
|
|
|
#else
|
|
|
|
#define _ATTRIBUTE(attrs)
|
|
|
|
#endif
|
|
|
|
|
2005-02-28 09:48:35 +00:00
|
|
|
#define ATTRIBUTE_PRINTF(fmt, arg1) _ATTRIBUTE( ( format( printf, fmt, arg1 ) ) )
|
2006-01-25 01:33:48 +00:00
|
|
|
#define ATTRIBUTE_SCANF(fmt, arg1) _ATTRIBUTE( ( format( scanf, fmt, arg1 ) ) )
|
2005-02-28 09:48:35 +00:00
|
|
|
|
2002-06-15 15:49:32 +00:00
|
|
|
#endif /* _ANSIDECL_H_ */
|