Add a warning() function, similiar to yyerror()

This function produces a similar output to the other error handlers, including printing to stderr, and including a stack trace. However, ‘warning’ is displayed instead of ‘ERROR’, and the compilation does not fail.

This function is now used for the deprecation warnings, ensuring that these errors can be found.
This commit is contained in:
Ben10do
2017-04-02 13:18:29 +01:00
parent 53842cd07d
commit ff2ba7290c
3 changed files with 21 additions and 5 deletions

View File

@@ -226,9 +226,9 @@ opt_ParseDefines()
void
verror(const char *fmt, va_list args)
{
fprintf(stderr, "ERROR:\t");
fprintf(stderr, "ERROR: ");
fstk_Dump();
fprintf(stderr, " :\n\t");
fprintf(stderr, ":\n\t");
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
nErrors += 1;
@@ -253,6 +253,21 @@ fatalerror(const char *fmt, ...)
exit(5);
}
void
warning(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
fprintf(stderr, "warning: ");
fstk_Dump();
fprintf(stderr, ":\n\t");
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
va_end(args);
}
static void
usage(void)
{