diff --git a/CMakeLists.txt b/CMakeLists.txt index ea6c4531..336a0e68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,6 @@ else() -Wold-style-definition -Wshift-overflow=2 -Wstrict-overflow=5 -Wstrict-prototypes -Wstringop-overflow=4 -Wundef -Wuninitialized -Wunused -Wshadow # TODO: -Wshadow=compatible-local ? - -Wno-sign-compare # TODO: fix those warnings -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1 -Wno-format-nonliteral # We have a couple of "dynamic" prints # We do some range checks that are always false on some platforms (GCC, Clang) diff --git a/Makefile b/Makefile index 7ed2fb45..ab5ae331 100644 --- a/Makefile +++ b/Makefile @@ -219,7 +219,6 @@ develop: -Wstrict-overflow=5 -Wstrict-prototypes -Wundef -Wuninitialized -Wunused \ -Wshadow \ -Wnull-dereference -Wstringop-overflow=4 \ - -Wno-sign-compare \ -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1 \ -Wno-format-nonliteral \ -Wno-type-limits -Wno-tautological-constant-out-of-range-compare \ diff --git a/include/gfx/main.h b/include/gfx/main.h index b0622e44..562dda3c 100644 --- a/include/gfx/main.h +++ b/include/gfx/main.h @@ -24,7 +24,7 @@ struct Options { bool mirror; bool unique; bool colorcurve; - int trim; + unsigned int trim; char *tilemapfile; bool tilemapout; char *attrmapfile; @@ -43,7 +43,7 @@ struct RGBColor { struct ImageOptions { bool horizontal; - int trim; + unsigned int trim; char *tilemapfile; bool tilemapout; char *attrmapfile; diff --git a/src/asm/output.c b/src/asm/output.c index 1a119f0e..8b1404c5 100644 --- a/src/asm/output.c +++ b/src/asm/output.c @@ -192,7 +192,7 @@ static uint32_t getsectid(struct Section const *sect) static uint32_t getSectIDIfAny(struct Section const *sect) { - return sect ? getsectid(sect) : -1; + return sect ? getsectid(sect) : (uint32_t)-1; } /* @@ -200,7 +200,7 @@ static uint32_t getSectIDIfAny(struct Section const *sect) */ static void writepatch(struct Patch const *patch, FILE *f) { - assert(patch->src->ID != -1); + assert(patch->src->ID != (uint32_t)-1); putlong(patch->src->ID, f); putlong(patch->lineNo, f); putlong(patch->offset, f); @@ -264,7 +264,7 @@ static void writesymbol(struct Symbol const *sym, FILE *f) if (!sym_IsDefined(sym)) { putc(SYMTYPE_IMPORT, f); } else { - assert(sym->src->ID != -1); + assert(sym->src->ID != (uint32_t)-1); putc(sym->isExported ? SYMTYPE_EXPORT : SYMTYPE_LOCAL, f); putlong(sym->src->ID, f); @@ -490,7 +490,7 @@ static void freeassert(struct Assertion *assert) static void writeFileStackNode(struct FileStackNode const *node, FILE *f) { - putlong(node->parent ? node->parent->ID : -1, f); + putlong(node->parent ? node->parent->ID : (uint32_t)-1, f); putlong(node->lineNo, f); putc(node->type, f); if (node->type != NODE_REPT) { diff --git a/src/gfx/gb.c b/src/gfx/gb.c index a4dc44d9..f8cab15c 100644 --- a/src/gfx/gb.c +++ b/src/gfx/gb.c @@ -37,15 +37,14 @@ void transpose_tiles(struct GBImage *gb, int width) void raw_to_gb(const struct RawIndexedImage *raw_image, struct GBImage *gb) { - int x, y, byte; uint8_t index; - for (y = 0; y < raw_image->height; y++) { - for (x = 0; x < raw_image->width; x++) { + for (unsigned int y = 0; y < raw_image->height; y++) { + for (unsigned int x = 0; x < raw_image->width; x++) { index = raw_image->data[y][x]; index &= (1 << depth) - 1; - byte = y * depth + unsigned int byte = y * depth + x / 8 * raw_image->height / 8 * 8 * depth; gb->data[byte] |= (index & 1) << (7 - x % 8); if (depth == 2) { diff --git a/src/gfx/makepng.c b/src/gfx/makepng.c index 7c276840..dafca898 100644 --- a/src/gfx/makepng.c +++ b/src/gfx/makepng.c @@ -142,10 +142,9 @@ void output_png_file(const struct Options *opts, void destroy_raw_image(struct RawIndexedImage **raw_image_ptr_ptr) { - int y; struct RawIndexedImage *raw_image = *raw_image_ptr_ptr; - for (y = 0; y < raw_image->height; y++) + for (unsigned int y = 0; y < raw_image->height; y++) free(raw_image->data[y]); free(raw_image->data); diff --git a/src/link/patch.c b/src/link/patch.c index 4fa85283..b767ca08 100644 --- a/src/link/patch.c +++ b/src/link/patch.c @@ -111,7 +111,7 @@ static uint32_t getRPNByte(uint8_t const **expression, int32_t *size, static struct Symbol const *getSymbol(struct Symbol const * const *symbolList, uint32_t index) { - assert(index != -1); /* PC needs to be handled specially, not here */ + assert(index != (uint32_t)-1); /* PC needs to be handled specially, not here */ struct Symbol const *symbol = symbolList[index]; /* If the symbol is defined elsewhere... */