64-bit-ify (adhoc varargs are evil).
This commit is contained in:
parent
3d5e72e20b
commit
c5018d7088
3 changed files with 43 additions and 25 deletions
|
@ -265,3 +265,4 @@ typedef struct sect_t sect_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern FILE *fopen(); /* some systems don't have this in stdio.h */
|
extern FILE *fopen(); /* some systems don't have this in stdio.h */
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,10 @@ extern valu_t load();
|
||||||
extern FILE *ffcreat();
|
extern FILE *ffcreat();
|
||||||
extern FILE *fftemp();
|
extern FILE *fftemp();
|
||||||
|
|
||||||
|
extern void fatal(const char* s, ...);
|
||||||
|
extern void serror(const char* s, ...);
|
||||||
|
extern void warning(const char* s, ...);
|
||||||
|
|
||||||
/* ========== Machine dependent C declarations ========== */
|
/* ========== Machine dependent C declarations ========== */
|
||||||
|
|
||||||
#include "mach1.c"
|
#include "mach1.c"
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "comm0.h"
|
#include "comm0.h"
|
||||||
#include "comm1.h"
|
#include "comm1.h"
|
||||||
#include "y.tab.h"
|
#include "y.tab.h"
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
valu_t
|
valu_t
|
||||||
load(ip)
|
load(ip)
|
||||||
|
@ -27,7 +28,7 @@ register item_t *ip;
|
||||||
if ((ip->i_type & S_TYP) == S_UND || (ip->i_type & S_COM)) {
|
if ((ip->i_type & S_TYP) == S_UND || (ip->i_type & S_COM)) {
|
||||||
if (pass == PASS_3) {
|
if (pass == PASS_3) {
|
||||||
if (relonami != 0)
|
if (relonami != 0)
|
||||||
serror("relocation error");
|
serror("relocation error (relonami=%d, type=%08x)", relonami, ip->i_type);
|
||||||
relonami = ip->i_valu+1;
|
relonami = ip->i_valu+1;
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -380,13 +381,28 @@ wr_fatal()
|
||||||
fatal("write error");
|
fatal("write error");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VARARGS1 */
|
void diag(const char* tail, const char* s, va_list ap)
|
||||||
fatal(s, a1, a2, a3, a4)
|
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
|
fflush(stdout);
|
||||||
|
if (modulename)
|
||||||
|
fprintf(stderr, "\"%s\", line %ld: ", modulename, lineno);
|
||||||
|
else
|
||||||
|
fprintf(stderr, "%s: ", progname);
|
||||||
|
vfprintf(stderr, s, ap);
|
||||||
|
fprintf(stderr, "%s", tail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* VARARGS1 */
|
||||||
|
void fatal(const char* s, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, s);
|
||||||
|
|
||||||
nerrors++;
|
nerrors++;
|
||||||
diag(" (fatal)\n", s, a1, a2, a3, a4);
|
diag(" (fatal)\n", s, ap);
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG == 2
|
#if DEBUG == 2
|
||||||
|
@ -400,37 +416,34 @@ char *file;
|
||||||
#if DEBUG == 1
|
#if DEBUG == 1
|
||||||
assert1()
|
assert1()
|
||||||
{
|
{
|
||||||
diag(" (fatal)\n", "assertion failed");
|
fatal("assertion failed");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* VARARGS1 */
|
void serror(const char* s, ...)
|
||||||
serror(s, a1, a2, a3, a4)
|
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, s);
|
||||||
|
|
||||||
nerrors++;
|
nerrors++;
|
||||||
diag("\n", s, a1, a2, a3, a4);
|
diag("\n", s, ap);
|
||||||
|
stop();
|
||||||
|
|
||||||
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VARARGS1 */
|
/* VARARGS1 */
|
||||||
warning(s, a1, a2, a3, a4)
|
void warning(const char* s, ...)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
diag(" (warning)\n", s, a1, a2, a3, a4);
|
va_list ap;
|
||||||
}
|
va_start(ap, s);
|
||||||
|
|
||||||
/* VARARGS1 */
|
nerrors++;
|
||||||
diag(tail, s, a1, a2, a3, a4)
|
diag(" (warning)\n", s, ap);
|
||||||
char *tail, *s;
|
stop();
|
||||||
{
|
|
||||||
fflush(stdout);
|
va_end(ap);
|
||||||
if (modulename)
|
|
||||||
fprintf(stderr, "\"%s\", line %ld: ", modulename, lineno);
|
|
||||||
else
|
|
||||||
fprintf(stderr, "%s: ", progname);
|
|
||||||
fprintf(stderr, s, a1, a2, a3, a4);
|
|
||||||
fprintf(stderr, tail);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nofit()
|
nofit()
|
||||||
|
|
Loading…
Reference in a new issue