Skip to content

Commit 2a14b21

Browse files
AMarkovicralfbaechle
authored andcommitted
MIPS: math-emu: Mark fall throughs in switch statements with a comment
Mark intentional fall throughs in switch statements with a consistent comment. In most of the cases, a new comment line containing text "fall through" is inserted. In some of the cases, existing comment contained a variation of the text "fall through" (for example, "FALL THROUGH" or "drop through"). In such cases, the existing comment is modified to contain "fall through". Lastly, in two cases, code segments were described in comments as "fall througs", but were in reality "breaks out" of switch statement. In such cases, existing comments are accordingly modified. Apart from making code easier to follow and debug, this change enables some static code analysers to interpret newly inserted comments as their annotations (and, therefore, not issue warnings of type "fall through in switch statement", which is desireable, since marked fallthroughs are intentional). Signed-off-by: Aleksandar Markovic <[email protected]> Cc: Douglas Leung <[email protected]> Cc: Goran Ferenc <[email protected]> Cc: James Hogan <[email protected]> Cc: Maciej W. Rozycki <[email protected]> Cc: Manuel Lauss <[email protected]> Cc: Miodrag Dinic <[email protected]> Cc: Paul Burton <[email protected]> Cc: Petar Jovanovic <[email protected]> Cc: Raghu Gandham <[email protected]> Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/17588/ Signed-off-by: Ralf Baechle <[email protected]>
1 parent 6110050 commit 2a14b21

File tree

17 files changed

+38
-16
lines changed

17 files changed

+38
-16
lines changed

arch/mips/math-emu/cp1emu.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
451451
regs->cp0_epc + dec_insn.pc_inc +
452452
dec_insn.next_pc_inc;
453453
}
454-
/* Fall through */
454+
/* fall through */
455455
case jr_op:
456456
/* For R6, JR already emulated in jalr_op */
457457
if (NO_R6EMU && insn.r_format.func == jr_op)
@@ -471,10 +471,11 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
471471
regs->regs[31] = regs->cp0_epc +
472472
dec_insn.pc_inc +
473473
dec_insn.next_pc_inc;
474-
/* Fall through */
474+
/* fall through */
475475
case bltzl_op:
476476
if (NO_R6EMU)
477477
break;
478+
/* fall through */
478479
case bltz_op:
479480
if ((long)regs->regs[insn.i_format.rs] < 0)
480481
*contpc = regs->cp0_epc +
@@ -494,10 +495,11 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
494495
regs->regs[31] = regs->cp0_epc +
495496
dec_insn.pc_inc +
496497
dec_insn.next_pc_inc;
497-
/* Fall through */
498+
/* fall through */
498499
case bgezl_op:
499500
if (NO_R6EMU)
500501
break;
502+
/* fall through */
501503
case bgez_op:
502504
if ((long)regs->regs[insn.i_format.rs] >= 0)
503505
*contpc = regs->cp0_epc +
@@ -512,11 +514,12 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
512514
break;
513515
case jalx_op:
514516
set_isa16_mode(bit);
517+
/* fall through */
515518
case jal_op:
516519
regs->regs[31] = regs->cp0_epc +
517520
dec_insn.pc_inc +
518521
dec_insn.next_pc_inc;
519-
/* Fall through */
522+
/* fall through */
520523
case j_op:
521524
*contpc = regs->cp0_epc + dec_insn.pc_inc;
522525
*contpc >>= 28;
@@ -528,6 +531,7 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
528531
case beql_op:
529532
if (NO_R6EMU)
530533
break;
534+
/* fall through */
531535
case beq_op:
532536
if (regs->regs[insn.i_format.rs] ==
533537
regs->regs[insn.i_format.rt])
@@ -542,6 +546,7 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
542546
case bnel_op:
543547
if (NO_R6EMU)
544548
break;
549+
/* fall through */
545550
case bne_op:
546551
if (regs->regs[insn.i_format.rs] !=
547552
regs->regs[insn.i_format.rt])
@@ -556,6 +561,7 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
556561
case blezl_op:
557562
if (!insn.i_format.rt && NO_R6EMU)
558563
break;
564+
/* fall through */
559565
case blez_op:
560566

561567
/*
@@ -593,6 +599,7 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
593599
case bgtzl_op:
594600
if (!insn.i_format.rt && NO_R6EMU)
595601
break;
602+
/* fall through */
596603
case bgtz_op:
597604
/*
598605
* Compact branches for R6 for the
@@ -729,7 +736,8 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
729736

730737
return 1;
731738
}
732-
/* R2/R6 compatible cop1 instruction. Fall through */
739+
/* R2/R6 compatible cop1 instruction */
740+
/* fall through */
733741
case cop2_op:
734742
case cop1x_op:
735743
if (insn.i_format.rs == bc_op) {
@@ -1221,14 +1229,14 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
12211229
case bcfl_op:
12221230
if (cpu_has_mips_2_3_4_5_r)
12231231
likely = 1;
1224-
/* Fall through */
1232+
/* fall through */
12251233
case bcf_op:
12261234
cond = !cond;
12271235
break;
12281236
case bctl_op:
12291237
if (cpu_has_mips_2_3_4_5_r)
12301238
likely = 1;
1231-
/* Fall through */
1239+
/* fall through */
12321240
case bct_op:
12331241
break;
12341242
}

arch/mips/math-emu/dp_add.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y)
104104

105105
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
106106
DPDNORMX;
107-
108-
/* FALL THROUGH */
107+
/* fall through */
109108

110109
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
111110
DPDNORMY;

arch/mips/math-emu/dp_div.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y)
103103

104104
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
105105
DPDNORMX;
106+
/* fall through */
106107

107108
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
108109
DPDNORMY;

arch/mips/math-emu/dp_fmax.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ union ieee754dp ieee754dp_fmax(union ieee754dp x, union ieee754dp y)
9696

9797
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
9898
DPDNORMX;
99+
/* fall through */
99100

100101
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
101102
DPDNORMY;
@@ -224,6 +225,7 @@ union ieee754dp ieee754dp_fmaxa(union ieee754dp x, union ieee754dp y)
224225

225226
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
226227
DPDNORMX;
228+
/* fall through */
227229

228230
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
229231
DPDNORMY;

arch/mips/math-emu/dp_fmin.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ union ieee754dp ieee754dp_fmin(union ieee754dp x, union ieee754dp y)
9696

9797
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
9898
DPDNORMX;
99+
/* fall through */
99100

100101
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
101102
DPDNORMY;
@@ -224,6 +225,7 @@ union ieee754dp ieee754dp_fmina(union ieee754dp x, union ieee754dp y)
224225

225226
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
226227
DPDNORMX;
228+
/* fall through */
227229

228230
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
229231
DPDNORMY;

arch/mips/math-emu/dp_maddf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ static union ieee754dp _dp_maddf(union ieee754dp z, union ieee754dp x,
157157

158158
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
159159
DPDNORMX;
160+
/* fall through */
160161

161162
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
162163
if (zc == IEEE754_CLASS_INF)
@@ -173,7 +174,7 @@ static union ieee754dp _dp_maddf(union ieee754dp z, union ieee754dp x,
173174
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
174175
if (zc == IEEE754_CLASS_INF)
175176
return ieee754dp_inf(zs);
176-
/* fall through to real computations */
177+
/* continue to real computations */
177178
}
178179

179180
/* Finally get to do some computation */

arch/mips/math-emu/dp_mul.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y)
101101

102102
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
103103
DPDNORMX;
104+
/* fall through */
104105

105106
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
106107
DPDNORMY;

arch/mips/math-emu/dp_sqrt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
142142
switch (oldcsr.rm) {
143143
case FPU_CSR_RU:
144144
y.bits += 1;
145-
/* drop through */
145+
/* fall through */
146146
case FPU_CSR_RN:
147147
t.bits += 1;
148148
break;

arch/mips/math-emu/dp_sub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y)
106106

107107
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
108108
DPDNORMX;
109-
/* FALL THROUGH */
109+
/* fall through */
110110

111111
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
112112
/* normalize ym,ye */

arch/mips/math-emu/sp_add.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y)
104104

105105
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
106106
SPDNORMX;
107-
108-
/* FALL THROUGH */
107+
/* fall through */
109108

110109
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
111110
SPDNORMY;

arch/mips/math-emu/sp_div.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y)
103103

104104
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
105105
SPDNORMX;
106+
/* fall through */
106107

107108
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
108109
SPDNORMY;

arch/mips/math-emu/sp_fdp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ union ieee754sp ieee754sp_fdp(union ieee754dp x)
4646
case IEEE754_CLASS_SNAN:
4747
x = ieee754dp_nanxcpt(x);
4848
EXPLODEXDP;
49-
/* Fall through. */
49+
/* fall through */
50+
5051
case IEEE754_CLASS_QNAN:
5152
y = ieee754sp_nan_fdp(xs, xm);
5253
if (!ieee754_csr.nan2008) {

arch/mips/math-emu/sp_fmax.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ union ieee754sp ieee754sp_fmax(union ieee754sp x, union ieee754sp y)
9696

9797
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
9898
SPDNORMX;
99+
/* fall through */
99100

100101
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
101102
SPDNORMY;
@@ -224,6 +225,7 @@ union ieee754sp ieee754sp_fmaxa(union ieee754sp x, union ieee754sp y)
224225

225226
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
226227
SPDNORMX;
228+
/* fall through */
227229

228230
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
229231
SPDNORMY;

arch/mips/math-emu/sp_fmin.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ union ieee754sp ieee754sp_fmin(union ieee754sp x, union ieee754sp y)
9696

9797
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
9898
SPDNORMX;
99+
/* fall through */
99100

100101
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
101102
SPDNORMY;
@@ -224,6 +225,7 @@ union ieee754sp ieee754sp_fmina(union ieee754sp x, union ieee754sp y)
224225

225226
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
226227
SPDNORMX;
228+
/* fall through */
227229

228230
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
229231
SPDNORMY;

arch/mips/math-emu/sp_maddf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ static union ieee754sp _sp_maddf(union ieee754sp z, union ieee754sp x,
126126

127127
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
128128
SPDNORMX;
129+
/* fall through */
129130

130131
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
131132
if (zc == IEEE754_CLASS_INF)
@@ -142,7 +143,7 @@ static union ieee754sp _sp_maddf(union ieee754sp z, union ieee754sp x,
142143
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
143144
if (zc == IEEE754_CLASS_INF)
144145
return ieee754sp_inf(zs);
145-
/* fall through to real computations */
146+
/* continue to real computations */
146147
}
147148

148149
/* Finally get to do some computation */

arch/mips/math-emu/sp_mul.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y)
101101

102102
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
103103
SPDNORMX;
104+
/* fall through */
104105

105106
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
106107
SPDNORMY;

arch/mips/math-emu/sp_sub.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y)
106106

107107
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
108108
SPDNORMX;
109+
/* fall through */
109110

110111
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
111112
SPDNORMY;

0 commit comments

Comments
 (0)