diff options
author | Johann Koenig <johannkoenig@google.com> | 2016-09-27 21:13:50 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-09-27 21:13:50 +0000 |
commit | 348cff040ae6893f46395f003fab336c858dec4d (patch) | |
tree | ab26ba82c0ea4dd8aa2632cc1dca13a0647143c4 | |
parent | b3ebea5e8a849a15ab3eb4b44f1d909f4119c552 (diff) | |
parent | c3a135b5b88910ce9ebba7261b0284d3a39df2a2 (diff) | |
download | libvpx-348cff040ae6893f46395f003fab336c858dec4d.tar libvpx-348cff040ae6893f46395f003fab336c858dec4d.tar.gz libvpx-348cff040ae6893f46395f003fab336c858dec4d.tar.bz2 libvpx-348cff040ae6893f46395f003fab336c858dec4d.zip |
Merge changes from topic 'wextra'
* changes:
Expand -Wextra to more of the library
mips: clean up wextra warnings
Add compiler flag -Wsign-compare
Add compiler warning flag -Wextra and fix related warnings.
-rw-r--r-- | args.c | 9 | ||||
-rwxr-xr-x | configure | 5 | ||||
-rw-r--r-- | examples.mk | 1 | ||||
-rw-r--r-- | examples/vp9cx_set_ref.c | 10 | ||||
-rw-r--r-- | libs.mk | 9 | ||||
-rw-r--r-- | test/avg_test.cc | 9 | ||||
-rw-r--r-- | test/codec_factory.h | 16 | ||||
-rw-r--r-- | test/error_resilience_test.cc | 3 | ||||
-rw-r--r-- | vp8/encoder/mips/msa/quantize_msa.c | 12 | ||||
-rw-r--r-- | vpx_dsp/arm/vpx_convolve8_avg_neon.c | 8 | ||||
-rw-r--r-- | vpx_dsp/arm/vpx_convolve8_neon.c | 8 | ||||
-rw-r--r-- | vpx_dsp/fastssim.c | 2 | ||||
-rw-r--r-- | vpx_dsp/mips/add_noise_msa.c | 2 | ||||
-rw-r--r-- | vpx_dsp/x86/convolve.h | 4 |
14 files changed, 74 insertions, 24 deletions
@@ -13,6 +13,7 @@ #include <limits.h> #include "args.h" +#include "vpx/vpx_integer.h" #include "vpx_ports/msvc.h" #if defined(__GNUC__) && __GNUC__ @@ -118,13 +119,13 @@ void arg_show_usage(FILE *fp, const struct arg_def *const *defs) { } unsigned int arg_parse_uint(const struct arg *arg) { - long int rawval; + uint32_t rawval; char *endptr; - rawval = strtol(arg->val, &endptr, 10); + rawval = strtoul(arg->val, &endptr, 10); if (arg->val[0] != '\0' && endptr[0] == '\0') { - if (rawval >= 0 && rawval <= UINT_MAX) return (unsigned int)rawval; + if (rawval <= UINT_MAX) return rawval; die("Option %s: Value %ld out of range for unsigned int\n", arg->name, rawval); @@ -135,7 +136,7 @@ unsigned int arg_parse_uint(const struct arg *arg) { } int arg_parse_int(const struct arg *arg) { - long int rawval; + int32_t rawval; char *endptr; rawval = strtol(arg->val, &endptr, 10); @@ -575,6 +575,11 @@ process_toolchain() { check_add_cflags -Wimplicit-function-declaration check_add_cflags -Wuninitialized check_add_cflags -Wunused + # -Wextra has some tricky cases. Rather than fix them all now, get the + # flag for as many files as possible and fix the remaining issues + # piecemeal. + # https://bugs.chromium.org/p/webm/issues/detail?id=1069 + check_add_cflags -Wextra # check_add_cflags also adds to cxxflags. gtest does not do well with # -Wundef so add it explicitly to CFLAGS only. check_cflags -Wundef && add_cflags_only -Wundef diff --git a/examples.mk b/examples.mk index cc7fb1ddc..38c4d75c5 100644 --- a/examples.mk +++ b/examples.mk @@ -76,6 +76,7 @@ vpxdec.SRCS += tools_common.c tools_common.h vpxdec.SRCS += y4menc.c y4menc.h ifeq ($(CONFIG_LIBYUV),yes) vpxdec.SRCS += $(LIBYUV_SRCS) + $(BUILD_PFX)third_party/libyuv/%.cc.o: CXXFLAGS += -Wno-unused-parameter endif ifeq ($(CONFIG_WEBM_IO),yes) vpxdec.SRCS += $(LIBWEBM_COMMON_SRCS) diff --git a/examples/vp9cx_set_ref.c b/examples/vp9cx_set_ref.c index 798d7e3f2..3472689db 100644 --- a/examples/vp9cx_set_ref.c +++ b/examples/vp9cx_set_ref.c @@ -304,6 +304,7 @@ int main(int argc, char **argv) { const char *height_arg = NULL; const char *infile_arg = NULL; const char *outfile_arg = NULL; + const char *update_frame_num_arg = NULL; unsigned int limit = 0; vp9_zero(ecodec); @@ -318,18 +319,21 @@ int main(int argc, char **argv) { height_arg = argv[2]; infile_arg = argv[3]; outfile_arg = argv[4]; + update_frame_num_arg = argv[5]; encoder = get_vpx_encoder_by_name("vp9"); if (!encoder) die("Unsupported codec."); - update_frame_num = atoi(argv[5]); + update_frame_num = (unsigned int)strtoul(update_frame_num_arg, NULL, 0); // In VP9, the reference buffers (cm->buffer_pool->frame_bufs[i].buf) are // allocated while calling vpx_codec_encode(), thus, setting reference for // 1st frame isn't supported. - if (update_frame_num <= 1) die("Couldn't parse frame number '%s'\n", argv[5]); + if (update_frame_num <= 1) { + die("Couldn't parse frame number '%s'\n", update_frame_num_arg); + } if (argc > 6) { - limit = atoi(argv[6]); + limit = (unsigned int)strtoul(argv[6], NULL, 0); if (update_frame_num > limit) die("Update frame number couldn't larger than limit\n"); } @@ -106,9 +106,6 @@ ifeq ($(CONFIG_VP9_DECODER),yes) CODEC_DOC_SECTIONS += vp9 vp9_decoder endif -VP9_PREFIX=vp9/ -$(BUILD_PFX)$(VP9_PREFIX)%.c.o: CFLAGS += -Wextra - ifeq ($(CONFIG_ENCODERS),yes) CODEC_DOC_SECTIONS += encoder endif @@ -116,6 +113,12 @@ ifeq ($(CONFIG_DECODERS),yes) CODEC_DOC_SECTIONS += decoder endif +# Suppress -Wextra warnings in third party code. +$(BUILD_PFX)third_party/googletest/%.cc.o: CXXFLAGS += -Wno-missing-field-initializers +# Suppress -Wextra warnings in first party code pending investigation. +# https://bugs.chromium.org/p/webm/issues/detail?id=1069 +$(BUILD_PFX)vp8/encoder/onyx_if.c.o: CFLAGS += -Wno-unknown-warning-option -Wno-clobbered +$(BUILD_PFX)vp8/decoder/onyxd_if.c.o: CFLAGS += -Wno-unknown-warning-option -Wno-clobbered ifeq ($(CONFIG_MSVS),yes) CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd) diff --git a/test/avg_test.cc b/test/avg_test.cc index 867a77aa0..272b99695 100644 --- a/test/avg_test.cc +++ b/test/avg_test.cc @@ -53,7 +53,7 @@ class AverageTestBase : public ::testing::Test { } // Sum Pixels - unsigned int ReferenceAverage8x8(const uint8_t *source, int pitch) { + static unsigned int ReferenceAverage8x8(const uint8_t *source, int pitch) { unsigned int average = 0; for (int h = 0; h < 8; ++h) { for (int w = 0; w < 8; ++w) average += source[h * pitch + w]; @@ -61,7 +61,7 @@ class AverageTestBase : public ::testing::Test { return ((average + 32) >> 6); } - unsigned int ReferenceAverage4x4(const uint8_t *source, int pitch) { + static unsigned int ReferenceAverage4x4(const uint8_t *source, int pitch) { unsigned int average = 0; for (int h = 0; h < 4; ++h) { for (int w = 0; w < 4; ++w) average += source[h * pitch + w]; @@ -98,11 +98,12 @@ class AverageTest : public AverageTestBase, protected: void CheckAverages() { + const int block_size = GET_PARAM(3); unsigned int expected = 0; - if (GET_PARAM(3) == 8) { + if (block_size == 8) { expected = ReferenceAverage8x8(source_data_ + GET_PARAM(2), source_stride_); - } else if (GET_PARAM(3) == 4) { + } else if (block_size == 4) { expected = ReferenceAverage4x4(source_data_ + GET_PARAM(2), source_stride_); } diff --git a/test/codec_factory.h b/test/codec_factory.h index e867dacaf..3415284ab 100644 --- a/test/codec_factory.h +++ b/test/codec_factory.h @@ -115,6 +115,8 @@ class VP8CodecFactory : public CodecFactory { #if CONFIG_VP8_DECODER return new VP8Decoder(cfg, flags); #else + (void)cfg; + (void)flags; return NULL; #endif } @@ -126,6 +128,10 @@ class VP8CodecFactory : public CodecFactory { #if CONFIG_VP8_ENCODER return new VP8Encoder(cfg, deadline, init_flags, stats); #else + (void)cfg; + (void)deadline; + (void)init_flags; + (void)stats; return NULL; #endif } @@ -135,6 +141,8 @@ class VP8CodecFactory : public CodecFactory { #if CONFIG_VP8_ENCODER return vpx_codec_enc_config_default(&vpx_codec_vp8_cx_algo, cfg, usage); #else + (void)cfg; + (void)usage; return VPX_CODEC_INCAPABLE; #endif } @@ -203,6 +211,8 @@ class VP9CodecFactory : public CodecFactory { #if CONFIG_VP9_DECODER return new VP9Decoder(cfg, flags); #else + (void)cfg; + (void)flags; return NULL; #endif } @@ -214,6 +224,10 @@ class VP9CodecFactory : public CodecFactory { #if CONFIG_VP9_ENCODER return new VP9Encoder(cfg, deadline, init_flags, stats); #else + (void)cfg; + (void)deadline; + (void)init_flags; + (void)stats; return NULL; #endif } @@ -223,6 +237,8 @@ class VP9CodecFactory : public CodecFactory { #if CONFIG_VP9_ENCODER return vpx_codec_enc_config_default(&vpx_codec_vp9_cx_algo, cfg, usage); #else + (void)cfg; + (void)usage; return VPX_CODEC_INCAPABLE; #endif } diff --git a/test/error_resilience_test.cc b/test/error_resilience_test.cc index 4c7ede8ca..030b67c57 100644 --- a/test/error_resilience_test.cc +++ b/test/error_resilience_test.cc @@ -90,8 +90,7 @@ class ErrorResilienceTestLarge return frame_flags; } - virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video, - ::libvpx_test::Encoder * /*encoder*/) { + virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video) { frame_flags_ &= ~(VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF); // For temporal layer case. diff --git a/vp8/encoder/mips/msa/quantize_msa.c b/vp8/encoder/mips/msa/quantize_msa.c index 11f70ae82..9f5fbd39c 100644 --- a/vp8/encoder/mips/msa/quantize_msa.c +++ b/vp8/encoder/mips/msa/quantize_msa.c @@ -12,10 +12,9 @@ #include "vp8/common/mips/msa/vp8_macros_msa.h" #include "vp8/encoder/block.h" -static int8_t fast_quantize_b_msa(int16_t *coeff_ptr, int16_t *zbin, - int16_t *round, int16_t *quant, - int16_t *de_quant, int16_t *q_coeff, - int16_t *dq_coeff) { +static int8_t fast_quantize_b_msa(int16_t *coeff_ptr, int16_t *round, + int16_t *quant, int16_t *de_quant, + int16_t *q_coeff, int16_t *dq_coeff) { int32_t cnt, eob; v16i8 inv_zig_zag = { 0, 1, 5, 6, 2, 4, 7, 12, 3, 8, 11, 13, 9, 10, 14, 15 }; v8i16 round0, round1; @@ -184,15 +183,14 @@ static int8_t exact_regular_quantize_b_msa( void vp8_fast_quantize_b_msa(BLOCK *b, BLOCKD *d) { int16_t *coeff_ptr = b->coeff; - int16_t *zbin_ptr = b->zbin; int16_t *round_ptr = b->round; int16_t *quant_ptr = b->quant_fast; int16_t *qcoeff_ptr = d->qcoeff; int16_t *dqcoeff_ptr = d->dqcoeff; int16_t *dequant_ptr = d->dequant; - *d->eob = fast_quantize_b_msa(coeff_ptr, zbin_ptr, round_ptr, quant_ptr, - dequant_ptr, qcoeff_ptr, dqcoeff_ptr); + *d->eob = fast_quantize_b_msa(coeff_ptr, round_ptr, quant_ptr, dequant_ptr, + qcoeff_ptr, dqcoeff_ptr); } void vp8_regular_quantize_b_msa(BLOCK *b, BLOCKD *d) { diff --git a/vpx_dsp/arm/vpx_convolve8_avg_neon.c b/vpx_dsp/arm/vpx_convolve8_avg_neon.c index 69cb28400..8e5373be0 100644 --- a/vpx_dsp/arm/vpx_convolve8_avg_neon.c +++ b/vpx_dsp/arm/vpx_convolve8_avg_neon.c @@ -64,6 +64,10 @@ void vpx_convolve8_avg_horiz_neon(const uint8_t *src, ptrdiff_t src_stride, assert(x_step_q4 == 16); + (void)x_step_q4; + (void)y_step_q4; + (void)filter_y; + q0s16 = vld1q_s16(filter_x); src -= 3; // adjust for taps @@ -240,6 +244,10 @@ void vpx_convolve8_avg_vert_neon(const uint8_t *src, ptrdiff_t src_stride, assert(y_step_q4 == 16); + (void)x_step_q4; + (void)y_step_q4; + (void)filter_x; + src -= src_stride * 3; q0s16 = vld1q_s16(filter_y); for (; w > 0; w -= 4, src += 4, dst += 4) { // loop_vert_h diff --git a/vpx_dsp/arm/vpx_convolve8_neon.c b/vpx_dsp/arm/vpx_convolve8_neon.c index 514525696..951c425e2 100644 --- a/vpx_dsp/arm/vpx_convolve8_neon.c +++ b/vpx_dsp/arm/vpx_convolve8_neon.c @@ -64,6 +64,10 @@ void vpx_convolve8_horiz_neon(const uint8_t *src, ptrdiff_t src_stride, assert(x_step_q4 == 16); + (void)x_step_q4; + (void)y_step_q4; + (void)filter_y; + q0s16 = vld1q_s16(filter_x); src -= 3; // adjust for taps @@ -224,6 +228,10 @@ void vpx_convolve8_vert_neon(const uint8_t *src, ptrdiff_t src_stride, assert(y_step_q4 == 16); + (void)x_step_q4; + (void)y_step_q4; + (void)filter_x; + src -= src_stride * 3; q0s16 = vld1q_s16(filter_y); for (; w > 0; w -= 4, src += 4, dst += 4) { // loop_vert_h diff --git a/vpx_dsp/fastssim.c b/vpx_dsp/fastssim.c index 4d5eb5a6f..0469071a1 100644 --- a/vpx_dsp/fastssim.c +++ b/vpx_dsp/fastssim.c @@ -202,6 +202,7 @@ static void fs_apply_luminance(fs_ctx *_ctx, int _l, int bit_depth) { if (bit_depth == 12) ssim_c1 = SSIM_C1_12; #else assert(bit_depth == 8); + (void)bit_depth; #endif w = _ctx->level[_l].w; h = _ctx->level[_l].h; @@ -326,6 +327,7 @@ static void fs_calc_structure(fs_ctx *_ctx, int _l, int bit_depth) { if (bit_depth == 12) ssim_c2 = SSIM_C2_12; #else assert(bit_depth == 8); + (void)bit_depth; #endif w = _ctx->level[_l].w; diff --git a/vpx_dsp/mips/add_noise_msa.c b/vpx_dsp/mips/add_noise_msa.c index e372b9d8c..48278d2ec 100644 --- a/vpx_dsp/mips/add_noise_msa.c +++ b/vpx_dsp/mips/add_noise_msa.c @@ -14,7 +14,7 @@ void vpx_plane_add_noise_msa(uint8_t *start_ptr, const int8_t *noise, int blackclamp, int whiteclamp, int width, int height, int32_t pitch) { - uint32_t i, j; + int i, j; for (i = 0; i < height / 2; ++i) { uint8_t *pos0_ptr = start_ptr + (2 * i) * pitch; diff --git a/vpx_dsp/x86/convolve.h b/vpx_dsp/x86/convolve.h index 2a0516cdc..d7468ad7c 100644 --- a/vpx_dsp/x86/convolve.h +++ b/vpx_dsp/x86/convolve.h @@ -25,6 +25,10 @@ typedef void filter8_1dfunction(const uint8_t *src_ptr, ptrdiff_t src_pitch, const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, \ ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, \ const int16_t *filter_y, int y_step_q4, int w, int h) { \ + (void)filter_x; \ + (void)x_step_q4; \ + (void)filter_y; \ + (void)y_step_q4; \ assert(filter[3] != 128); \ assert(step_q4 == 16); \ if (filter[0] | filter[1] | filter[2]) { \ |