shithub: rgbds

Download patch

ref: 52081f32f06256bbc5fb3e75f5f6694e2a51e707
parent: 2783a36b17a2eaf8df5825df25223cfa6419d726
author: AntonioND <[email protected]>
date: Wed Apr 5 19:01:50 EDT 2017

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 <[email protected]>

--- a/include/asm/main.h
+++ b/include/asm/main.h
@@ -11,6 +11,7 @@
 	bool verbose;
 	bool haltnop;
 	bool exportall;
+	bool warnings; /* true to enable warnings, false to disable them. */
 	    //-1 == random
 };
 
--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -256,6 +256,9 @@
 void
 warning(const char *fmt, ...)
 {
+	if (!CurrentOptions.warnings)
+		return;
+
 	va_list args;
 	va_start(args, fmt);
 
@@ -312,12 +315,13 @@
 	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) {
@@ -366,6 +370,9 @@
 			break;
 		case 'E':
 			newopt.exportall = true;
+			break;
+		case 'w':
+			newopt.warnings = false;
 			break;
 		default:
 			usage();
--- 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 @@
 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: