ref: b28a16c0da3917260f1d2dedc33cb80b27f30eaf
parent: 4d13d57491ab39034af7af05d4e42ea5a14793f2
author: Antonio Niño Díaz <antonio_nd@outlook.com>
date: Sat Mar 31 20:47:35 EDT 2018
Enable -Wpedantic 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 <antonio_nd@outlook.com>
--- 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
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@
VERSION_STRING := `git describe --tags --dirty --always 2>/dev/null`
-WARNFLAGS := -Wall -Werror
+WARNFLAGS := -Werror -Wall -Wpedantic
# Overridable CFLAGS
CFLAGS := -g
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -640,7 +640,6 @@
/* 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
--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -147,10 +147,13 @@
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'");
}
--- a/src/gfx/makepng.c
+++ b/src/gfx/makepng.c
@@ -317,9 +317,9 @@
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,