Fix Clang -Wunreachable-code-aggressive warnings
Based on the change in libaom: fe36011455 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 libvpx could be compiled without -Wunreachable-code-aggressive warnings. This requires the VPX_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
This commit is contained in:
@@ -135,7 +135,6 @@ unsigned int arg_parse_uint(const struct arg *arg) {
|
||||
}
|
||||
|
||||
die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int arg_parse_int(const struct arg *arg) {
|
||||
@@ -152,7 +151,6 @@ int arg_parse_int(const struct arg *arg) {
|
||||
}
|
||||
|
||||
die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct vpx_rational {
|
||||
@@ -209,7 +207,6 @@ int arg_parse_enum(const struct arg *arg) {
|
||||
if (!strcmp(arg->val, listptr->name)) return listptr->val;
|
||||
|
||||
die("Option %s: Invalid value '%s'\n", arg->name, arg->val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int arg_parse_enum_or_int(const struct arg *arg) {
|
||||
|
||||
@@ -651,7 +651,7 @@ process_toolchain() {
|
||||
check_add_cflags -Wmissing-prototypes
|
||||
check_add_cflags -Wshadow
|
||||
check_add_cflags -Wuninitialized
|
||||
check_add_cflags -Wunreachable-code-loop-increment
|
||||
check_add_cflags -Wunreachable-code-aggressive
|
||||
check_add_cflags -Wunused
|
||||
check_add_cflags -Wextra
|
||||
# check_add_cflags also adds to cxxflags. gtest does not do well with
|
||||
|
||||
@@ -316,7 +316,6 @@ static void parse_command_line(int argc, const char **argv_,
|
||||
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)) {
|
||||
|
||||
@@ -76,7 +76,7 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
|
||||
case TX_8X8: size_ = 8; break;
|
||||
case TX_16X16: size_ = 16; break;
|
||||
case TX_32X32: size_ = 32; break;
|
||||
default: FAIL() << "Wrong Size!"; break;
|
||||
default: FAIL() << "Wrong Size!";
|
||||
}
|
||||
|
||||
// Randomize stride_ to a value less than or equal to 1024
|
||||
|
||||
@@ -227,7 +227,7 @@ class RcInterfaceSvcTest
|
||||
rc_cfg_.layer_target_bitrate[4] = 0;
|
||||
rc_cfg_.layer_target_bitrate[5] = 0;
|
||||
ASSERT_TRUE(rc_api_->UpdateRateControl(rc_cfg_));
|
||||
} else if (0 && video->frame() == 280) {
|
||||
} else if (/*DISABLES CODE*/ (0) && video->frame() == 280) {
|
||||
// TODO(marpan): Re-enable this going back up when issue is fixed.
|
||||
// Go back up to 3 spatial layers.
|
||||
// Update the encoder config: use the original bitrates.
|
||||
|
||||
+5
-5
@@ -375,7 +375,7 @@ static void highbd_img_upshift(vpx_image_t *dst, vpx_image_t *src,
|
||||
case VPX_IMG_FMT_I42216:
|
||||
case VPX_IMG_FMT_I44416:
|
||||
case VPX_IMG_FMT_I44016: break;
|
||||
default: fatal("Unsupported image conversion"); break;
|
||||
default: fatal("Unsupported image conversion");
|
||||
}
|
||||
for (plane = 0; plane < 3; plane++) {
|
||||
int w = src->d_w;
|
||||
@@ -411,7 +411,7 @@ static void lowbd_img_upshift(vpx_image_t *dst, vpx_image_t *src,
|
||||
case VPX_IMG_FMT_I422:
|
||||
case VPX_IMG_FMT_I444:
|
||||
case VPX_IMG_FMT_I440: break;
|
||||
default: fatal("Unsupported image conversion"); break;
|
||||
default: fatal("Unsupported image conversion");
|
||||
}
|
||||
for (plane = 0; plane < 3; plane++) {
|
||||
int w = src->d_w;
|
||||
@@ -452,7 +452,7 @@ void vpx_img_truncate_16_to_8(vpx_image_t *dst, vpx_image_t *src) {
|
||||
case VPX_IMG_FMT_I422:
|
||||
case VPX_IMG_FMT_I444:
|
||||
case VPX_IMG_FMT_I440: break;
|
||||
default: fatal("Unsupported image conversion"); break;
|
||||
default: fatal("Unsupported image conversion");
|
||||
}
|
||||
for (plane = 0; plane < 3; plane++) {
|
||||
int w = src->d_w;
|
||||
@@ -487,7 +487,7 @@ static void highbd_img_downshift(vpx_image_t *dst, vpx_image_t *src,
|
||||
case VPX_IMG_FMT_I42216:
|
||||
case VPX_IMG_FMT_I44416:
|
||||
case VPX_IMG_FMT_I44016: break;
|
||||
default: fatal("Unsupported image conversion"); break;
|
||||
default: fatal("Unsupported image conversion");
|
||||
}
|
||||
for (plane = 0; plane < 3; plane++) {
|
||||
int w = src->d_w;
|
||||
@@ -521,7 +521,7 @@ static void lowbd_img_downshift(vpx_image_t *dst, vpx_image_t *src,
|
||||
case VPX_IMG_FMT_I422:
|
||||
case VPX_IMG_FMT_I444:
|
||||
case VPX_IMG_FMT_I440: break;
|
||||
default: fatal("Unsupported image conversion"); break;
|
||||
default: fatal("Unsupported image conversion");
|
||||
}
|
||||
for (plane = 0; plane < 3; plane++) {
|
||||
int w = src->d_w;
|
||||
|
||||
@@ -1167,7 +1167,7 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
|
||||
if (pbi->ec_active && xd->corrupted) pc->refresh_last_frame = 1;
|
||||
#endif
|
||||
|
||||
if (0) {
|
||||
if (/*DISABLES CODE*/ (0)) {
|
||||
FILE *z = fopen("decodestats.stt", "a");
|
||||
fprintf(z, "%6d F:%d,G:%d,A:%d,L:%d,Q:%d\n", pc->current_video_frame,
|
||||
pc->frame_type, pc->refresh_golden_frame, pc->refresh_alt_ref_frame,
|
||||
|
||||
@@ -822,7 +822,7 @@ void vp8_first_pass(VP8_COMP *cpi) {
|
||||
}
|
||||
|
||||
/* use this to see what the first pass reconstruction looks like */
|
||||
if (0) {
|
||||
if (/*DISABLES CODE*/ (0)) {
|
||||
char filename[512];
|
||||
FILE *recon_file;
|
||||
sprintf(filename, "enc%04d.yuv", (int)cm->current_video_frame);
|
||||
@@ -1038,7 +1038,7 @@ static int estimate_cq(VP8_COMP *cpi, FIRSTPASS_STATS *fpstats,
|
||||
double clip_iifactor;
|
||||
int overhead_bits_per_mb;
|
||||
|
||||
if (0) {
|
||||
if (/*DISABLES CODE*/ (0)) {
|
||||
FILE *f = fopen("epmp.stt", "a");
|
||||
fprintf(f, "%10.2f\n", err_per_mb);
|
||||
fclose(f);
|
||||
@@ -1230,7 +1230,7 @@ static int estimate_kf_group_q(VP8_COMP *cpi, double section_err,
|
||||
Q++;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
if (/*DISABLES CODE*/ (0)) {
|
||||
FILE *f = fopen("estkf_q.stt", "a");
|
||||
fprintf(f, "%8d %8d %8d %8.2f %8.3f %8.2f %8.3f %8.3f %8.3f %8d\n",
|
||||
cpi->common.current_video_frame, bits_per_mb_at_this_q,
|
||||
@@ -3047,7 +3047,7 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
||||
(int)((projected_bits_perframe - av_bits_per_frame) *
|
||||
cpi->twopass.frames_to_key));
|
||||
|
||||
if (0) {
|
||||
if (/*DISABLES CODE*/ (0)) {
|
||||
FILE *f = fopen("Subsamle.stt", "a");
|
||||
fprintf(f, " %8d %8d %8d %8d %12.0f %8d %8d %8d\n",
|
||||
cpi->common.current_video_frame, kf_q, cpi->common.horiz_scale,
|
||||
@@ -3121,7 +3121,7 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
||||
kf_q = estimate_kf_group_q(cpi, err_per_frame * effective_size_ratio,
|
||||
(int)bits_per_frame, group_iiratio);
|
||||
|
||||
if (0) {
|
||||
if (/*DISABLES CODE*/ (0)) {
|
||||
FILE *f = fopen("Subsamle.stt", "a");
|
||||
fprintf(
|
||||
f, "******** %8d %8d %8d %12.0f %8d %8d %8d\n", kf_q,
|
||||
|
||||
@@ -131,7 +131,6 @@ static int extrc_get_frame_type(FRAME_UPDATE_TYPE update_type) {
|
||||
default:
|
||||
fprintf(stderr, "Unsupported update_type %d\n", update_type);
|
||||
abort();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +364,6 @@ static vpx_variance_fn_t highbd_get_block_variance_fn(BLOCK_SIZE bsize,
|
||||
case BLOCK_8X16: return vpx_highbd_8_mse8x16;
|
||||
default: return vpx_highbd_8_mse16x16;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
switch (bsize) {
|
||||
case BLOCK_8X8: return vpx_highbd_10_mse8x8;
|
||||
@@ -372,7 +371,6 @@ static vpx_variance_fn_t highbd_get_block_variance_fn(BLOCK_SIZE bsize,
|
||||
case BLOCK_8X16: return vpx_highbd_10_mse8x16;
|
||||
default: return vpx_highbd_10_mse16x16;
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
switch (bsize) {
|
||||
case BLOCK_8X8: return vpx_highbd_12_mse8x8;
|
||||
@@ -380,7 +378,6 @@ static vpx_variance_fn_t highbd_get_block_variance_fn(BLOCK_SIZE bsize,
|
||||
case BLOCK_8X16: return vpx_highbd_12_mse8x16;
|
||||
default: return vpx_highbd_12_mse16x16;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1508,7 +1505,7 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) {
|
||||
}
|
||||
|
||||
// Use this to see what the first pass reconstruction looks like.
|
||||
if (0) {
|
||||
if (/*DISABLES CODE*/ (0)) {
|
||||
char filename[512];
|
||||
FILE *recon_file;
|
||||
snprintf(filename, sizeof(filename), "enc%04d.yuv",
|
||||
|
||||
@@ -333,23 +333,16 @@ static void separate_arf_mbs(VP9_COMP *cpi) {
|
||||
}
|
||||
}
|
||||
|
||||
// Only bother with segmentation if over 10% of the MBs in static segment
|
||||
// if ( ncnt[1] && (ncnt[0] / ncnt[1] < 10) )
|
||||
if (1) {
|
||||
// Note % of blocks that are marked as static
|
||||
if (cm->MBs)
|
||||
cpi->static_mb_pct = (ncnt[1] * 100) / (cm->mi_rows * cm->mi_cols);
|
||||
// Note % of blocks that are marked as static
|
||||
if (cm->MBs)
|
||||
cpi->static_mb_pct = (ncnt[1] * 100) / (cm->mi_rows * cm->mi_cols);
|
||||
|
||||
// This error case should not be reachable as this function should
|
||||
// never be called with the common data structure uninitialized.
|
||||
else
|
||||
cpi->static_mb_pct = 0;
|
||||
|
||||
vp9_enable_segmentation(&cm->seg);
|
||||
} else {
|
||||
// This error case should not be reachable as this function should
|
||||
// never be called with the common data structure uninitialized.
|
||||
else
|
||||
cpi->static_mb_pct = 0;
|
||||
vp9_disable_segmentation(&cm->seg);
|
||||
}
|
||||
|
||||
vp9_enable_segmentation(&cm->seg);
|
||||
|
||||
// Free localy allocated storage
|
||||
vpx_free(arf_not_zz);
|
||||
|
||||
@@ -143,7 +143,6 @@ get_frame_type_from_update_type(FRAME_UPDATE_TYPE update_type) {
|
||||
default:
|
||||
fprintf(stderr, "Unsupported update_type %d\n", update_type);
|
||||
abort();
|
||||
return kFrameTypeInter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -446,7 +446,7 @@ static void generate_filename(const char *pattern, char *out, size_t q_len,
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user