From 52081f32f06256bbc5fb3e75f5f6694e2a51e707 Mon Sep 17 00:00:00 2001 From: AntonioND Date: Wed, 5 Apr 2017 23:01:50 +0100 Subject: [PATCH] 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 --- include/asm/main.h | 1 + src/asm/main.c | 9 ++++++++- src/asm/rgbasm.1 | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/asm/main.h b/include/asm/main.h index 4ec5712d..8ea718a4 100644 --- a/include/asm/main.h +++ b/include/asm/main.h @@ -11,6 +11,7 @@ struct sOptions { bool verbose; bool haltnop; bool exportall; + bool warnings; /* true to enable warnings, false to disable them. */ //-1 == random }; diff --git a/src/asm/main.c b/src/asm/main.c index 71049ba0..8423c029 100644 --- a/src/asm/main.c +++ b/src/asm/main.c @@ -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(); } diff --git a/src/asm/rgbasm.1 b/src/asm/rgbasm.1 index e81fb7a7..36006052 100644 --- a/src/asm/rgbasm.1 +++ b/src/asm/rgbasm.1 @@ -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: