Switch error() and fatal() in mach/proto/ncg to stdarg.

This is like David Given's change to util/ncgg in d89f172.  I need
this change in mach/proto/ncg to see fatal messages, because a 64-bit
pointer doesn't fit in an int.
This commit is contained in:
George Koehler 2017-02-16 20:26:53 -05:00
parent a20b87ca01
commit aa47f52166
2 changed files with 13 additions and 8 deletions

View file

@ -54,4 +54,6 @@ extern int *rvnumbers[]; /* lists of numbers */
#endif
extern FILE *codefile;
extern FILE *freopen();
extern void error(const char *s, ...);
extern void fatal(const char *s, ...);

View file

@ -2,8 +2,9 @@
static char rcsid[] = "$Id$";
#endif
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "assert.h"
#include "param.h"
#include "tables.h"
@ -657,11 +658,12 @@ itokcost() {
tdp->t_cost.ct_space = costcalc(tdp->t_cost);
}
/*VARARGS1*/
error(s,a1,a2,a3,a4,a5,a6,a7,a8) char *s; {
void error(const char *s, ...) {
va_list ap;
va_start(ap,s);
fprintf(stderr,"Error: ");
fprintf(stderr,s,a1,a2,a3,a4,a5,a6,a7,a8);
vfprintf(stderr,s,ap);
fprintf(stderr,"\n");
#ifdef TABLEDEBUG
ruletrace();
@ -670,11 +672,12 @@ error(s,a1,a2,a3,a4,a5,a6,a7,a8) char *s; {
exit(-1);
}
/*VARARGS1*/
fatal(s,a1,a2,a3,a4,a5,a6,a7,a8) char *s; {
void fatal(const char *s, ...) {
va_list ap;
va_start(ap,s);
fprintf(stderr,"Fatal: ");
fprintf(stderr,s,a1,a2,a3,a4,a5,a6,a7,a8);
vfprintf(stderr,s,ap);
fprintf(stderr,"\n");
#ifdef TABLEDEBUG
ruletrace();