xref: /utopia/UTPA2-700.0.x/projects/tools/lint/aeon_include/_ansi.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
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 #include <newlib.h>
16 #include <sys/config.h>
17 
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.  */
21 
22 #ifdef __STDC__
23 #define _HAVE_STDC
24 #endif
25 
26 #ifdef _HAVE_STDC
27 #define	_PTR		void *
28 #define	_AND		,
29 #define	_NOARGS		void
30 #define	_CONST		const
31 #define	_VOLATILE	volatile
32 #define	_SIGNED		signed
33 #define	_DOTS		, ...
34 #define _VOID void
35 #ifdef __CYGWIN__
36 #define	_EXFUN(name, proto)		__cdecl name proto
37 #define	_EXPARM(name, proto)		(* __cdecl name) proto
38 #else
39 #define	_EXFUN(name, proto)		name proto
40 #define _EXPARM(name, proto)		(* name) proto
41 #endif
42 #define	_DEFUN(name, arglist, args)	name(args)
43 #define	_DEFUN_VOID(name)		name(_NOARGS)
44 #define _CAST_VOID (void)
45 #ifndef _LONG_DOUBLE
46 #define _LONG_DOUBLE long double
47 #endif
48 #ifndef _PARAMS
49 #define _PARAMS(paramlist)		paramlist
50 #endif
51 #else
52 #define	_PTR		char *
53 #define	_AND		;
54 #define	_NOARGS
55 #define	_CONST
56 #define	_VOLATILE
57 #define	_SIGNED
58 #define	_DOTS
59 #define _VOID void
60 #define	_EXFUN(name, proto)		name()
61 #define	_DEFUN(name, arglist, args)	name arglist args;
62 #define	_DEFUN_VOID(name)		name()
63 #define _CAST_VOID
64 #define _LONG_DOUBLE double
65 #ifndef _PARAMS
66 #define _PARAMS(paramlist)		()
67 #endif
68 #endif
69 
70 /* Support gcc's __attribute__ facility.  */
71 
72 #ifdef __GNUC__
73 #define _ATTRIBUTE(attrs) __attribute__ (attrs)
74 #else
75 #define _ATTRIBUTE(attrs)
76 #endif
77 
78 /*  ISO C++.  */
79 
80 #ifdef __cplusplus
81 #if !(defined(_BEGIN_STD_C) && defined(_END_STD_C))
82 #ifdef _HAVE_STD_CXX
83 #define _BEGIN_STD_C namespace std { extern "C" {
84 #define _END_STD_C  } }
85 #else
86 #define _BEGIN_STD_C extern "C" {
87 #define _END_STD_C  }
88 #endif
89 #endif
90 #else
91 #define _BEGIN_STD_C
92 #define _END_STD_C
93 #endif
94 
95 #endif /* _ANSIDECL_H_ */
96