mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-19 02:24:17 +08:00
ansidecl.h: Reorganize for readability...
include: * ansidecl.h: Reorganize for readability, remove documentation of obsolete macros, document PARAMS and VPARAMS. Add new macros VA_OPEN, VA_CLOSE, and VA_FIXEDARG for nicer variadic function implementation. gcc: * cpperror.c: Use VA_OPEN/VA_CLOSE/VA_FIXEDARG throughout. From-SVN: r45011
This commit is contained in:
parent
76f4925a6f
commit
b649398a84
@ -1,3 +1,7 @@
|
|||||||
|
2001-08-18 Zack Weinberg <zackw@panix.com>
|
||||||
|
|
||||||
|
* cpperror.c: Use VA_OPEN/VA_CLOSE/VA_FIXEDARG throughout.
|
||||||
|
|
||||||
2001-08-18 Zack Weinberg <zackw@panix.com>
|
2001-08-18 Zack Weinberg <zackw@panix.com>
|
||||||
|
|
||||||
* haifa-sched.c: Convert to target hooks. Macros replaced
|
* haifa-sched.c: Convert to target hooks. Macros replaced
|
||||||
|
181
gcc/cpperror.c
181
gcc/cpperror.c
@ -142,22 +142,14 @@ _cpp_begin_message (pfile, code, pos)
|
|||||||
void
|
void
|
||||||
cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
|
cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
|
||||||
{
|
{
|
||||||
#ifndef ANSI_PROTOTYPES
|
VA_OPEN (ap, msgid);
|
||||||
cpp_reader *pfile;
|
VA_FIXEDARG (ap, cpp_reader *, pfile);
|
||||||
const char *msgid;
|
VA_FIXEDARG (ap, const char *, msgid);
|
||||||
#endif
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
VA_START (ap, msgid);
|
|
||||||
|
|
||||||
#ifndef ANSI_PROTOTYPES
|
|
||||||
pfile = va_arg (ap, cpp_reader *);
|
|
||||||
msgid = va_arg (ap, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_cpp_begin_message (pfile, ICE, 0))
|
if (_cpp_begin_message (pfile, ICE, 0))
|
||||||
v_message (msgid, ap);
|
v_message (msgid, ap);
|
||||||
va_end(ap);
|
|
||||||
|
VA_CLOSE (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Same as cpp_error, except we consider the error to be "fatal",
|
/* Same as cpp_error, except we consider the error to be "fatal",
|
||||||
@ -169,72 +161,47 @@ cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
|
|||||||
void
|
void
|
||||||
cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
|
cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
|
||||||
{
|
{
|
||||||
#ifndef ANSI_PROTOTYPES
|
VA_OPEN (ap, msgid);
|
||||||
cpp_reader *pfile;
|
VA_FIXEDARG (ap, cpp_reader *, pfile);
|
||||||
const char *msgid;
|
VA_FIXEDARG (ap, const char *, msgid);
|
||||||
#endif
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
VA_START (ap, msgid);
|
|
||||||
|
|
||||||
#ifndef ANSI_PROTOTYPES
|
|
||||||
pfile = va_arg (ap, cpp_reader *);
|
|
||||||
msgid = va_arg (ap, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_cpp_begin_message (pfile, FATAL, 0))
|
if (_cpp_begin_message (pfile, FATAL, 0))
|
||||||
v_message (msgid, ap);
|
v_message (msgid, ap);
|
||||||
va_end(ap);
|
|
||||||
|
VA_CLOSE (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
|
cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
|
||||||
{
|
{
|
||||||
#ifndef ANSI_PROTOTYPES
|
VA_OPEN (ap, msgid);
|
||||||
cpp_reader *pfile;
|
VA_FIXEDARG (ap, cpp_reader *, pfile);
|
||||||
const char *msgid;
|
VA_FIXEDARG (ap, const char *, msgid);
|
||||||
#endif
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
VA_START(ap, msgid);
|
|
||||||
|
|
||||||
#ifndef ANSI_PROTOTYPES
|
|
||||||
pfile = va_arg (ap, cpp_reader *);
|
|
||||||
msgid = va_arg (ap, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_cpp_begin_message (pfile, ERROR, 0))
|
if (_cpp_begin_message (pfile, ERROR, 0))
|
||||||
v_message (msgid, ap);
|
v_message (msgid, ap);
|
||||||
va_end(ap);
|
|
||||||
|
VA_CLOSE (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column,
|
cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column,
|
||||||
const char *msgid, ...))
|
const char *msgid, ...))
|
||||||
{
|
{
|
||||||
#ifndef ANSI_PROTOTYPES
|
|
||||||
cpp_reader *pfile;
|
|
||||||
int line;
|
|
||||||
int column;
|
|
||||||
const char *msgid;
|
|
||||||
#endif
|
|
||||||
va_list ap;
|
|
||||||
cpp_lexer_pos pos;
|
cpp_lexer_pos pos;
|
||||||
|
|
||||||
VA_START (ap, msgid);
|
VA_OPEN (ap, msgid);
|
||||||
|
VA_FIXEDARG (ap, cpp_reader *, pfile);
|
||||||
#ifndef ANSI_PROTOTYPES
|
VA_FIXEDARG (ap, int, line);
|
||||||
pfile = va_arg (ap, cpp_reader *);
|
VA_FIXEDARG (ap, int, column);
|
||||||
line = va_arg (ap, int);
|
VA_FIXEDARG (ap, const char *, msgid);
|
||||||
column = va_arg (ap, int);
|
|
||||||
msgid = va_arg (ap, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pos.line = line;
|
pos.line = line;
|
||||||
pos.col = column;
|
pos.col = column;
|
||||||
if (_cpp_begin_message (pfile, ERROR, &pos))
|
if (_cpp_begin_message (pfile, ERROR, &pos))
|
||||||
v_message (msgid, ap);
|
v_message (msgid, ap);
|
||||||
va_end(ap);
|
|
||||||
|
VA_CLOSE (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Error including a message from `errno'. */
|
/* Error including a message from `errno'. */
|
||||||
@ -249,127 +216,83 @@ cpp_error_from_errno (pfile, name)
|
|||||||
void
|
void
|
||||||
cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
|
cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
|
||||||
{
|
{
|
||||||
#ifndef ANSI_PROTOTYPES
|
VA_OPEN (ap, msgid);
|
||||||
cpp_reader *pfile;
|
VA_FIXEDARG (ap, cpp_reader *, pfile);
|
||||||
const char *msgid;
|
VA_FIXEDARG (ap, const char *, msgid);
|
||||||
#endif
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
VA_START (ap, msgid);
|
|
||||||
|
|
||||||
#ifndef ANSI_PROTOTYPES
|
|
||||||
pfile = va_arg (ap, cpp_reader *);
|
|
||||||
msgid = va_arg (ap, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_cpp_begin_message (pfile, WARNING, 0))
|
if (_cpp_begin_message (pfile, WARNING, 0))
|
||||||
v_message (msgid, ap);
|
v_message (msgid, ap);
|
||||||
va_end(ap);
|
|
||||||
|
VA_CLOSE (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
|
cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
|
||||||
const char *msgid, ...))
|
const char *msgid, ...))
|
||||||
{
|
{
|
||||||
#ifndef ANSI_PROTOTYPES
|
|
||||||
cpp_reader *pfile;
|
|
||||||
int line;
|
|
||||||
int column;
|
|
||||||
const char *msgid;
|
|
||||||
#endif
|
|
||||||
va_list ap;
|
|
||||||
cpp_lexer_pos pos;
|
cpp_lexer_pos pos;
|
||||||
|
|
||||||
VA_START (ap, msgid);
|
VA_OPEN (ap, msgid);
|
||||||
|
VA_FIXEDARG (ap, cpp_reader *, pfile);
|
||||||
#ifndef ANSI_PROTOTYPES
|
VA_FIXEDARG (ap, int, line);
|
||||||
pfile = va_arg (ap, cpp_reader *);
|
VA_FIXEDARG (ap, int, column);
|
||||||
line = va_arg (ap, int);
|
VA_FIXEDARG (ap, const char *, msgid);
|
||||||
column = va_arg (ap, int);
|
|
||||||
msgid = va_arg (ap, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pos.line = line;
|
pos.line = line;
|
||||||
pos.col = column;
|
pos.col = column;
|
||||||
if (_cpp_begin_message (pfile, WARNING, &pos))
|
if (_cpp_begin_message (pfile, WARNING, &pos))
|
||||||
v_message (msgid, ap);
|
v_message (msgid, ap);
|
||||||
va_end(ap);
|
|
||||||
|
VA_CLOSE (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
|
cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
|
||||||
{
|
{
|
||||||
#ifndef ANSI_PROTOTYPES
|
VA_OPEN (ap, msgid);
|
||||||
cpp_reader *pfile;
|
VA_FIXEDARG (ap, cpp_reader *, pfile);
|
||||||
const char *msgid;
|
VA_FIXEDARG (ap, const char *, msgid);
|
||||||
#endif
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
VA_START (ap, msgid);
|
|
||||||
|
|
||||||
#ifndef ANSI_PROTOTYPES
|
|
||||||
pfile = va_arg (ap, cpp_reader *);
|
|
||||||
msgid = va_arg (ap, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_cpp_begin_message (pfile, PEDWARN, 0))
|
if (_cpp_begin_message (pfile, PEDWARN, 0))
|
||||||
v_message (msgid, ap);
|
v_message (msgid, ap);
|
||||||
va_end(ap);
|
|
||||||
|
VA_CLOSE (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
|
cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
|
||||||
const char *msgid, ...))
|
const char *msgid, ...))
|
||||||
{
|
{
|
||||||
#ifndef ANSI_PROTOTYPES
|
|
||||||
cpp_reader *pfile;
|
|
||||||
int line;
|
|
||||||
int column;
|
|
||||||
const char *msgid;
|
|
||||||
#endif
|
|
||||||
va_list ap;
|
|
||||||
cpp_lexer_pos pos;
|
cpp_lexer_pos pos;
|
||||||
|
|
||||||
VA_START (ap, msgid);
|
VA_OPEN (ap, msgid);
|
||||||
|
VA_FIXEDARG (ap, cpp_reader *, pfile);
|
||||||
#ifndef ANSI_PROTOTYPES
|
VA_FIXEDARG (ap, int, line);
|
||||||
pfile = va_arg (ap, cpp_reader *);
|
VA_FIXEDARG (ap, int, column);
|
||||||
line = va_arg (ap, int);
|
VA_FIXEDARG (ap, const char *, msgid);
|
||||||
column = va_arg (ap, int);
|
|
||||||
msgid = va_arg (ap, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pos.line = line;
|
pos.line = line;
|
||||||
pos.col = column;
|
pos.col = column;
|
||||||
if (_cpp_begin_message (pfile, PEDWARN, &pos))
|
if (_cpp_begin_message (pfile, PEDWARN, &pos))
|
||||||
v_message (msgid, ap);
|
v_message (msgid, ap);
|
||||||
va_end(ap);
|
|
||||||
|
VA_CLOSE (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print an error message not associated with a file. */
|
/* Print an error message not associated with a file. */
|
||||||
void
|
void
|
||||||
cpp_notice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
|
cpp_notice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
|
||||||
{
|
{
|
||||||
#ifndef ANSI_PROTOTYPES
|
VA_OPEN (ap, msgid);
|
||||||
cpp_reader *pfile;
|
VA_FIXEDARG (ap, cpp_reader *, pfile);
|
||||||
const char *msgid;
|
VA_FIXEDARG (ap, const char *, msgid);
|
||||||
#endif
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
VA_START (ap, msgid);
|
|
||||||
|
|
||||||
#ifndef ANSI_PROTOTYPES
|
|
||||||
pfile = va_arg (ap, cpp_reader *);
|
|
||||||
msgid = va_arg (ap, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pfile->errors < CPP_FATAL_LIMIT)
|
if (pfile->errors < CPP_FATAL_LIMIT)
|
||||||
pfile->errors++;
|
pfile->errors++;
|
||||||
|
|
||||||
vfprintf (stderr, _(msgid), ap);
|
v_message (msgid, ap);
|
||||||
putc('\n', stderr);
|
|
||||||
|
|
||||||
va_end(ap);
|
VA_CLOSE (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-08-18 Zack Weinberg <zackw@panix.com>
|
||||||
|
|
||||||
|
* ansidecl.h: Reorganize for readability, remove documentation
|
||||||
|
of obsolete macros, document PARAMS and VPARAMS. Add new
|
||||||
|
macros VA_OPEN, VA_CLOSE, and VA_FIXEDARG for nicer variadic
|
||||||
|
function implementation.
|
||||||
|
|
||||||
2001-08-16 Richard Henderson <rth@redhat.com>
|
2001-08-16 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
* hashtab.h (htab_hash_string): Declare.
|
* hashtab.h (htab_hash_string): Declare.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* ANSI and traditional C compatability macros
|
/* ANSI and traditional C compatability macros
|
||||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000
|
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
@ -21,146 +21,101 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
|
|
||||||
ANSI C is assumed if __STDC__ is #defined.
|
ANSI C is assumed if __STDC__ is #defined.
|
||||||
|
|
||||||
Macro ANSI C definition Traditional C definition
|
Macro ANSI C definition Traditional C definition
|
||||||
----- ---- - ---------- ----------- - ----------
|
----- ---- - ---------- ----------- - ----------
|
||||||
PTR `void *' `char *'
|
ANSI_PROTOTYPES 1 not defined
|
||||||
LONG_DOUBLE `long double' `double'
|
PTR `void *' `char *'
|
||||||
VOLATILE `volatile' `'
|
PTRCONST `void *const' `char *'
|
||||||
SIGNED `signed' `'
|
LONG_DOUBLE `long double' `double'
|
||||||
PTRCONST `void *const' `char *'
|
const not defined `'
|
||||||
ANSI_PROTOTYPES 1 not defined
|
volatile not defined `'
|
||||||
|
signed not defined `'
|
||||||
|
VA_START(ap, var) va_start(ap, var) va_start(ap)
|
||||||
|
|
||||||
CONST is also defined, but is obsolete. Just use const.
|
Note that it is safe to write "void foo();" indicating a function
|
||||||
|
with no return value, in all K+R compilers we have been able to test.
|
||||||
|
|
||||||
obsolete -- DEFUN (name, arglist, args)
|
For declaring functions with prototypes, we also provide these:
|
||||||
|
|
||||||
Defines function NAME.
|
PARAMS ((prototype))
|
||||||
|
-- for functions which take a fixed number of arguments. Use this
|
||||||
|
when declaring the function. When defining the function, write a
|
||||||
|
K+R style argument list. For example:
|
||||||
|
|
||||||
ARGLIST lists the arguments, separated by commas and enclosed in
|
char *strcpy PARAMS ((char *dest, char *source));
|
||||||
parentheses. ARGLIST becomes the argument list in traditional C.
|
...
|
||||||
|
char *
|
||||||
|
strcpy (dest, source)
|
||||||
|
char *dest;
|
||||||
|
char *source;
|
||||||
|
{ ... }
|
||||||
|
|
||||||
ARGS list the arguments with their types. It becomes a prototype in
|
|
||||||
ANSI C, and the type declarations in traditional C. Arguments should
|
|
||||||
be separated with `AND'. For functions with a variable number of
|
|
||||||
arguments, the last thing listed should be `DOTS'.
|
|
||||||
|
|
||||||
obsolete -- DEFUN_VOID (name)
|
VPARAMS ((prototype, ...))
|
||||||
|
-- for functions which take a variable number of arguments. Use
|
||||||
|
PARAMS to declare the function, VPARAMS to define it. For example:
|
||||||
|
|
||||||
Defines a function NAME, which takes no arguments.
|
int printf PARAMS ((const char *format, ...));
|
||||||
|
...
|
||||||
|
int
|
||||||
|
printf VPARAMS ((const char *format, ...))
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
obsolete -- EXFUN (name, (prototype)) -- obsolete.
|
For writing functions which take variable numbers of arguments, we
|
||||||
|
also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros. These
|
||||||
|
hide the differences between K+R <varargs.h> and C89 <stdarg.h> more
|
||||||
|
thoroughly than the simple VA_START() macro mentioned above.
|
||||||
|
|
||||||
Replaced by PARAMS. Do not use; will disappear someday soon.
|
VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end.
|
||||||
Was used in external function declarations.
|
Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls
|
||||||
In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in
|
corresponding to the list of fixed arguments. Then use va_arg
|
||||||
parentheses). In traditional C it is `NAME()'.
|
normally to get the variable arguments, or pass your va_list object
|
||||||
For a function that takes no arguments, PROTOTYPE should be `(void)'.
|
around. You do not declare the va_list yourself; VA_OPEN does it
|
||||||
|
for you.
|
||||||
|
|
||||||
obsolete -- PROTO (type, name, (prototype) -- obsolete.
|
Here is a complete example:
|
||||||
|
|
||||||
This one has also been replaced by PARAMS. Do not use.
|
int
|
||||||
|
printf VPARAMS ((const char *format, ...))
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
PARAMS ((args))
|
VA_OPEN (ap, format);
|
||||||
|
VA_FIXEDARG (ap, const char *, format);
|
||||||
|
|
||||||
We could use the EXFUN macro to handle prototype declarations, but
|
result = vfprintf (stdout, format, ap);
|
||||||
the name is misleading and the result is ugly. So we just define a
|
VA_CLOSE (ap);
|
||||||
simple macro to handle the parameter lists, as in:
|
|
||||||
|
|
||||||
static int foo PARAMS ((int, char));
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
This produces: `static int foo();' or `static int foo (int, char);'
|
|
||||||
|
|
||||||
EXFUN would have done it like this:
|
You can declare variables either before or after the VA_OPEN,
|
||||||
|
VA_FIXEDARG sequence. You can _not_ put statements before VA_OPEN.
|
||||||
|
Also, VA_OPEN and VA_CLOSE are the beginning and end of a block.
|
||||||
|
They must appear at the same nesting level, and any variables
|
||||||
|
declared after VA_OPEN go out of scope at VA_CLOSE. Unfortunately,
|
||||||
|
with a K+R compiler, that includes the argument list.
|
||||||
|
|
||||||
static int EXFUN (foo, (int, char));
|
For ease of writing code which uses GCC extensions but needs to be
|
||||||
|
portable to other compilers, we provide the GCC_VERSION macro that
|
||||||
|
simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
|
||||||
|
wrappers around __attribute__. Also, __extension__ will be #defined
|
||||||
|
to nothing if it doesn't work. See below.
|
||||||
|
|
||||||
but the function is not external...and it's hard to visually parse
|
This header also defines a lot of obsolete macros:
|
||||||
the function name out of the mess. EXFUN should be considered
|
CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID,
|
||||||
obsolete; new code should be written to use PARAMS.
|
AND, DOTS, NOARGS. Don't use them. */
|
||||||
|
|
||||||
DOTS is also obsolete.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
extern int printf PARAMS ((const char *format, ...));
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _ANSIDECL_H
|
#ifndef _ANSIDECL_H
|
||||||
|
#define _ANSIDECL_H 1
|
||||||
#define _ANSIDECL_H 1
|
|
||||||
|
|
||||||
|
|
||||||
/* Every source file includes this file,
|
/* Every source file includes this file,
|
||||||
so they will all get the switch for lint. */
|
so they will all get the switch for lint. */
|
||||||
/* LINTLIBRARY */
|
/* LINTLIBRARY */
|
||||||
|
|
||||||
|
|
||||||
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
|
|
||||||
/* All known AIX compilers implement these things (but don't always
|
|
||||||
define __STDC__). The RISC/OS MIPS compiler defines these things
|
|
||||||
in SVR4 mode, but does not define __STDC__. */
|
|
||||||
|
|
||||||
#define PTR void *
|
|
||||||
#define PTRCONST void *CONST
|
|
||||||
#define LONG_DOUBLE long double
|
|
||||||
|
|
||||||
#ifndef IN_GCC
|
|
||||||
#define AND ,
|
|
||||||
#define NOARGS void
|
|
||||||
#define VOLATILE volatile
|
|
||||||
#define SIGNED signed
|
|
||||||
#endif /* ! IN_GCC */
|
|
||||||
|
|
||||||
#define PARAMS(paramlist) paramlist
|
|
||||||
#define ANSI_PROTOTYPES 1
|
|
||||||
|
|
||||||
#define VPARAMS(ARGS) ARGS
|
|
||||||
#define VA_START(va_list,var) va_start(va_list,var)
|
|
||||||
|
|
||||||
/* These are obsolete. Do not use. */
|
|
||||||
#ifndef IN_GCC
|
|
||||||
#define CONST const
|
|
||||||
#define DOTS , ...
|
|
||||||
#define PROTO(type, name, arglist) type name arglist
|
|
||||||
#define EXFUN(name, proto) name proto
|
|
||||||
#define DEFUN(name, arglist, args) name(args)
|
|
||||||
#define DEFUN_VOID(name) name(void)
|
|
||||||
#endif /* ! IN_GCC */
|
|
||||||
|
|
||||||
#else /* Not ANSI C. */
|
|
||||||
|
|
||||||
#define PTR char *
|
|
||||||
#define PTRCONST PTR
|
|
||||||
#define LONG_DOUBLE double
|
|
||||||
|
|
||||||
#ifndef IN_GCC
|
|
||||||
#define AND ;
|
|
||||||
#define NOARGS
|
|
||||||
#define VOLATILE
|
|
||||||
#define SIGNED
|
|
||||||
#endif /* !IN_GCC */
|
|
||||||
|
|
||||||
#ifndef const /* some systems define it in header files for non-ansi mode */
|
|
||||||
#define const
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PARAMS(paramlist) ()
|
|
||||||
|
|
||||||
#define VPARAMS(ARGS) (va_alist) va_dcl
|
|
||||||
#define VA_START(va_list,var) va_start(va_list)
|
|
||||||
|
|
||||||
/* These are obsolete. Do not use. */
|
|
||||||
#ifndef IN_GCC
|
|
||||||
#define CONST
|
|
||||||
#define DOTS
|
|
||||||
#define PROTO(type, name, arglist) type name ()
|
|
||||||
#define EXFUN(name, proto) name()
|
|
||||||
#define DEFUN(name, arglist, args) name arglist args;
|
|
||||||
#define DEFUN_VOID(name) name()
|
|
||||||
#endif /* ! IN_GCC */
|
|
||||||
|
|
||||||
#endif /* ANSI C. */
|
|
||||||
|
|
||||||
/* Using MACRO(x,y) in cpp #if conditionals does not work with some
|
/* Using MACRO(x,y) in cpp #if conditionals does not work with some
|
||||||
older preprocessors. Thus we can't define something like this:
|
older preprocessors. Thus we can't define something like this:
|
||||||
|
|
||||||
@ -179,6 +134,101 @@ So instead we use the macro below and test it against specific values. */
|
|||||||
#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
|
#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
|
||||||
#endif /* GCC_VERSION */
|
#endif /* GCC_VERSION */
|
||||||
|
|
||||||
|
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
|
||||||
|
/* All known AIX compilers implement these things (but don't always
|
||||||
|
define __STDC__). The RISC/OS MIPS compiler defines these things
|
||||||
|
in SVR4 mode, but does not define __STDC__. */
|
||||||
|
|
||||||
|
#define ANSI_PROTOTYPES 1
|
||||||
|
#define PTR void *
|
||||||
|
#define PTRCONST void *const
|
||||||
|
#define LONG_DOUBLE long double
|
||||||
|
|
||||||
|
#define PARAMS(ARGS) ARGS
|
||||||
|
#define VPARAMS(ARGS) ARGS
|
||||||
|
#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR)
|
||||||
|
|
||||||
|
/* variadic function helper macros */
|
||||||
|
/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's
|
||||||
|
use without inhibiting further decls and without declaring an
|
||||||
|
actual variable. */
|
||||||
|
#define VA_OPEN(AP, VAR) va_list AP; va_start(AP, VAR); { struct Qdmy
|
||||||
|
#define VA_CLOSE(AP) } va_end(AP)
|
||||||
|
#define VA_FIXEDARG(AP, T, N) struct Qdmy
|
||||||
|
|
||||||
|
#undef const
|
||||||
|
#undef volatile
|
||||||
|
#undef signed
|
||||||
|
|
||||||
|
/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
|
||||||
|
it too, but it's not in C89. */
|
||||||
|
#undef inline
|
||||||
|
#if __STDC_VERSION__ > 199901L
|
||||||
|
/* it's a keyword */
|
||||||
|
#else
|
||||||
|
# if GCC_VERSION >= 2007
|
||||||
|
# define inline __inline__ /* __inline__ prevents -pedantic warnings */
|
||||||
|
# else
|
||||||
|
# define inline /* nothing */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These are obsolete. Do not use. */
|
||||||
|
#ifndef IN_GCC
|
||||||
|
#define CONST const
|
||||||
|
#define VOLATILE volatile
|
||||||
|
#define SIGNED signed
|
||||||
|
|
||||||
|
#define PROTO(type, name, arglist) type name arglist
|
||||||
|
#define EXFUN(name, proto) name proto
|
||||||
|
#define DEFUN(name, arglist, args) name(args)
|
||||||
|
#define DEFUN_VOID(name) name(void)
|
||||||
|
#define AND ,
|
||||||
|
#define DOTS , ...
|
||||||
|
#define NOARGS void
|
||||||
|
#endif /* ! IN_GCC */
|
||||||
|
|
||||||
|
#else /* Not ANSI C. */
|
||||||
|
|
||||||
|
#undef ANSI_PROTOTYPES
|
||||||
|
#define PTR char *
|
||||||
|
#define PTRCONST PTR
|
||||||
|
#define LONG_DOUBLE double
|
||||||
|
|
||||||
|
#define PARAMS(args) ()
|
||||||
|
#define VPARAMS(args) (va_alist) va_dcl
|
||||||
|
#define VA_START(va_list, var) va_start(va_list)
|
||||||
|
|
||||||
|
#define VA_OPEN(AP, VAR) va_list AP; va_start(AP); { struct Qdmy
|
||||||
|
#define VA_CLOSE(AP) } va_end(AP)
|
||||||
|
#define VA_FIXEDARG(AP, TYPE, NAME) TYPE NAME = va_arg(AP, TYPE)
|
||||||
|
|
||||||
|
/* some systems define these in header files for non-ansi mode */
|
||||||
|
#undef const
|
||||||
|
#undef volatile
|
||||||
|
#undef signed
|
||||||
|
#undef inline
|
||||||
|
#define const
|
||||||
|
#define volatile
|
||||||
|
#define signed
|
||||||
|
#define inline
|
||||||
|
|
||||||
|
#ifndef IN_GCC
|
||||||
|
#define CONST
|
||||||
|
#define VOLATILE
|
||||||
|
#define SIGNED
|
||||||
|
|
||||||
|
#define PROTO(type, name, arglist) type name ()
|
||||||
|
#define EXFUN(name, proto) name()
|
||||||
|
#define DEFUN(name, arglist, args) name arglist args;
|
||||||
|
#define DEFUN_VOID(name) name()
|
||||||
|
#define AND ;
|
||||||
|
#define DOTS
|
||||||
|
#define NOARGS
|
||||||
|
#endif /* ! IN_GCC */
|
||||||
|
|
||||||
|
#endif /* ANSI C. */
|
||||||
|
|
||||||
/* Define macros for some gcc attributes. This permits us to use the
|
/* Define macros for some gcc attributes. This permits us to use the
|
||||||
macros freely, and know that they will come into play for the
|
macros freely, and know that they will come into play for the
|
||||||
version of gcc in which they are supported. */
|
version of gcc in which they are supported. */
|
||||||
@ -229,20 +279,12 @@ So instead we use the macro below and test it against specific values. */
|
|||||||
#define __extension__
|
#define __extension__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Bootstrap support: Autoconf will possibly define the `inline' or
|
/* Bootstrap support: Adjust certain macros defined by Autoconf,
|
||||||
`const' keywords as macros, however this is only valid for the
|
which are only valid for the stage1 compiler. If we detect
|
||||||
stage1 compiler. If we detect a modern version of gcc,
|
a modern version of GCC, we are probably in stage2 or beyond,
|
||||||
unconditionally reset the values. This makes sure the right thing
|
so unconditionally reset the values. Note that const, inline,
|
||||||
happens in stage2 and later. We need to do this very early;
|
etc. have been dealt with above. */
|
||||||
i.e. before any header files that might use these keywords.
|
|
||||||
Otherwise conflicts might occur. */
|
|
||||||
|
|
||||||
#if (GCC_VERSION >= 2007)
|
#if (GCC_VERSION >= 2007)
|
||||||
# ifdef __STDC__
|
|
||||||
# undef const
|
|
||||||
# endif
|
|
||||||
# undef inline
|
|
||||||
# define inline __inline__ /* __inline__ prevents -pedantic warnings */
|
|
||||||
# ifndef HAVE_LONG_DOUBLE
|
# ifndef HAVE_LONG_DOUBLE
|
||||||
# define HAVE_LONG_DOUBLE 1
|
# define HAVE_LONG_DOUBLE 1
|
||||||
# endif
|
# endif
|
||||||
|
Loading…
Reference in New Issue
Block a user