Add flag -w to rgbasm to disable warnings

A lot of warnings are being added (and more will come) so it makes sense
to be able to disable them in legacy source that generates warnings but
is otherwise correct.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
This commit is contained in:
AntonioND
2017-04-05 23:01:50 +01:00
committed by Antonio Niño Díaz
parent 2783a36b17
commit 52081f32f0
3 changed files with 12 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ struct sOptions {
bool verbose; bool verbose;
bool haltnop; bool haltnop;
bool exportall; bool exportall;
bool warnings; /* true to enable warnings, false to disable them. */
//-1 == random //-1 == random
}; };

View File

@@ -256,6 +256,9 @@ fatalerror(const char *fmt, ...)
void void
warning(const char *fmt, ...) warning(const char *fmt, ...)
{ {
if (!CurrentOptions.warnings)
return;
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
@@ -312,12 +315,13 @@ main(int argc, char *argv[])
DefaultOptions.verbose = false; DefaultOptions.verbose = false;
DefaultOptions.haltnop = true; DefaultOptions.haltnop = true;
DefaultOptions.exportall = false; DefaultOptions.exportall = false;
DefaultOptions.warnings = true;
opt_SetCurrentOptions(&DefaultOptions); opt_SetCurrentOptions(&DefaultOptions);
newopt = CurrentOptions; newopt = CurrentOptions;
while ((ch = getopt(argc, argv, "b:D:g:hi:o:p:vE")) != -1) { while ((ch = getopt(argc, argv, "b:D:g:hi:o:p:vEw")) != -1) {
switch (ch) { switch (ch) {
case 'b': case 'b':
if (strlen(optarg) == 2) { if (strlen(optarg) == 2) {
@@ -367,6 +371,9 @@ main(int argc, char *argv[])
case 'E': case 'E':
newopt.exportall = true; newopt.exportall = true;
break; break;
case 'w':
newopt.warnings = false;
break;
default: default:
usage(); usage();
} }

View File

@@ -20,7 +20,7 @@
.Nd Game Boy assembler .Nd Game Boy assembler
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm rgbasm .Nm rgbasm
.Op Fl Ehv .Op Fl Ehvw
.Op Fl b Ar chars .Op Fl b Ar chars
.Op Fl D Ar name Ns Op = Ns Ar value .Op Fl D Ar name Ns Op = Ns Ar value
.Op Fl g Ar chars .Op Fl g Ar chars
@@ -68,6 +68,8 @@ When padding an image, pad with this value.
The default is 0x00. The default is 0x00.
.It Fl v .It Fl v
Be verbose. Be verbose.
.It Fl w
Disable warning output.
.El .El
.Sh EXAMPLES .Sh EXAMPLES
Assembling a basic source file is simple: Assembling a basic source file is simple: