ack/util/ncgg/error.c
George Koehler ca4bd38206 Delete old "assert.h" files; use libc <assert.h>.
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.
2017-11-09 22:22:13 -05:00

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);
}