Commit 5c99f4e4 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan

Fix all warnings about switch-case fallthrough

Replace 'fallthrough intended' comments with a dedicated macro
that the compiler can see (or remove those comments when they don't
provide value).

Change-Id: Ib6361e15ff078378921c9e2b654bff63cf497f5f
parent 3f1f1ddc
......@@ -43,6 +43,20 @@
extern "C" {
#endif
#if defined(__clang__) && defined(__has_warning)
#if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
#define AOM_FALLTHROUGH_INTENDED [[clang::fallthrough]] // NOLINT
#endif
#elif defined(__GNUC__) && __GNUC__ >= 7
#define AOM_FALLTHROUGH_INTENDED [[gnu::fallthrough]] // NOLINT
#endif
#ifndef AOM_FALLTHROUGH_INTENDED
#define AOM_FALLTHROUGH_INTENDED \
do { \
} while (0)
#endif
#define CDEF_MAX_STRENGTHS 16
#define REF_FRAMES_LOG2 3
......@@ -998,6 +1012,7 @@ static INLINE void update_ext_partition_context(MACROBLOCKD *xd, int mi_row,
switch (partition) {
case PARTITION_SPLIT:
if (bsize != BLOCK_8X8) break;
AOM_FALLTHROUGH_INTENDED;
case PARTITION_NONE:
case PARTITION_HORZ:
case PARTITION_VERT:
......
......@@ -3766,7 +3766,7 @@ static int gm_get_params_cost(const WarpedMotionParams *gm,
(1 << GM_ALPHA_PREC_BITS),
(gm->wmmat[5] >> GM_ALPHA_PREC_DIFF) - (1 << GM_ALPHA_PREC_BITS));
}
// Fallthrough intended
AOM_FALLTHROUGH_INTENDED;
case TRANSLATION:
trans_bits = (gm->wmtype == TRANSLATION)
? GM_ABS_TRANS_ONLY_BITS - !allow_hp
......@@ -3782,7 +3782,7 @@ static int gm_get_params_cost(const WarpedMotionParams *gm,
(1 << trans_bits) + 1, SUBEXPFIN_K,
(ref_gm->wmmat[1] >> trans_prec_diff),
(gm->wmmat[1] >> trans_prec_diff));
// Fallthrough intended
AOM_FALLTHROUGH_INTENDED;
case IDENTITY: break;
default: assert(0);
}
......
......@@ -110,11 +110,18 @@ static int32_t add_param_offset(int param_index, int32_t param_value,
static void force_wmtype(WarpedMotionParams *wm, TransformationType wmtype) {
switch (wmtype) {
case IDENTITY: wm->wmmat[0] = 0; wm->wmmat[1] = 0;
case IDENTITY:
wm->wmmat[0] = 0;
wm->wmmat[1] = 0;
AOM_FALLTHROUGH_INTENDED;
case TRANSLATION:
wm->wmmat[2] = 1 << WARPEDMODEL_PREC_BITS;
wm->wmmat[3] = 0;
case ROTZOOM: wm->wmmat[4] = -wm->wmmat[3]; wm->wmmat[5] = wm->wmmat[2];
AOM_FALLTHROUGH_INTENDED;
case ROTZOOM:
wm->wmmat[4] = -wm->wmmat[3];
wm->wmmat[5] = wm->wmmat[2];
AOM_FALLTHROUGH_INTENDED;
case AFFINE: wm->wmmat[6] = wm->wmmat[7] = 0; break;
default: assert(0);
}
......
......@@ -179,7 +179,6 @@ static void highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
// fallthrough intended
av1_fwd_txfm2d_4x4(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
case FLIPADST_DCT:
......@@ -187,7 +186,6 @@ static void highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
case FLIPADST_FLIPADST:
case ADST_FLIPADST:
case FLIPADST_ADST:
// fallthrough intended
av1_fwd_txfm2d_4x4(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
// use the c version for anything including identity for now
......@@ -198,7 +196,6 @@ static void highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
case V_FLIPADST:
case H_FLIPADST:
case IDTX:
// fallthrough intended
av1_fwd_txfm2d_4x4_c(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
default: assert(0);
......@@ -257,7 +254,6 @@ static void highbd_fwd_txfm_8x8(const int16_t *src_diff, tran_low_t *coeff,
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
// fallthrough intended
av1_fwd_txfm2d_8x8(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
case FLIPADST_DCT:
......@@ -265,7 +261,6 @@ static void highbd_fwd_txfm_8x8(const int16_t *src_diff, tran_low_t *coeff,
case FLIPADST_FLIPADST:
case ADST_FLIPADST:
case FLIPADST_ADST:
// fallthrough intended
av1_fwd_txfm2d_8x8(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
// use the c version for anything including identity for now
......@@ -276,7 +271,6 @@ static void highbd_fwd_txfm_8x8(const int16_t *src_diff, tran_low_t *coeff,
case V_FLIPADST:
case H_FLIPADST:
case IDTX:
// fallthrough intended
av1_fwd_txfm2d_8x8_c(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
default: assert(0);
......@@ -293,7 +287,6 @@ static void highbd_fwd_txfm_16x16(const int16_t *src_diff, tran_low_t *coeff,
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
// fallthrough intended
av1_fwd_txfm2d_16x16(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
case FLIPADST_DCT:
......@@ -301,7 +294,6 @@ static void highbd_fwd_txfm_16x16(const int16_t *src_diff, tran_low_t *coeff,
case FLIPADST_FLIPADST:
case ADST_FLIPADST:
case FLIPADST_ADST:
// fallthrough intended
av1_fwd_txfm2d_16x16(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
// use the c version for anything including identity for now
......@@ -312,7 +304,6 @@ static void highbd_fwd_txfm_16x16(const int16_t *src_diff, tran_low_t *coeff,
case V_FLIPADST:
case H_FLIPADST:
case IDTX:
// fallthrough intended
av1_fwd_txfm2d_16x16_c(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
default: assert(0);
......@@ -329,7 +320,6 @@ static void highbd_fwd_txfm_32x32(const int16_t *src_diff, tran_low_t *coeff,
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
// fallthrough intended
av1_fwd_txfm2d_32x32(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
case FLIPADST_DCT:
......@@ -337,7 +327,6 @@ static void highbd_fwd_txfm_32x32(const int16_t *src_diff, tran_low_t *coeff,
case FLIPADST_FLIPADST:
case ADST_FLIPADST:
case FLIPADST_ADST:
// fallthrough intended
av1_fwd_txfm2d_32x32(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
// use the c version for anything including identity for now
......@@ -348,7 +337,6 @@ static void highbd_fwd_txfm_32x32(const int16_t *src_diff, tran_low_t *coeff,
case V_FLIPADST:
case H_FLIPADST:
case IDTX:
// fallthrough intended
av1_fwd_txfm2d_32x32_c(src_diff, dst_coeff, diff_stride, tx_type, bd);
break;
default: assert(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment