From b28a16c0da3917260f1d2dedc33cb80b27f30eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ni=C3=B1o=20D=C3=ADaz?= Date: Sun, 1 Apr 2018 00:47:35 +0100 Subject: [PATCH] Enable -Wpedantic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a few warnings related needed to build the source with this option. Add new exception to .checkpatch.conf. Signed-off-by: Antonio Niño Díaz --- .checkpatch.conf | 3 +++ Makefile | 2 +- src/asm/lexer.c | 1 - src/asm/main.c | 5 ++++- src/gfx/makepng.c | 4 ++-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.checkpatch.conf b/.checkpatch.conf index 71f34a2f..4f4ed543 100644 --- a/.checkpatch.conf +++ b/.checkpatch.conf @@ -53,6 +53,9 @@ # Prefer stdint.h types over kernel types --ignore PREFER_KERNEL_TYPES +# Don't ask to replace sscanf by kstrto +--ignore SSCANF_TO_KSTRTO + # Parentheses can make the code clearer --ignore UNNECESSARY_PARENTHESES diff --git a/Makefile b/Makefile index 49da9f93..125f1acf 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ PNGLDLIBS := `${PKG_CONFIG} --static --libs-only-l libpng` VERSION_STRING := `git describe --tags --dirty --always 2>/dev/null` -WARNFLAGS := -Wall -Werror +WARNFLAGS := -Werror -Wall -Wpedantic # Overridable CFLAGS CFLAGS := -g diff --git a/src/asm/lexer.c b/src/asm/lexer.c index 8696b140..b789f567 100644 --- a/src/asm/lexer.c +++ b/src/asm/lexer.c @@ -640,7 +640,6 @@ scanagain: /* Check for line continuation character */ if (*pLexBuffer == '\\') { - /* * Look for line continuation character after a series of * spaces. This is also useful for files that use Windows line diff --git a/src/asm/main.c b/src/asm/main.c index 28659e53..4a551a88 100644 --- a/src/asm/main.c +++ b/src/asm/main.c @@ -147,10 +147,13 @@ void opt_Parse(char *s) case 'z': if (strlen(&s[1]) <= 2) { int32_t result; + unsigned int fillchar; - result = sscanf(&s[1], "%x", &newopt.fillchar); + result = sscanf(&s[1], "%x", &fillchar); if (!((result == EOF) || (result == 1))) errx(1, "Invalid argument for option 'z'"); + + newopt.fillchar = fillchar; } else { errx(1, "Invalid argument for option 'z'"); } diff --git a/src/gfx/makepng.c b/src/gfx/makepng.c index 3f8fc24a..88654afb 100644 --- a/src/gfx/makepng.c +++ b/src/gfx/makepng.c @@ -317,9 +317,9 @@ static void rgba_png_palette(struct PNGImage *img, png_color **palette_ptr_ptr, int *num_colors) { if (png_get_valid(img->png, img->info, PNG_INFO_PLTE)) - return rgba_PLTE_palette(img, palette_ptr_ptr, num_colors); + rgba_PLTE_palette(img, palette_ptr_ptr, num_colors); else - return rgba_build_palette(img, palette_ptr_ptr, num_colors); + rgba_build_palette(img, palette_ptr_ptr, num_colors); } static void rgba_PLTE_palette(struct PNGImage *img,