summaryrefslogtreecommitdiff
path: root/gcc/cpperror.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-18 20:46:45 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-18 20:46:45 +0000
commit8b562dacc1fbc48e43756efcf9de9d083d6f356c (patch)
tree5f075c3b2cc6977486b8c21118218978fae417e0 /gcc/cpperror.c
parent8f7e7378094369379b2824b59316260c7d93d5fe (diff)
downloadgcc-8b562dacc1fbc48e43756efcf9de9d083d6f356c.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45011 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpperror.c')
-rw-r--r--gcc/cpperror.c181
1 files changed, 52 insertions, 129 deletions
diff --git a/gcc/cpperror.c b/gcc/cpperror.c
index 84d1c837e23..6b137abcd75 100644
--- a/gcc/cpperror.c
+++ b/gcc/cpperror.c
@@ -142,22 +142,14 @@ _cpp_begin_message (pfile, code, pos)
void
cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- 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
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
if (_cpp_begin_message (pfile, ICE, 0))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
/* 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
cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- 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
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
if (_cpp_begin_message (pfile, FATAL, 0))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
void
cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- 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
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
if (_cpp_begin_message (pfile, ERROR, 0))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
void
cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column,
const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- int line;
- int column;
- const char *msgid;
-#endif
- va_list ap;
cpp_lexer_pos pos;
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- line = va_arg (ap, int);
- column = va_arg (ap, int);
- msgid = va_arg (ap, const char *);
-#endif
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, int, line);
+ VA_FIXEDARG (ap, int, column);
+ VA_FIXEDARG (ap, const char *, msgid);
pos.line = line;
pos.col = column;
if (_cpp_begin_message (pfile, ERROR, &pos))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
/* Error including a message from `errno'. */
@@ -249,127 +216,83 @@ cpp_error_from_errno (pfile, name)
void
cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- 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
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
if (_cpp_begin_message (pfile, WARNING, 0))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
void
cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- int line;
- int column;
- const char *msgid;
-#endif
- va_list ap;
cpp_lexer_pos pos;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- line = va_arg (ap, int);
- column = va_arg (ap, int);
- msgid = va_arg (ap, const char *);
-#endif
+
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, int, line);
+ VA_FIXEDARG (ap, int, column);
+ VA_FIXEDARG (ap, const char *, msgid);
pos.line = line;
pos.col = column;
if (_cpp_begin_message (pfile, WARNING, &pos))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
void
cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- 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
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
if (_cpp_begin_message (pfile, PEDWARN, 0))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
void
cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- int line;
- int column;
- const char *msgid;
-#endif
- va_list ap;
cpp_lexer_pos pos;
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- line = va_arg (ap, int);
- column = va_arg (ap, int);
- msgid = va_arg (ap, const char *);
-#endif
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, int, line);
+ VA_FIXEDARG (ap, int, column);
+ VA_FIXEDARG (ap, const char *, msgid);
pos.line = line;
pos.col = column;
if (_cpp_begin_message (pfile, PEDWARN, &pos))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
/* Print an error message not associated with a file. */
void
cpp_notice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- 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
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
if (pfile->errors < CPP_FATAL_LIMIT)
pfile->errors++;
- vfprintf (stderr, _(msgid), ap);
- putc('\n', stderr);
+ v_message (msgid, ap);
- va_end(ap);
+ VA_CLOSE (ap);
}
void