Fix -Wpedantic compiler warnings
... and test for those warnings (and others) when performing CI builds.
This commit is contained in:
12
.github/workflows/build.yml
vendored
12
.github/workflows/build.yml
vendored
@@ -119,7 +119,9 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
pushd build
|
||||
cmake -G"Unix Makefiles" -DWITH_12BIT=1 ..
|
||||
cmake -G"Unix Makefiles" -DWITH_12BIT=1 \
|
||||
-DCMAKE_C_FLAGS='--std=gnu90 -Wall -Werror -Wextra -Wpedantic -pedantic-errors -Wdouble-promotion -Wformat-overflow=2 -Wformat-security -Wformat-signedness -Wformat-truncation=2 -Wformat-y2k -Wmissing-include-dirs -Wshift-overflow=2 -Wswitch-bool -Wno-unused-parameter -Wuninitialized -Wstrict-overflow=2 -Wstringop-overflow=4 -Wstringop-truncation -Wduplicated-branches -Wduplicated-cond -Wdeclaration-after-statement -Wshadow -Wunsafe-loop-optimizations -Wundef -Wcast-align -Wno-clobbered -Wjump-misses-init -Wno-sign-compare -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Wdisabled-optimization -Wno-overlength-strings' \
|
||||
..
|
||||
export NUMCPUS=`grep -c '^processor' /proc/cpuinfo`
|
||||
make -j$NUMCPUS --load-average=$NUMCPUS
|
||||
make test
|
||||
@@ -139,7 +141,9 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
pushd build
|
||||
cmake -G"Unix Makefiles" -DWITH_JPEG7=1 -DCMAKE_C_FLAGS=-mx32 ..
|
||||
cmake -G"Unix Makefiles" -DWITH_JPEG7=1 -DCMAKE_C_FLAGS=-mx32 \
|
||||
-DCMAKE_C_FLAGS='--std=gnu90 -Wall -Werror -Wextra -Wpedantic -pedantic-errors -Wdouble-promotion -Wformat-overflow=2 -Wformat-security -Wformat-signedness -Wformat-truncation=2 -Wformat-y2k -Wmissing-include-dirs -Wshift-overflow=2 -Wswitch-bool -Wno-unused-parameter -Wuninitialized -Wstrict-overflow=2 -Wstringop-overflow=4 -Wstringop-truncation -Wduplicated-branches -Wduplicated-cond -Wdeclaration-after-statement -Wshadow -Wunsafe-loop-optimizations -Wundef -Wcast-align -Wno-clobbered -Wjump-misses-init -Wno-sign-compare -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Wdisabled-optimization -Wno-overlength-strings' \
|
||||
..
|
||||
export NUMCPUS=`grep -c '^processor' /proc/cpuinfo`
|
||||
make -j$NUMCPUS --load-average=$NUMCPUS
|
||||
make test
|
||||
@@ -161,7 +165,9 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
pushd build
|
||||
cmake -G"Unix Makefiles" -DWITH_JPEG8=1 ..
|
||||
cmake -G"Unix Makefiles" -DWITH_JPEG8=1 \
|
||||
-DCMAKE_C_FLAGS='--std=gnu90 -Wall -Werror -Wextra -Wpedantic -pedantic-errors -Wdouble-promotion -Wformat-overflow=2 -Wformat-security -Wformat-signedness -Wformat-truncation=2 -Wformat-y2k -Wmissing-include-dirs -Wshift-overflow=2 -Wswitch-bool -Wno-unused-parameter -Wuninitialized -Wstrict-overflow=2 -Wstringop-overflow=4 -Wstringop-truncation -Wduplicated-branches -Wduplicated-cond -Wdeclaration-after-statement -Wshadow -Wunsafe-loop-optimizations -Wundef -Wcast-align -Wno-clobbered -Wjump-misses-init -Wno-sign-compare -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Wdisabled-optimization -Wno-overlength-strings' \
|
||||
..
|
||||
export NUMCPUS=`grep -c '^processor' /proc/cpuinfo`
|
||||
make -j$NUMCPUS --load-average=$NUMCPUS
|
||||
make test
|
||||
|
||||
4
cdjpeg.c
4
cdjpeg.c
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2019, D. R. Commander.
|
||||
* Copyright (C) 2019, 2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -34,7 +34,7 @@ progress_monitor(j_common_ptr cinfo)
|
||||
int scan_no = ((j_decompress_ptr)cinfo)->input_scan_number;
|
||||
|
||||
if (scan_no > (int)prog->max_scans) {
|
||||
fprintf(stderr, "Scan number %d exceeds maximum scans (%d)\n", scan_no,
|
||||
fprintf(stderr, "Scan number %d exceeds maximum scans (%u)\n", scan_no,
|
||||
prog->max_scans);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
12
djpeg.c
12
djpeg.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2013-2019 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010-2011, 2013-2017, 2019-2020, D. R. Commander.
|
||||
* Copyright (C) 2010-2011, 2013-2017, 2019-2020, 2022, D. R. Commander.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@@ -717,7 +717,7 @@ main(int argc, char **argv)
|
||||
* that skip_start <= skip_end.
|
||||
*/
|
||||
if (skip_end > cinfo.output_height - 1) {
|
||||
fprintf(stderr, "%s: skip region exceeds image height %d\n", progname,
|
||||
fprintf(stderr, "%s: skip region exceeds image height %u\n", progname,
|
||||
cinfo.output_height);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -738,7 +738,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
if ((tmp = jpeg_skip_scanlines(&cinfo, skip_end - skip_start + 1)) !=
|
||||
skip_end - skip_start + 1) {
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %d rather than %d\n",
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %u rather than %u\n",
|
||||
progname, tmp, skip_end - skip_start + 1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -757,7 +757,7 @@ main(int argc, char **argv)
|
||||
*/
|
||||
if (crop_x + crop_width > cinfo.output_width ||
|
||||
crop_y + crop_height > cinfo.output_height) {
|
||||
fprintf(stderr, "%s: crop dimensions exceed image dimensions %d x %d\n",
|
||||
fprintf(stderr, "%s: crop dimensions exceed image dimensions %u x %u\n",
|
||||
progname, cinfo.output_width, cinfo.output_height);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -778,7 +778,7 @@ main(int argc, char **argv)
|
||||
|
||||
/* Process data */
|
||||
if ((tmp = jpeg_skip_scanlines(&cinfo, crop_y)) != crop_y) {
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %d rather than %d\n",
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %u rather than %u\n",
|
||||
progname, tmp, crop_y);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -791,7 +791,7 @@ main(int argc, char **argv)
|
||||
jpeg_skip_scanlines(&cinfo,
|
||||
cinfo.output_height - crop_y - crop_height)) !=
|
||||
cinfo.output_height - crop_y - crop_height) {
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %d rather than %d\n",
|
||||
fprintf(stderr, "%s: jpeg_skip_scanlines() returned %u rather than %u\n",
|
||||
progname, tmp, cinfo.output_height - crop_y - crop_height);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 2009 by Bill Allombert, Guido Vollbeding.
|
||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
||||
* to libjpeg-turbo.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -249,7 +249,7 @@ process_COM(int raw)
|
||||
} else if (isprint(ch)) {
|
||||
putc(ch, stdout);
|
||||
} else {
|
||||
printf("\\%03o", ch);
|
||||
printf("\\%03o", (unsigned int)ch);
|
||||
}
|
||||
lastch = ch;
|
||||
length--;
|
||||
|
||||
16
rdppm.c
16
rdppm.c
@@ -181,13 +181,13 @@ get_text_gray_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
GRAY_RGB_READ_LOOP(read_pbm_integer(cinfo, infile, maxval),
|
||||
ptr[aindex] = 0xFF;)
|
||||
else
|
||||
GRAY_RGB_READ_LOOP(read_pbm_integer(cinfo, infile, maxval),)
|
||||
GRAY_RGB_READ_LOOP(read_pbm_integer(cinfo, infile, maxval), {})
|
||||
} else {
|
||||
if (aindex >= 0)
|
||||
GRAY_RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)],
|
||||
ptr[aindex] = 0xFF;)
|
||||
else
|
||||
GRAY_RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)],)
|
||||
GRAY_RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)], {})
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -255,13 +255,13 @@ get_text_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
RGB_READ_LOOP(read_pbm_integer(cinfo, infile, maxval),
|
||||
ptr[aindex] = 0xFF;)
|
||||
else
|
||||
RGB_READ_LOOP(read_pbm_integer(cinfo, infile, maxval),)
|
||||
RGB_READ_LOOP(read_pbm_integer(cinfo, infile, maxval), {})
|
||||
} else {
|
||||
if (aindex >= 0)
|
||||
RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)],
|
||||
ptr[aindex] = 0xFF;)
|
||||
else
|
||||
RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)],)
|
||||
RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)], {})
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -347,12 +347,12 @@ get_gray_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
if (aindex >= 0)
|
||||
GRAY_RGB_READ_LOOP(*bufferptr++, ptr[aindex] = 0xFF;)
|
||||
else
|
||||
GRAY_RGB_READ_LOOP(*bufferptr++,)
|
||||
GRAY_RGB_READ_LOOP(*bufferptr++, {})
|
||||
} else {
|
||||
if (aindex >= 0)
|
||||
GRAY_RGB_READ_LOOP(rescale[UCH(*bufferptr++)], ptr[aindex] = 0xFF;)
|
||||
else
|
||||
GRAY_RGB_READ_LOOP(rescale[UCH(*bufferptr++)],)
|
||||
GRAY_RGB_READ_LOOP(rescale[UCH(*bufferptr++)], {})
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -415,12 +415,12 @@ get_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
if (aindex >= 0)
|
||||
RGB_READ_LOOP(*bufferptr++, ptr[aindex] = 0xFF;)
|
||||
else
|
||||
RGB_READ_LOOP(*bufferptr++,)
|
||||
RGB_READ_LOOP(*bufferptr++, {})
|
||||
} else {
|
||||
if (aindex >= 0)
|
||||
RGB_READ_LOOP(rescale[UCH(*bufferptr++)], ptr[aindex] = 0xFF;)
|
||||
else
|
||||
RGB_READ_LOOP(rescale[UCH(*bufferptr++)],)
|
||||
RGB_READ_LOOP(rescale[UCH(*bufferptr++)], {})
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
14
turbojpeg.c
14
turbojpeg.c
@@ -2010,13 +2010,13 @@ DLLEXPORT int tjTransform(tjhandle handle, const unsigned char *jpegBuf,
|
||||
|
||||
for (ci = 0; ci < cinfo->num_components; ci++) {
|
||||
jpeg_component_info *compptr = &cinfo->comp_info[ci];
|
||||
tjregion arrayRegion = {
|
||||
0, 0, compptr->width_in_blocks * DCTSIZE, DCTSIZE
|
||||
};
|
||||
tjregion planeRegion = {
|
||||
0, 0, compptr->width_in_blocks * DCTSIZE,
|
||||
compptr->height_in_blocks * DCTSIZE
|
||||
};
|
||||
tjregion arrayRegion = { 0, 0, 0, 0 };
|
||||
tjregion planeRegion = { 0, 0, 0, 0 };
|
||||
|
||||
arrayRegion.w = compptr->width_in_blocks * DCTSIZE;
|
||||
arrayRegion.h = DCTSIZE;
|
||||
planeRegion.w = compptr->width_in_blocks * DCTSIZE;
|
||||
planeRegion.h = compptr->height_in_blocks * DCTSIZE;
|
||||
|
||||
for (by = 0; by < compptr->height_in_blocks;
|
||||
by += compptr->v_samp_factor) {
|
||||
|
||||
Reference in New Issue
Block a user