ca4bd38206
Edit build.lua for programs losing their private assert.h, so they depend on a list of .h files excluding assert.h. Remove modules/src/assert; it would be a dependency of cpp.ansi but we didn't build it, so cpp.ansi uses the libc assert. I hope that libc <assert.h> can better report failed assertions. Some old "assert.h" files didn't report the expression. Some reported a literal "x", because traditional C expanded the macro parameter x in "x", but ANSI C89 doesn't expand macro parameters in string literals.
67 lines
956 B
C
67 lines
956 B
C
/*
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
*/
|
|
#ifndef NORCSID
|
|
static char rcsid[]= "$Id$";
|
|
#endif
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <stdarg.h>
|
|
#include "extern.h"
|
|
|
|
int nerrors=0;
|
|
|
|
yyerror(s) char *s; {
|
|
|
|
error("Parser gives %s",s);
|
|
}
|
|
|
|
goodbye() {
|
|
|
|
error("This was fatal, goodbye!");
|
|
#ifndef NDEBUG
|
|
abort();
|
|
#endif
|
|
}
|
|
|
|
void errorv(const char* s, va_list ap)
|
|
{
|
|
extern int lineno;
|
|
extern char *filename;
|
|
|
|
fprintf(stderr, "\"%s\", line %d:", filename, lineno);
|
|
vfprintf(stderr, s, ap);
|
|
fprintf(stderr, "\n");
|
|
nerrors++;
|
|
}
|
|
|
|
void fatal(const char* s, ...)
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, s);
|
|
errorv(s, ap);
|
|
va_end(ap);
|
|
|
|
errorexit();
|
|
goodbye();
|
|
exit(-1);
|
|
}
|
|
|
|
void error(const char* s, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
va_start(ap, s);
|
|
errorv(s, ap);
|
|
va_end(ap);
|
|
}
|
|
|
|
tabovf(string) char *string; {
|
|
|
|
fatal("%s overflow",string);
|
|
}
|