mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
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:
@@ -27,6 +27,7 @@ extern void opt_Parse(char *s);
|
||||
|
||||
noreturn void fatalerror(const char *fmt, ...);
|
||||
void yyerror(const char *fmt, ...);
|
||||
void warning(const char *fmt, ...);
|
||||
|
||||
#define YY_FATAL_ERROR fatalerror
|
||||
|
||||
|
||||
@@ -1282,7 +1282,7 @@ z80_jp : T_Z80_JP const_16bit
|
||||
{
|
||||
out_AbsByte(0xE9);
|
||||
if( nPass==1 )
|
||||
printf("warning:'JP [HL]' is obsolete, use 'JP HL' instead.\n");
|
||||
warning("'JP [HL]' is obsolete, use 'JP HL' instead.\n");
|
||||
}
|
||||
| T_Z80_JP T_MODE_HL
|
||||
{ out_AbsByte(0xE9); }
|
||||
@@ -1300,7 +1300,7 @@ z80_ldi : T_Z80_LDI T_MODE_HL_IND comma T_MODE_A
|
||||
{
|
||||
out_AbsByte(0x0A|(2<<4));
|
||||
if( nPass==1 )
|
||||
printf("warning:'LDI A,HL' is obsolete, use 'LDI A,[HL]' or 'LD A,[HL+] instead.\n");
|
||||
warning("'LDI A,HL' is obsolete, use 'LDI A,[HL]' or 'LD A,[HL+] instead.\n");
|
||||
}
|
||||
| T_Z80_LDI T_MODE_A comma T_MODE_HL_IND
|
||||
{ out_AbsByte(0x0A|(2<<4)); }
|
||||
@@ -1312,7 +1312,7 @@ z80_ldd : T_Z80_LDD T_MODE_HL_IND comma T_MODE_A
|
||||
{
|
||||
out_AbsByte(0x0A|(3<<4));
|
||||
if( nPass==1 )
|
||||
printf("warning:'LDD A,HL' is obsolete, use 'LDD A,[HL]' or 'LD A,[HL-] instead.\n");
|
||||
warning("'LDD A,HL' is obsolete, use 'LDD A,[HL]' or 'LD A,[HL-] instead.\n");
|
||||
}
|
||||
| T_Z80_LDD T_MODE_A comma T_MODE_HL_IND
|
||||
{ out_AbsByte(0x0A|(3<<4)); }
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user