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 <antonio_nd@outlook.com>
This commit is contained in:
Antonio Niño Díaz
2018-04-01 01:18:29 +01:00
parent b28a16c0da
commit 9829be1045
7 changed files with 12 additions and 8 deletions

View File

@@ -26,7 +26,7 @@ PNGLDLIBS := `${PKG_CONFIG} --static --libs-only-l libpng`
VERSION_STRING := `git describe --tags --dirty --always 2>/dev/null` VERSION_STRING := `git describe --tags --dirty --always 2>/dev/null`
WARNFLAGS := -Werror -Wall -Wpedantic WARNFLAGS := -Werror -Wall -Wextra -Wpedantic -Wno-sign-compare
# Overridable CFLAGS # Overridable CFLAGS
CFLAGS := -g CFLAGS := -g

View File

@@ -341,8 +341,9 @@ static void if_skip_to_else(void)
break; break;
case '\"': case '\"':
src++; src += 2;
inString = false; inString = false;
break;
default: default:
src++; src++;

View File

@@ -257,8 +257,10 @@ FILE *fstk_FindFile(char *fname)
* space had been available. Thus, a return value of `size` or * space had been available. Thus, a return value of `size` or
* more means that the output was truncated. * more means that the output was truncated.
*/ */
if (snprintf(path, sizeof(path), "%s%s", IncludePaths[i], fname) int fullpathlen = snprintf(path, sizeof(path), "%s%s",
>= sizeof(path)) IncludePaths[i], fname);
if (fullpathlen >= (int)sizeof(path))
continue; continue;
f = fopen(path, "rb"); f = fopen(path, "rb");

View File

@@ -216,7 +216,7 @@ uint32_t PutMacroArg(char *src, uint32_t size)
return 0; return 0;
} }
uint32_t PutUniqueArg(char *src, uint32_t size) uint32_t PutUniqueArg(__attribute ((unused)) char *src, uint32_t size)
{ {
char *s; char *s;

View File

@@ -225,7 +225,7 @@ void opt_AddDefine(char *s)
static void opt_ParseDefines(void) static void opt_ParseDefines(void)
{ {
int32_t i; uint32_t i;
for (i = 0; i < cldefines_index; i += 2) for (i = 0; i < cldefines_index; i += 2)
sym_AddString(cldefines[i], cldefines[i + 1]); sym_AddString(cldefines[i], cldefines[i + 1]);

View File

@@ -62,7 +62,7 @@ void helper_RemoveLeadingZeros(char *string)
memmove(string, new_beginning, strlen(new_beginning) + 1); 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; uint32_t i = 0;
@@ -673,7 +673,7 @@ void sym_AddReloc(char *tzSym)
struct sSymbol *parent = pScope->pScope ? struct sSymbol *parent = pScope->pScope ?
pScope->pScope : pScope; pScope->pScope : pScope;
int32_t parentLen = localPtr - tzSym; uint32_t parentLen = localPtr - tzSym;
if (strchr(localPtr + 1, '.') != NULL) { if (strchr(localPtr + 1, '.') != NULL) {
fatalerror("'%s' is a nonsensical reference to a nested local symbol", fatalerror("'%s' is a nonsensical reference to a nested local symbol",

View File

@@ -53,6 +53,7 @@ int main(int argc, char *argv[])
break; break;
case 'F': case 'F':
opts.hardfix = true; opts.hardfix = true;
/* fallthrough */
case 'f': case 'f':
opts.fix = true; opts.fix = true;
break; break;