| 71 |
theseven |
1 |
/* Provide support for both ANSI and non-ANSI environments. */
|
|
|
2 |
|
|
|
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
|
|
|
6 |
sources!
|
|
|
7 |
|
|
|
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). */
|
|
|
11 |
|
|
|
12 |
#ifndef _ANSIDECL_H_
|
|
|
13 |
#define _ANSIDECL_H_
|
|
|
14 |
|
|
|
15 |
/* First try to figure out whether we really are in an ANSI C environment. */
|
|
|
16 |
/* FIXME: This probably needs some work. Perhaps sys/config.h can be
|
|
|
17 |
prevailed upon to give us a clue. */
|
|
|
18 |
|
|
|
19 |
#ifdef __STDC__
|
|
|
20 |
#define _HAVE_STDC
|
|
|
21 |
#endif
|
|
|
22 |
|
|
|
23 |
#ifdef _HAVE_STDC
|
|
|
24 |
#define _PTR void *
|
|
|
25 |
#define _AND ,
|
|
|
26 |
#define _NOARGS void
|
|
|
27 |
#define _CONST const
|
|
|
28 |
#define _VOLATILE volatile
|
|
|
29 |
#define _SIGNED signed
|
|
|
30 |
#define _DOTS , ...
|
|
|
31 |
#define _VOID void
|
|
|
32 |
#ifdef __CYGWIN__
|
|
|
33 |
#define _EXFUN(name, proto) __cdecl name proto
|
|
|
34 |
#define _EXPARM(name, proto) (* __cdecl name) proto
|
|
|
35 |
#else
|
|
|
36 |
#define _EXFUN(name, proto) name proto
|
|
|
37 |
#define _EXPARM(name, proto) (* name) proto
|
|
|
38 |
#endif
|
|
|
39 |
#define _DEFUN(name, arglist, args) name(args)
|
|
|
40 |
#define _DEFUN_VOID(name) name(_NOARGS)
|
|
|
41 |
#define _CAST_VOID (void)
|
|
|
42 |
#ifndef _LONG_DOUBLE
|
|
|
43 |
#define _LONG_DOUBLE long double
|
|
|
44 |
#endif
|
|
|
45 |
#ifndef _PARAMS
|
|
|
46 |
#define _PARAMS(paramlist) paramlist
|
|
|
47 |
#endif
|
|
|
48 |
#else
|
|
|
49 |
#define _PTR char *
|
|
|
50 |
#define _AND ;
|
|
|
51 |
#define _NOARGS
|
|
|
52 |
#define _CONST
|
|
|
53 |
#define _VOLATILE
|
|
|
54 |
#define _SIGNED
|
|
|
55 |
#define _DOTS
|
|
|
56 |
#define _VOID void
|
|
|
57 |
#define _EXFUN(name, proto) name()
|
|
|
58 |
#define _DEFUN(name, arglist, args) name arglist args;
|
|
|
59 |
#define _DEFUN_VOID(name) name()
|
|
|
60 |
#define _CAST_VOID
|
|
|
61 |
#define _LONG_DOUBLE double
|
|
|
62 |
#ifndef _PARAMS
|
|
|
63 |
#define _PARAMS(paramlist) ()
|
|
|
64 |
#endif
|
|
|
65 |
#endif
|
|
|
66 |
|
|
|
67 |
/* Support gcc's __attribute__ facility. */
|
|
|
68 |
|
|
|
69 |
#ifdef __GNUC__
|
|
|
70 |
#define _ATTRIBUTE(attrs) __attribute__ (attrs)
|
|
|
71 |
#else
|
|
|
72 |
#define _ATTRIBUTE(attrs)
|
|
|
73 |
#endif
|
|
|
74 |
|
|
|
75 |
#define ATTRIBUTE_PRINTF(fmt, arg1) _ATTRIBUTE( ( format( printf, fmt, arg1 ) ) )
|
|
|
76 |
#define ATTRIBUTE_SCANF(fmt, arg1) _ATTRIBUTE( ( format( scanf, fmt, arg1 ) ) )
|
|
|
77 |
|
|
|
78 |
#endif /* _ANSIDECL_H_ */
|