mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Improve error messages.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <getopt.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -205,18 +206,26 @@ opt_Pop(void)
|
||||
*/
|
||||
|
||||
void
|
||||
yyerror(char *s)
|
||||
yyerror(const char *fmt, ...)
|
||||
{
|
||||
printf("*ERROR*\t");
|
||||
fprintf(stderr, "ERROR:\t");
|
||||
fstk_Dump();
|
||||
printf(" :\n\t%s\n", s);
|
||||
fprintf(stderr, " :\n\t");
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
fprintf(stderr, "\n");
|
||||
nErrors += 1;
|
||||
}
|
||||
|
||||
void
|
||||
fatalerror(char *s)
|
||||
fatalerror(const char *fmt, ...)
|
||||
{
|
||||
yyerror(s);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
yyerror(fmt, args);
|
||||
va_end(args);
|
||||
exit(5);
|
||||
}
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user