Add compiler warning flag -Wextra and fix related warnings.

Note: some of these warnings are enabled by a combination of -Wunused
(added earlier) and -Wextra.

Cherry-picked from aomedia/master: 4790a69

Change-Id: I322a1366bd4fd6c0dec9e758c2d5e88e003b1cbf
This commit is contained in:
Urvang Joshi 2016-07-14 12:33:48 -07:00
Родитель bffc0b5748
Коммит d71a231c49
21 изменённых файлов: 85 добавлений и 48 удалений

Просмотреть файл

@ -65,6 +65,10 @@ void aom_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
@ -241,6 +245,10 @@ void aom_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

Просмотреть файл

@ -65,6 +65,10 @@ void aom_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
@ -225,6 +229,10 @@ void aom_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

Просмотреть файл

@ -27,6 +27,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]) { \

Просмотреть файл

@ -1412,9 +1412,8 @@ static void open_output_file(struct stream_state *stream,
#if CONFIG_WEBM_IO
if (stream->config.write_webm) {
stream->webm_ctx.stream = stream->file;
write_webm_file_header(&stream->webm_ctx, cfg, &global->framerate,
stream->config.stereo_fmt, global->codec->fourcc,
pixel_aspect_ratio);
write_webm_file_header(&stream->webm_ctx, cfg, stream->config.stereo_fmt,
global->codec->fourcc, pixel_aspect_ratio);
}
#else
(void)pixel_aspect_ratio;

4
configure поставляемый
Просмотреть файл

@ -617,6 +617,10 @@ process_toolchain() {
check_add_cflags -Wuninitialized
check_add_cflags -Wunused
check_add_cflags -Wsign-compare
# Enabling the following warning (in combination with -Wunused above)
# for C++ generates errors in third_party code including googletest and
# libyuv. So enable it only for C code.
check_cflags "-Wextra" && add_cflags_only "-Wextra"
# Enabling the following warning for C++ generates some useless warnings
# about some function parameters shadowing class member function names.
# So, only enable this warning for C code.

Просмотреть файл

@ -191,8 +191,7 @@ static void find_mismatch(const aom_image_t *const img1,
}
static void testing_decode(aom_codec_ctx_t *encoder, aom_codec_ctx_t *decoder,
aom_codec_enc_cfg_t *cfg, unsigned int frame_out,
int *mismatch_seen) {
unsigned int frame_out, int *mismatch_seen) {
aom_image_t enc_img, dec_img;
struct av1_ref_frame ref_enc, ref_dec;
@ -226,11 +225,10 @@ static void testing_decode(aom_codec_ctx_t *encoder, aom_codec_ctx_t *decoder,
aom_img_free(&dec_img);
}
static int encode_frame(aom_codec_ctx_t *ecodec, aom_codec_enc_cfg_t *cfg,
aom_image_t *img, unsigned int frame_in,
AvxVideoWriter *writer, int test_decode,
aom_codec_ctx_t *dcodec, unsigned int *frame_out,
int *mismatch_seen) {
static int encode_frame(aom_codec_ctx_t *ecodec, aom_image_t *img,
unsigned int frame_in, AvxVideoWriter *writer,
int test_decode, aom_codec_ctx_t *dcodec,
unsigned int *frame_out, int *mismatch_seen) {
int got_pkts = 0;
aom_codec_iter_t iter = NULL;
const aom_codec_cx_pkt_t *pkt = NULL;
@ -271,7 +269,7 @@ static int encode_frame(aom_codec_ctx_t *ecodec, aom_codec_enc_cfg_t *cfg,
// Mismatch checking
if (got_data && test_decode) {
testing_decode(ecodec, dcodec, cfg, *frame_out, mismatch_seen);
testing_decode(ecodec, dcodec, *frame_out, mismatch_seen);
}
return got_pkts;
@ -280,12 +278,12 @@ static int encode_frame(aom_codec_ctx_t *ecodec, aom_codec_enc_cfg_t *cfg,
int main(int argc, char **argv) {
FILE *infile = NULL;
// Encoder
aom_codec_ctx_t ecodec = { 0 };
aom_codec_enc_cfg_t cfg = { 0 };
aom_codec_ctx_t ecodec;
aom_codec_enc_cfg_t cfg;
unsigned int frame_in = 0;
aom_image_t raw;
aom_codec_err_t res;
AvxVideoInfo info = { 0 };
AvxVideoInfo info;
AvxVideoWriter *writer = NULL;
const AvxInterface *encoder = NULL;
@ -311,6 +309,12 @@ int main(int argc, char **argv) {
unsigned int limit = 0;
exec_name = argv[0];
// Clear explicitly, as simply assigning "{ 0 }" generates
// "missing-field-initializers" warning in some compilers.
memset(&ecodec, 0, sizeof(ecodec));
memset(&cfg, 0, sizeof(cfg));
memset(&info, 0, sizeof(info));
if (argc < 7) die("Invalid number of arguments");
codec_arg = argv[1];
@ -404,7 +408,7 @@ int main(int argc, char **argv) {
}
}
encode_frame(&ecodec, &cfg, &raw, frame_in, writer, test_decode, &dcodec,
encode_frame(&ecodec, &raw, frame_in, writer, test_decode, &dcodec,
&frame_out, &mismatch_seen);
frame_in++;
if (mismatch_seen) break;
@ -412,8 +416,8 @@ int main(int argc, char **argv) {
// Flush encoder.
if (!mismatch_seen)
while (encode_frame(&ecodec, &cfg, NULL, frame_in, writer, test_decode,
&dcodec, &frame_out, &mismatch_seen)) {
while (encode_frame(&ecodec, NULL, frame_in, writer, test_decode, &dcodec,
&frame_out, &mismatch_seen)) {
}
printf("\n");

Просмотреть файл

@ -63,13 +63,17 @@ int main(int argc, char **argv) {
int frame_count = 0;
aom_image_t raw;
aom_codec_err_t res;
AvxVideoInfo info = { 0 };
AvxVideoInfo info;
AvxVideoWriter *writer = NULL;
const AvxInterface *encoder = NULL;
const int fps = 30;
exec_name = argv[0];
// Clear explicitly, as simply assigning "{ 0 }" generates
// "missing-field-initializers" warning in some compilers.
memset(&info, 0, sizeof(info));
if (argc < 5) die("Invalid number of arguments");
encoder = get_aom_encoder_by_name("av1");

Просмотреть файл

@ -151,7 +151,7 @@ int main(int argc, char **argv) {
int frame_count = 0;
aom_image_t raw;
aom_codec_err_t res;
AvxVideoInfo info = { 0 };
AvxVideoInfo info;
AvxVideoWriter *writer = NULL;
const AvxInterface *encoder = NULL;
const int fps = 30;
@ -168,6 +168,10 @@ int main(int argc, char **argv) {
exec_name = argv[0];
// Clear explicitly, as simply assigning "{ 0 }" generates
// "missing-field-initializers" warning in some compilers.
memset(&info, 0, sizeof(info));
if (argc != 9) die("Invalid number of arguments");
codec_arg = argv[1];

Просмотреть файл

@ -54,7 +54,6 @@ const size_t maxHeight = 256;
const size_t maxBlockSize = maxWidth * maxHeight;
const int horizOffset = 32;
const int vertiOffset = 32;
const size_t testMaxBlk = 128;
const int stride = 128;
const int x_step_q4 = 16;
@ -90,7 +89,7 @@ class AV1ConvolveOptimzTest : public ::testing::TestWithParam<ConvParams> {
void RunVertFilterBitExactCheck();
private:
void PrepFilterBuffer(int w, int h);
void PrepFilterBuffer();
void DiffFilterBuffer();
conv_filter_t conv_horiz_;
conv_filter_t conv_vert_;
@ -106,7 +105,7 @@ class AV1ConvolveOptimzTest : public ::testing::TestWithParam<ConvParams> {
int avg_;
};
void AV1ConvolveOptimzTest::PrepFilterBuffer(int w, int h) {
void AV1ConvolveOptimzTest::PrepFilterBuffer() {
int r, c;
ACMRandom rnd(ACMRandom::DeterministicSeed());
@ -150,7 +149,7 @@ void AV1ConvolveOptimzTest::DiffFilterBuffer() {
}
void AV1ConvolveOptimzTest::RunHorizFilterBitExactCheck() {
PrepFilterBuffer(testMaxBlk, testMaxBlk);
PrepFilterBuffer();
InterpFilterParams filter_params = av1_get_interp_filter_params(filter_);
@ -167,7 +166,7 @@ void AV1ConvolveOptimzTest::RunHorizFilterBitExactCheck() {
// and test again.
int intermediate_height =
(((height_ - 1) * 16 + subpel_) >> SUBPEL_BITS) + filter_params.taps;
PrepFilterBuffer(testMaxBlk, testMaxBlk);
PrepFilterBuffer();
av1_convolve_horiz_c(src_ref_, stride, dst_ref_, stride, width_,
intermediate_height, filter_params, subpel_, x_step_q4,
@ -180,7 +179,7 @@ void AV1ConvolveOptimzTest::RunHorizFilterBitExactCheck() {
}
void AV1ConvolveOptimzTest::RunVertFilterBitExactCheck() {
PrepFilterBuffer(testMaxBlk, testMaxBlk);
PrepFilterBuffer();
InterpFilterParams filter_params = av1_get_interp_filter_params(filter_);
@ -266,7 +265,7 @@ class AV1HbdConvolveOptimzTest : public TestWithHbdConvParams {
void RunVertFilterBitExactCheck();
private:
void PrepFilterBuffer(int w, int h);
void PrepFilterBuffer();
void DiffFilterBuffer();
hbd_conv_filter_t conv_horiz_;
hbd_conv_filter_t conv_vert_;
@ -283,7 +282,7 @@ class AV1HbdConvolveOptimzTest : public TestWithHbdConvParams {
int bit_depth_;
};
void AV1HbdConvolveOptimzTest::PrepFilterBuffer(int w, int h) {
void AV1HbdConvolveOptimzTest::PrepFilterBuffer() {
int r, c;
ACMRandom rnd(ACMRandom::DeterministicSeed());
@ -326,7 +325,7 @@ void AV1HbdConvolveOptimzTest::DiffFilterBuffer() {
}
void AV1HbdConvolveOptimzTest::RunHorizFilterBitExactCheck() {
PrepFilterBuffer(testMaxBlk, testMaxBlk);
PrepFilterBuffer();
InterpFilterParams filter_params = av1_get_interp_filter_params(filter_);
@ -344,7 +343,7 @@ void AV1HbdConvolveOptimzTest::RunHorizFilterBitExactCheck() {
// and test again.
int intermediate_height =
(((height_ - 1) * 16 + subpel_) >> SUBPEL_BITS) + filter_params.taps;
PrepFilterBuffer(testMaxBlk, testMaxBlk);
PrepFilterBuffer();
av1_highbd_convolve_horiz_c(src_, stride, dst_ref_, stride, width_,
intermediate_height, filter_params, subpel_,
@ -357,7 +356,7 @@ void AV1HbdConvolveOptimzTest::RunHorizFilterBitExactCheck() {
}
void AV1HbdConvolveOptimzTest::RunVertFilterBitExactCheck() {
PrepFilterBuffer(testMaxBlk, testMaxBlk);
PrepFilterBuffer();
InterpFilterParams filter_params = av1_get_interp_filter_params(filter_);

Просмотреть файл

@ -54,14 +54,14 @@ 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];
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];
@ -97,11 +97,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_);
}

Просмотреть файл

@ -123,6 +123,9 @@ class AV1CodecFactory : public CodecFactory {
#if CONFIG_AV1_DECODER
return new AV1Decoder(cfg, flags, deadline);
#else
(void)cfg;
(void)flags;
(void)deadline;
return NULL;
#endif
}
@ -134,6 +137,10 @@ class AV1CodecFactory : public CodecFactory {
#if CONFIG_AV1_ENCODER
return new AV1Encoder(cfg, deadline, init_flags, stats);
#else
(void)cfg;
(void)deadline;
(void)init_flags;
(void)stats;
return NULL;
#endif
}
@ -143,6 +150,8 @@ class AV1CodecFactory : public CodecFactory {
#if CONFIG_AV1_ENCODER
return aom_codec_enc_config_default(&aom_codec_av1_cx_algo, cfg, usage);
#else
(void)cfg;
(void)usage;
return AOM_CODEC_INCAPABLE;
#endif
}

Просмотреть файл

@ -264,12 +264,12 @@ void idct16x16_12(const tran_low_t *in, uint8_t *out, int stride) {
}
void idct16x16_10_ref(const tran_low_t *in, uint8_t *out, int stride,
int tx_type) {
int /*tx_type*/) {
idct16x16_10(in, out, stride);
}
void idct16x16_12_ref(const tran_low_t *in, uint8_t *out, int stride,
int tx_type) {
int /*tx_type*/) {
idct16x16_12(in, out, stride);
}
@ -727,7 +727,7 @@ class InvTrans16x16DCT : public Trans16x16TestBase,
virtual void TearDown() { libaom_test::ClearSystemState(); }
protected:
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {}
void RunFwdTxfm(int16_t * /*in*/, tran_low_t * /*out*/, int /*stride*/) {}
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
inv_txfm_(out, dst, stride);
}

Просмотреть файл

@ -92,7 +92,7 @@ void DecoderTest::RunLoop(CompressedVideoSource *video,
aom_codec_err_t res_dec =
decoder->DecodeFrame(video->cxdata(), video->frame_size());
if (!HandleDecodeResult(res_dec, *video, decoder)) break;
if (!HandleDecodeResult(res_dec, decoder)) break;
} else {
// Signal end of the file to the decoder.
const aom_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);

Просмотреть файл

@ -141,7 +141,6 @@ class DecoderTest {
// Hook to be called to handle decode result. Return true to continue.
virtual bool HandleDecodeResult(const aom_codec_err_t res_dec,
const CompressedVideoSource & /*video*/,
Decoder *decoder) {
EXPECT_EQ(AOM_CODEC_OK, res_dec) << decoder->DecodeError();
return AOM_CODEC_OK == res_dec;

Просмотреть файл

@ -275,7 +275,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
aom_codec_err_t res_dec = decoder->DecodeFrame(
(const uint8_t *)pkt->data.frame.buf, pkt->data.frame.sz);
if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
if (!HandleDecodeResult(res_dec, decoder.get())) break;
has_dxdata = true;
}
@ -293,7 +293,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
// Flush the decoder when there are no more fragments.
if ((init_flags_ & AOM_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) {
const aom_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
if (!HandleDecodeResult(res_dec, decoder.get())) break;
}
if (has_dxdata && has_cxdata) {

Просмотреть файл

@ -228,7 +228,6 @@ class EncoderTest {
// Hook to be called to handle decode result. Return true to continue.
virtual bool HandleDecodeResult(const aom_codec_err_t res_dec,
const VideoSource & /*video*/,
Decoder *decoder) {
EXPECT_EQ(AOM_CODEC_OK, res_dec) << decoder->DecodeError();
return AOM_CODEC_OK == res_dec;

Просмотреть файл

@ -94,7 +94,6 @@ class AvxEncoderParmsGetToDecoder
}
virtual bool HandleDecodeResult(const aom_codec_err_t res_dec,
const libaom_test::VideoSource & /*video*/,
libaom_test::Decoder *decoder) {
aom_codec_ctx_t *const av1_decoder = decoder->GetDecoder();
aom_codec_alg_priv_t *const priv =

Просмотреть файл

@ -55,8 +55,7 @@ class ErrorResilienceTestLarge
nframes_++;
}
virtual void PreEncodeFrameHook(libaom_test::VideoSource *video,
::libaom_test::Encoder * /*encoder*/) {
virtual void PreEncodeFrameHook(libaom_test::VideoSource *video) {
frame_flags_ &=
~(AOM_EFLAG_NO_UPD_LAST | AOM_EFLAG_NO_UPD_GF | AOM_EFLAG_NO_UPD_ARF);
if (droppable_nframes_ > 0 &&

Просмотреть файл

@ -28,7 +28,6 @@ class AV1FrameSizeTestsLarge : public ::libaom_test::EncoderTest,
}
virtual bool HandleDecodeResult(const aom_codec_err_t res_dec,
const libaom_test::VideoSource & /*video*/,
libaom_test::Decoder *decoder) {
EXPECT_EQ(expected_res_, res_dec) << decoder->DecodeError();
return !::testing::Test::HasFailure();

Просмотреть файл

@ -24,7 +24,6 @@ const int kVideoTrackNumber = 1;
void write_webm_file_header(struct WebmOutputContext *webm_ctx,
const aom_codec_enc_cfg_t *cfg,
const struct aom_rational *fps,
stereo_format_t stereo_fmt, unsigned int fourcc,
const struct AvxRational *par) {
mkvmuxer::MkvWriter *const writer = new mkvmuxer::MkvWriter(webm_ctx->stream);

Просмотреть файл

@ -40,7 +40,6 @@ typedef enum stereo_format {
void write_webm_file_header(struct WebmOutputContext *webm_ctx,
const aom_codec_enc_cfg_t *cfg,
const struct aom_rational *fps,
stereo_format_t stereo_fmt, unsigned int fourcc,
const struct AvxRational *par);