shithub: rgbds

Download patch

ref: 9829be104549bcdef63984676bf9c432bbb777fa
parent: b28a16c0da3917260f1d2dedc33cb80b27f30eaf
author: Antonio Niño Díaz <[email protected]>
date: Sat Mar 31 21:18:29 EDT 2018

Enable -Wextra

-Wsign-compare has been disabled because flex generates a comparison
that triggers a warning and cannot be fixed in the code.

Signed-off-by: Antonio Niño Díaz <[email protected]>

--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@
 
 VERSION_STRING	:= `git describe --tags --dirty --always 2>/dev/null`
 
-WARNFLAGS	:= -Werror -Wall -Wpedantic
+WARNFLAGS	:= -Werror -Wall -Wextra -Wpedantic -Wno-sign-compare
 
 # Overridable CFLAGS
 CFLAGS		:= -g
--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -341,8 +341,9 @@
 				break;
 
 			case '\"':
-				src++;
+				src += 2;
 				inString = false;
+				break;
 
 			default:
 				src++;
--- a/src/asm/fstack.c
+++ b/src/asm/fstack.c
@@ -257,8 +257,10 @@
 		 * space had been available. Thus, a return value of `size` or
 		 * more means that the output was truncated.
 		 */
-		if (snprintf(path, sizeof(path), "%s%s", IncludePaths[i], fname)
-		    >= sizeof(path))
+		int fullpathlen = snprintf(path, sizeof(path), "%s%s",
+					   IncludePaths[i], fname);
+
+		if (fullpathlen >= (int)sizeof(path))
 			continue;
 
 		f = fopen(path, "rb");
--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -216,7 +216,7 @@
 	return 0;
 }
 
-uint32_t PutUniqueArg(char *src, uint32_t size)
+uint32_t PutUniqueArg(__attribute ((unused)) char *src, uint32_t size)
 {
 	char *s;
 
--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -225,7 +225,7 @@
 
 static void opt_ParseDefines(void)
 {
-	int32_t i;
+	uint32_t i;
 
 	for (i = 0; i < cldefines_index; i += 2)
 		sym_AddString(cldefines[i], cldefines[i + 1]);
--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -62,7 +62,7 @@
 	memmove(string, new_beginning, strlen(new_beginning) + 1);
 }
 
-int32_t Callback_NARG(struct sSymbol *sym)
+int32_t Callback_NARG(__attribute__ ((unused)) struct sSymbol *sym)
 {
 	uint32_t i = 0;
 
@@ -673,7 +673,7 @@
 
 			struct sSymbol *parent = pScope->pScope ?
 						 pScope->pScope : pScope;
-			int32_t parentLen = localPtr - tzSym;
+			uint32_t parentLen = localPtr - tzSym;
 
 			if (strchr(localPtr + 1, '.') != NULL) {
 				fatalerror("'%s' is a nonsensical reference to a nested local symbol",
--- a/src/gfx/main.c
+++ b/src/gfx/main.c
@@ -53,6 +53,7 @@
 			break;
 		case 'F':
 			opts.hardfix = true;
+			/* fallthrough */
 		case 'f':
 			opts.fix = true;
 			break;