annotate src/ansidecl.h @ 10:1ae09f1ddaa9

Move additional dynamic libraries under lib/
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Aug 2013 15:02:32 +0300
parents 785057719d9b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /* ANSI and traditional C compatability macros
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 Free Software Foundation, Inc.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 This file is part of the GNU C Library.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 This program is free software; you can redistribute it and/or modify
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 the Free Software Foundation; either version 2 of the License, or
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 (at your option) any later version.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 This program is distributed in the hope that it will be useful,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 GNU General Public License for more details.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 along with this program; if not, write to the Free Software
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 /* ANSI and traditional C compatibility macros
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 ANSI C is assumed if __STDC__ is #defined.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 Macro ANSI C definition Traditional C definition
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 ----- ---- - ---------- ----------- - ----------
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 ANSI_PROTOTYPES 1 not defined
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 PTR `void *' `char *'
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 PTRCONST `void *const' `char *'
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 LONG_DOUBLE `long double' `double'
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 const not defined `'
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 volatile not defined `'
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 signed not defined `'
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 VA_START(ap, var) va_start(ap, var) va_start(ap)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 Note that it is safe to write "void foo();" indicating a function
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 with no return value, in all K+R compilers we have been able to test.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 For declaring functions with prototypes, we also provide these:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 PARAMS ((prototype))
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 -- for functions which take a fixed number of arguments. Use this
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 when declaring the function. When defining the function, write a
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 K+R style argument list. For example:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 char *strcpy PARAMS ((char *dest, char *source));
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 ...
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 char *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 strcpy (dest, source)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 char *dest;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 char *source;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 { ... }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 VPARAMS ((prototype, ...))
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 -- for functions which take a variable number of arguments. Use
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 PARAMS to declare the function, VPARAMS to define it. For example:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 int printf PARAMS ((const char *format, ...));
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 ...
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 int
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 printf VPARAMS ((const char *format, ...))
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 ...
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 For writing functions which take variable numbers of arguments, we
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros. These
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 hide the differences between K+R <varargs.h> and C89 <stdarg.h> more
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 thoroughly than the simple VA_START() macro mentioned above.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 corresponding to the list of fixed arguments. Then use va_arg
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 normally to get the variable arguments, or pass your va_list object
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 around. You do not declare the va_list yourself; VA_OPEN does it
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 for you.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 Here is a complete example:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 int
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 printf VPARAMS ((const char *format, ...))
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 int result;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 VA_OPEN (ap, format);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 VA_FIXEDARG (ap, const char *, format);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 result = vfprintf (stdout, format, ap);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 VA_CLOSE (ap);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 return result;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 You can declare variables either before or after the VA_OPEN,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 VA_FIXEDARG sequence. Also, VA_OPEN and VA_CLOSE are the beginning
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 and end of a block. They must appear at the same nesting level,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 and any variables declared after VA_OPEN go out of scope at
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 VA_CLOSE. Unfortunately, with a K+R compiler, that includes the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 argument list. You can have multiple instances of VA_OPEN/VA_CLOSE
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 pairs in a single function in case you need to traverse the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 argument list more than once.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 For ease of writing code which uses GCC extensions but needs to be
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 portable to other compilers, we provide the GCC_VERSION macro that
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 wrappers around __attribute__. Also, __extension__ will be #defined
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 to nothing if it doesn't work. See below.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 This header also defines a lot of obsolete macros:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 AND, DOTS, NOARGS. Don't use them. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 #ifndef _ANSIDECL_H
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 #define _ANSIDECL_H 1
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 /* Every source file includes this file,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 so they will all get the switch for lint. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 /* LINTLIBRARY */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 /* Using MACRO(x,y) in cpp #if conditionals does not work with some
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 older preprocessors. Thus we can't define something like this:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 #define HAVE_GCC_VERSION(MAJOR, MINOR) \
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 and then test "#if HAVE_GCC_VERSION(2,7)".
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 So instead we use the macro below and test it against specific values. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 /* This macro simplifies testing whether we are using gcc, and if it
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 is of a particular minimum version. (Both major & minor numbers are
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 significant.) This macro will evaluate to 0 if we are not using
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 gcc at all. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 #ifndef GCC_VERSION
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 #endif /* GCC_VERSION */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 #if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 /* All known AIX compilers implement these things (but don't always
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 define __STDC__). The RISC/OS MIPS compiler defines these things
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 in SVR4 mode, but does not define __STDC__. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 #define ANSI_PROTOTYPES 1
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 #define PTR void *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 #define PTRCONST void *const
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 #define LONG_DOUBLE long double
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 #define PARAMS(ARGS) ARGS
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 #define VPARAMS(ARGS) ARGS
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 #define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 /* variadic function helper macros */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 /* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 use without inhibiting further decls and without declaring an
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 actual variable. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 #define VA_OPEN(AP, VAR) { va_list AP; va_start(AP, VAR); { struct Qdmy
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 #define VA_CLOSE(AP) } va_end(AP); }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 #define VA_FIXEDARG(AP, T, N) struct Qdmy
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 #undef const
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 #undef volatile
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 #undef signed
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 /* inline requires special treatment; it's in C99, and GCC >=2.7 supports
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 it too, but it's not in C89. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 #undef inline
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168 #if __STDC_VERSION__ > 199901L
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 /* it's a keyword */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 #else
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 # if GCC_VERSION >= 2007
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 # define inline __inline__ /* __inline__ prevents -pedantic warnings */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 # else
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 # define inline /* nothing */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 # endif
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 #endif
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 /* These are obsolete. Do not use. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 #ifndef IN_GCC
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 #define CONST const
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 #define VOLATILE volatile
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 #define SIGNED signed
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 #define PROTO(type, name, arglist) type name arglist
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 #define EXFUN(name, proto) name proto
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 #define DEFUN(name, arglist, args) name(args)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 #define DEFUN_VOID(name) name(void)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 #define AND ,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 #define DOTS , ...
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 #define NOARGS void
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 #endif /* ! IN_GCC */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193 #else /* Not ANSI C. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 #undef ANSI_PROTOTYPES
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196 #define PTR char *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 #define PTRCONST PTR
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 #define LONG_DOUBLE double
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 #define PARAMS(args) ()
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 #define VPARAMS(args) (va_alist) va_dcl
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 #define VA_START(va_list, var) va_start(va_list)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 #define VA_OPEN(AP, VAR) { va_list AP; va_start(AP); { struct Qdmy
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 #define VA_CLOSE(AP) } va_end(AP); }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 #define VA_FIXEDARG(AP, TYPE, NAME) TYPE NAME = va_arg(AP, TYPE)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 /* some systems define these in header files for non-ansi mode */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 #undef const
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 #undef volatile
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 #undef signed
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212 #undef inline
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 #define const
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214 #define volatile
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 #define signed
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
216 #define inline
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 #ifndef IN_GCC
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 #define CONST
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 #define VOLATILE
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221 #define SIGNED
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
222
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223 #define PROTO(type, name, arglist) type name ()
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224 #define EXFUN(name, proto) name()
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 #define DEFUN(name, arglist, args) name arglist args;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 #define DEFUN_VOID(name) name()
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 #define AND ;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 #define DOTS
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 #define NOARGS
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 #endif /* ! IN_GCC */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232 #endif /* ANSI C. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 /* Define macros for some gcc attributes. This permits us to use the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235 macros freely, and know that they will come into play for the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 version of gcc in which they are supported. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 #if (GCC_VERSION < 2007)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 # define __attribute__(x)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240 #endif
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 /* Attribute __malloc__ on functions was valid as of gcc 2.96. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 #ifndef ATTRIBUTE_MALLOC
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 # if (GCC_VERSION >= 2096)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 # define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246 # else
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247 # define ATTRIBUTE_MALLOC
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248 # endif /* GNUC >= 2.96 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 #endif /* ATTRIBUTE_MALLOC */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251 /* Attributes on labels were valid as of gcc 2.93. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 #ifndef ATTRIBUTE_UNUSED_LABEL
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 # if (GCC_VERSION >= 2093)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 # define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 # else
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 # define ATTRIBUTE_UNUSED_LABEL
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 # endif /* GNUC >= 2.93 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 #endif /* ATTRIBUTE_UNUSED_LABEL */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260 #ifndef ATTRIBUTE_UNUSED
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 #endif /* ATTRIBUTE_UNUSED */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 #ifndef ATTRIBUTE_NORETURN
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 #define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 #endif /* ATTRIBUTE_NORETURN */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 #ifndef ATTRIBUTE_PRINTF
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 #define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270 #define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 #define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 #define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273 #define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 #define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275 #endif /* ATTRIBUTE_PRINTF */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 /* We use __extension__ in some places to suppress -pedantic warnings
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 about GCC extensions. This feature didn't work properly before
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279 gcc 2.8. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280 #if GCC_VERSION < 2008
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 #define __extension__
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 #endif
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 /* Bootstrap support: Adjust certain macros defined by Autoconf,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 which are only valid for the stage1 compiler. If we detect
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286 a modern version of GCC, we are probably in stage2 or beyond,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 so unconditionally reset the values. Note that const, inline,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 etc. have been dealt with above. */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 #if (GCC_VERSION >= 2007)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290 # ifndef HAVE_LONG_DOUBLE
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 # define HAVE_LONG_DOUBLE 1
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 # endif
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293 #endif /* GCC >= 2.7 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 #endif /* ansidecl.h */