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>
This commit is contained in:
Antonio Niño Díaz
2018-04-01 00:47:35 +01:00
parent 4d13d57491
commit b28a16c0da
5 changed files with 10 additions and 5 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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'");
}

View File

@@ -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,