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 haltnop;
bool exportall;
bool warnings; /* true to enable warnings, false to disable them. */
//-1 == random
};

View File

@@ -256,6 +256,9 @@ fatalerror(const char *fmt, ...)
void
warning(const char *fmt, ...)
{
if (!CurrentOptions.warnings)
return;
va_list args;
va_start(args, fmt);
@@ -312,12 +315,13 @@ main(int argc, char *argv[])
DefaultOptions.verbose = false;
DefaultOptions.haltnop = true;
DefaultOptions.exportall = false;
DefaultOptions.warnings = true;
opt_SetCurrentOptions(&DefaultOptions);
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) {
case 'b':
if (strlen(optarg) == 2) {
@@ -367,6 +371,9 @@ main(int argc, char *argv[])
case 'E':
newopt.exportall = true;
break;
case 'w':
newopt.warnings = false;
break;
default:
usage();
}

View File

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