Commit b649398a by Zack Weinberg Committed by Zack Weinberg

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
parent 76f4925a
2001-08-18 Zack Weinberg <zackw@panix.com> 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>
* haifa-sched.c: Convert to target hooks. Macros replaced * haifa-sched.c: Convert to target hooks. Macros replaced
are ISSUE_RATE, ADJUST_COST, ADJUST_PRIORITY, MD_SCHED_INIT, are ISSUE_RATE, ADJUST_COST, ADJUST_PRIORITY, MD_SCHED_INIT,
MD_SCHED_REORDER, MD_SCHED_REORDER2, MD_SCHED_VARIABLE_ISSUE, MD_SCHED_REORDER, MD_SCHED_REORDER2, MD_SCHED_VARIABLE_ISSUE,
......
...@@ -142,22 +142,14 @@ _cpp_begin_message (pfile, code, pos) ...@@ -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, ...)) ...@@ -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) ...@@ -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
......
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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment