Fix Clang -Wunreachable-code-aggressive warnings
Clang's -Wunreachable-code-aggressive flag enables several warning flags
such as -Wunreachable-code-break and -Wunreachable-code-return. Chrome's
build system enables -Wunreachable-code-aggressive (in
build/config/compiler/BUILD.gn), so it would be good if libaom could be
compiled without -Wunreachable-code-aggressive warnings.
This requires the AOM_NO_RETURN macro be defined correctly for all the
compilers we support, otherwise some compilers may warn about missing
return statements after a die() or fatal() call (which does not return).
Change-Id: I0c069133af45a7a61759538b6d74c681ea087dcd
diff --git a/apps/aomdec.c b/apps/aomdec.c
index 333478a..1efc091 100644
--- a/apps/aomdec.c
+++ b/apps/aomdec.c
@@ -381,7 +381,7 @@
case '7': snprintf(q, q_len - 1, "%07d", frame_in); break;
case '8': snprintf(q, q_len - 1, "%08d", frame_in); break;
case '9': snprintf(q, q_len - 1, "%09d", frame_in); break;
- default: die("Unrecognized pattern %%%c\n", p[1]); break;
+ default: die("Unrecognized pattern %%%c\n", p[1]);
}
pat_len = strlen(q);
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index 5e19e58..602fab7 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -819,11 +819,11 @@
#if DISABLE_CHROMA_U8X8_OBMC
case BLOCK_4X4:
case BLOCK_8X4:
- case BLOCK_4X8: return 1; break;
+ case BLOCK_4X8: return 1;
#else
case BLOCK_4X4:
case BLOCK_8X4:
- case BLOCK_4X8: return dir == 0; break;
+ case BLOCK_4X8: return dir == 0;
#endif
default: return 0;
}
@@ -832,8 +832,6 @@
void av1_modify_neighbor_predictor_for_obmc(MB_MODE_INFO *mbmi) {
mbmi->ref_frame[1] = NONE_FRAME;
mbmi->interinter_comp.type = COMPOUND_AVERAGE;
-
- return;
}
struct obmc_inter_pred_ctxt {
diff --git a/av1/encoder/arm/neon/highbd_fwd_txfm_neon.c b/av1/encoder/arm/neon/highbd_fwd_txfm_neon.c
index 0549a48..64e4dae 100644
--- a/av1/encoder/arm/neon/highbd_fwd_txfm_neon.c
+++ b/av1/encoder/arm/neon/highbd_fwd_txfm_neon.c
@@ -3886,9 +3886,9 @@
static INLINE TxfmFuncNEON fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
switch (txfm_type) {
- case TXFM_TYPE_DCT32: return fdct32_new_neon; break;
- case TXFM_TYPE_DCT64: return fdct64_new_neon; break;
- case TXFM_TYPE_IDENTITY32: return idtx32x32_neon; break;
+ case TXFM_TYPE_DCT32: return fdct32_new_neon;
+ case TXFM_TYPE_DCT64: return fdct64_new_neon;
+ case TXFM_TYPE_IDENTITY32: return idtx32x32_neon;
default: assert(0);
}
return NULL;
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index e5e9b75..50f046d 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -611,7 +611,7 @@
}
// TODO(jingning): revisit this function.
- if (cpi->oxcf.algo_cfg.enable_tpl_model && 0) {
+ if (cpi->oxcf.algo_cfg.enable_tpl_model && (0)) {
adjust_rdmult_tpl_model(cpi, x, mi_row, mi_col);
}
}
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index c0d658b..cb4a580 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -221,7 +221,6 @@
case BLOCK_8X16: return aom_highbd_8_mse8x16;
default: return aom_highbd_8_mse16x16;
}
- break;
case 10:
switch (bsize) {
case BLOCK_8X8: return aom_highbd_10_mse8x8;
@@ -229,7 +228,6 @@
case BLOCK_8X16: return aom_highbd_10_mse8x16;
default: return aom_highbd_10_mse16x16;
}
- break;
case 12:
switch (bsize) {
case BLOCK_8X8: return aom_highbd_12_mse8x8;
@@ -237,7 +235,6 @@
case BLOCK_8X16: return aom_highbd_12_mse8x16;
default: return aom_highbd_12_mse16x16;
}
- break;
}
}
diff --git a/av1/encoder/x86/av1_fwd_txfm2d_sse4.c b/av1/encoder/x86/av1_fwd_txfm2d_sse4.c
index e23f38d..825da8d 100644
--- a/av1/encoder/x86/av1_fwd_txfm2d_sse4.c
+++ b/av1/encoder/x86/av1_fwd_txfm2d_sse4.c
@@ -75,9 +75,9 @@
static INLINE TxfmFuncSSE2 fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
switch (txfm_type) {
- case TXFM_TYPE_DCT32: return fdct32_sse4_1; break;
- case TXFM_TYPE_DCT64: return fdct64_new_sse4_1; break;
- case TXFM_TYPE_IDENTITY32: return idtx32x32_sse4_1; break;
+ case TXFM_TYPE_DCT32: return fdct32_sse4_1;
+ case TXFM_TYPE_DCT64: return fdct64_new_sse4_1;
+ case TXFM_TYPE_IDENTITY32: return idtx32x32_sse4_1;
default: assert(0);
}
return NULL;
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index ebf8a81..ad33f9a 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -349,6 +349,7 @@
add_compiler_flag_if_supported("-Wstring-conversion")
add_compiler_flag_if_supported("-Wtype-limits")
add_compiler_flag_if_supported("-Wuninitialized")
+ add_compiler_flag_if_supported("-Wunreachable-code-aggressive")
add_compiler_flag_if_supported("-Wunused")
add_compiler_flag_if_supported("-Wvla")
add_cxx_flag_if_supported("-Wc++14-extensions")
diff --git a/common/tools_common.c b/common/tools_common.c
index 114e635..afe4619 100644
--- a/common/tools_common.c
+++ b/common/tools_common.c
@@ -309,7 +309,7 @@
case AOM_IMG_FMT_I42016:
case AOM_IMG_FMT_I42216:
case AOM_IMG_FMT_I44416: break;
- default: fatal("Unsupported image conversion"); break;
+ default: fatal("Unsupported image conversion");
}
for (plane = 0; plane < 3; plane++) {
int w = src->d_w;
@@ -345,7 +345,7 @@
case AOM_IMG_FMT_I420:
case AOM_IMG_FMT_I422:
case AOM_IMG_FMT_I444: break;
- default: fatal("Unsupported image conversion"); break;
+ default: fatal("Unsupported image conversion");
}
for (plane = 0; plane < 3; plane++) {
int w = src->d_w;
@@ -386,7 +386,7 @@
case AOM_IMG_FMT_I420:
case AOM_IMG_FMT_I422:
case AOM_IMG_FMT_I444: break;
- default: fatal("Unsupported image conversion"); break;
+ default: fatal("Unsupported image conversion");
}
for (plane = 0; plane < 3; plane++) {
int w = src->d_w;
@@ -420,7 +420,7 @@
case AOM_IMG_FMT_I42016:
case AOM_IMG_FMT_I42216:
case AOM_IMG_FMT_I44416: break;
- default: fatal("Unsupported image conversion"); break;
+ default: fatal("Unsupported image conversion");
}
for (plane = 0; plane < 3; plane++) {
int w = src->d_w;
@@ -453,7 +453,7 @@
case AOM_IMG_FMT_I420:
case AOM_IMG_FMT_I422:
case AOM_IMG_FMT_I444: break;
- default: fatal("Unsupported image conversion"); break;
+ default: fatal("Unsupported image conversion");
}
for (plane = 0; plane < 3; plane++) {
int w = src->d_w;
diff --git a/examples/inspect.c b/examples/inspect.c
index 8e7213a..ed77b5d 100644
--- a/examples/inspect.c
+++ b/examples/inspect.c
@@ -509,7 +509,6 @@
int r, c, t, i;
if (compress && len == 1) {
die("Can't encode scalars as arrays when RLE compression is enabled.");
- return -1;
}
if (map) {
buf += snprintf(buf, MAX_BUFFER, " \"%sMap\": {", name);
diff --git a/examples/lightfield_bitstream_parsing.c b/examples/lightfield_bitstream_parsing.c
index 66e9993..05272ba 100644
--- a/examples/lightfield_bitstream_parsing.c
+++ b/examples/lightfield_bitstream_parsing.c
@@ -92,7 +92,6 @@
case AOM_IMG_FMT_I44416: return 48;
default: die("Invalid image format");
}
- return 0;
}
static void process_tile_list(const TILE_LIST_INFO *tiles, int num_tiles,
diff --git a/examples/svc_encoder_rtc.c b/examples/svc_encoder_rtc.c
index 77a123c..387f08e 100644
--- a/examples/svc_encoder_rtc.c
+++ b/examples/svc_encoder_rtc.c
@@ -347,7 +347,6 @@
break;
default:
die("Error: Invalid bit depth selected (%d)\n", enc_cfg->g_bit_depth);
- break;
}
#endif // CONFIG_VP9_HIGHBITDEPTH
} else if (arg_match(&arg, &dropframe_thresh_arg, argi)) {
diff --git a/test/noise_model_test.cc b/test/noise_model_test.cc
index e9cf9e2..c169117 100644
--- a/test/noise_model_test.cc
+++ b/test/noise_model_test.cc
@@ -36,7 +36,6 @@
return sigma * (u * sqrt(-2.0 * log(s) / s));
}
}
- return 0;
}
// Synthesizes noise using the auto-regressive filter of the given lag,