bpo-30923: Silence fall-through warnings included in -Wextra since gc… · python/cpython@f432a32 (original) (raw)

13 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -3616,7 +3616,7 @@ _build_callargs(PyCFuncPtrObject *self, PyObject *argtypes,
3616 3616 case (PARAMFLAG_FIN | PARAMFLAG_FOUT):
3617 3617 *pinoutmask |= (1 << i); /* mark as inout arg */
3618 3618 (*pnumretvals)++;
3619 -/* fall through to PARAMFLAG_FIN... */
3619 +/* fall through */
3620 3620 case 0:
3621 3621 case PARAMFLAG_FIN:
3622 3622 /* 'in' parameter. Copy it from inargs. */
Original file line number Diff line number Diff line change
@@ -499,7 +499,7 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **arg
499 499 if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
500 500 goto no_keyword_error;
501 501 }
502 -/* fall through next case */
502 +/* fall through */
503 503
504 504 case METH_VARARGS | METH_KEYWORDS:
505 505 {
@@ -656,7 +656,7 @@ _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, PyObject *
656 656 if (nkwargs) {
657 657 goto no_keyword_error;
658 658 }
659 -/* fall through next case */
659 +/* fall through */
660 660
661 661 case METH_VARARGS | METH_KEYWORDS:
662 662 {
Original file line number Diff line number Diff line change
@@ -330,7 +330,7 @@ STRINGLIB(utf8_encoder)(PyObject *unicode,
330 330 case _Py_ERROR_REPLACE:
331 331 memset(p, '?', endpos - startpos);
332 332 p += (endpos - startpos);
333 -/* fall through the ignore handler */
333 +/* fall through */
334 334 case _Py_ERROR_IGNORE:
335 335 i += (endpos - startpos - 1);
336 336 break;
@@ -378,7 +378,7 @@ STRINGLIB(utf8_encoder)(PyObject *unicode,
378 378 }
379 379 startpos = k;
380 380 assert(startpos < endpos);
381 -/* fall through the default handler */
381 +/* fall through */
382 382 default:
383 383 rep = unicode_encode_call_errorhandler(
384 384 errors, &error_handler_obj, "utf-8", "surrogates not allowed",
Original file line number Diff line number Diff line change
@@ -1794,6 +1794,7 @@ unicode_dealloc(PyObject *unicode)
1794 1794
1795 1795 case SSTATE_INTERNED_IMMORTAL:
1796 1796 Py_FatalError("Immortal interned string died.");
1797 +/* fall through */
1797 1798
1798 1799 default:
1799 1800 Py_FatalError("Inconsistent interned string state.");
@@ -6778,7 +6779,7 @@ unicode_encode_ucs1(PyObject *unicode,
6778 6779 case _Py_ERROR_REPLACE:
6779 6780 memset(str, '?', collend - collstart);
6780 6781 str += (collend - collstart);
6781 -/* fall through ignore error handler */
6782 +/* fall through */
6782 6783 case _Py_ERROR_IGNORE:
6783 6784 pos = collend;
6784 6785 break;
@@ -6817,7 +6818,7 @@ unicode_encode_ucs1(PyObject *unicode,
6817 6818 break;
6818 6819 collstart = pos;
6819 6820 assert(collstart != collend);
6820 -/* fallback to general error handling */
6821 +/* fall through */
6821 6822
6822 6823 default:
6823 6824 rep = unicode_encode_call_errorhandler(errors, &error_handler_obj,
Original file line number Diff line number Diff line change
@@ -1182,6 +1182,7 @@ ast_for_comp_op(struct compiling *c, const node *n)
1182 1182 return In;
1183 1183 if (strcmp(STR(n), "is") == 0)
1184 1184 return Is;
1185 +/* fall through */
1185 1186 default:
1186 1187 PyErr_Format(PyExc_SystemError, "invalid comp_op: %s",
1187 1188 STR(n));
@@ -1196,6 +1197,7 @@ ast_for_comp_op(struct compiling *c, const node *n)
1196 1197 return NotIn;
1197 1198 if (strcmp(STR(CHILD(n, 0)), "is") == 0)
1198 1199 return IsNot;
1200 +/* fall through */
1199 1201 default:
1200 1202 PyErr_Format(PyExc_SystemError, "invalid comp_op: %s %s",
1201 1203 STR(CHILD(n, 0)), STR(CHILD(n, 1)));
@@ -3147,6 +3149,7 @@ ast_for_flow_stmt(struct compiling *c, const node *n)
3147 3149 }
3148 3150 return Raise(expression, cause, LINENO(n), n->n_col_offset, c->c_arena);
3149 3151 }
3152 +/* fall through */
3150 3153 default:
3151 3154 PyErr_Format(PyExc_SystemError,
3152 3155 "unexpected flow_stmt: %d", TYPE(ch));
Original file line number Diff line number Diff line change
@@ -1807,9 +1807,11 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
1807 1807 switch (oparg) {
1808 1808 case 2:
1809 1809 cause = POP(); /* cause */
1810 +/* fall through */
1810 1811 case 1:
1811 1812 exc = POP(); /* exc */
1812 -case 0: /* Fallthrough */
1813 +/* fall through */
1814 +case 0:
1813 1815 if (do_raise(exc, cause)) {
1814 1816 why = WHY_EXCEPTION;
1815 1817 goto fast_block_end;
Original file line number Diff line number Diff line change
@@ -4154,6 +4154,7 @@ expr_constant(struct compiler *c, expr_ty e)
4154 4154 else if (o == Py_False)
4155 4155 return 0;
4156 4156 }
4157 +/* fall through */
4157 4158 default:
4158 4159 return -1;
4159 4160 }
@@ -4446,13 +4447,13 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
4446 4447 switch (e->v.Attribute.ctx) {
4447 4448 case AugLoad:
4448 4449 ADDOP(c, DUP_TOP);
4449 -/* Fall through to load */
4450 +/* Fall through */
4450 4451 case Load:
4451 4452 ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr, names);
4452 4453 break;
4453 4454 case AugStore:
4454 4455 ADDOP(c, ROT_TWO);
4455 -/* Fall through to save */
4456 +/* Fall through */
4456 4457 case Store:
4457 4458 ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names);
4458 4459 break;
Original file line number Diff line number Diff line change
@@ -1454,7 +1454,7 @@ _Py_dg_strtod(const char *s00, char **se)
1454 1454 switch (c) {
1455 1455 case '-':
1456 1456 sign = 1;
1457 -/* no break */
1457 +/* fall through */
1458 1458 case '+':
1459 1459 c = *++s;
1460 1460 }
@@ -1523,7 +1523,7 @@ _Py_dg_strtod(const char *s00, char **se)
1523 1523 switch (c) {
1524 1524 case '-':
1525 1525 esign = 1;
1526 -/* no break */
1526 +/* fall through */
1527 1527 case '+':
1528 1528 c = *++s;
1529 1529 }
@@ -2441,15 +2441,15 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
2441 2441 break;
2442 2442 case 2:
2443 2443 leftright = 0;
2444 -/* no break */
2444 +/* fall through */
2445 2445 case 4:
2446 2446 if (ndigits <= 0)
2447 2447 ndigits = 1;
2448 2448 ilim = ilim1 = i = ndigits;
2449 2449 break;
2450 2450 case 3:
2451 2451 leftright = 0;
2452 -/* no break */
2452 +/* fall through */
2453 2453 case 5:
2454 2454 i = ndigits + k + 1;
2455 2455 ilim = i;
Original file line number Diff line number Diff line change
@@ -312,6 +312,7 @@ parse_internal_render_format_spec(PyObject *format_spec,
312 312 format->thousands_separators = LT_UNDER_FOUR_LOCALE;
313 313 break;
314 314 }
315 +/* fall through */
315 316 default:
316 317 invalid_comma_type(format->type);
317 318 return 0;
Original file line number Diff line number Diff line change
@@ -2304,8 +2304,8 @@ skipitem(const char **p_format, va_list *p_va, int flags)
2304 2304 /* after 'e', only 's' and 't' is allowed */
2305 2305 goto err;
2306 2306 format++;
2307 -/* explicit fallthrough to string cases */
2308 2307 }
2308 +/* fall through */
2309 2309
2310 2310 case 's': /* string */
2311 2311 case 'z': /* string or None */
Original file line number Diff line number Diff line change
@@ -1112,6 +1112,7 @@ r_object(RFILE *p)
1112 1112
1113 1113 case TYPE_ASCII_INTERNED:
1114 1114 is_interned = 1;
1115 +/* fall through */
1115 1116 case TYPE_ASCII:
1116 1117 n = r_long(p);
1117 1118 if (PyErr_Occurred())
@@ -1124,6 +1125,7 @@ r_object(RFILE *p)
1124 1125
1125 1126 case TYPE_SHORT_ASCII_INTERNED:
1126 1127 is_interned = 1;
1128 +/* fall through */
1127 1129 case TYPE_SHORT_ASCII:
1128 1130 n = r_byte(p);
1129 1131 if (n == EOF) {
@@ -1149,6 +1151,7 @@ r_object(RFILE *p)
1149 1151
1150 1152 case TYPE_INTERNED:
1151 1153 is_interned = 1;
1154 +/* fall through */
1152 1155 case TYPE_UNICODE:
1153 1156 {
1154 1157 const char *buffer;
Original file line number Diff line number Diff line change
@@ -393,13 +393,13 @@ siphash24(const void *src, Py_ssize_t src_sz) {
393 393 pt = (uint8_t *)&t;
394 394 m = (uint8_t *)in;
395 395 switch (src_sz) {
396 -case 7: pt[6] = m[6];
397 -case 6: pt[5] = m[5];
398 -case 5: pt[4] = m[4];
396 +case 7: pt[6] = m[6]; /* fall through */
397 +case 6: pt[5] = m[5]; /* fall through */
398 +case 5: pt[4] = m[4]; /* fall through */
399 399 case 4: memcpy(pt, m, sizeof(uint32_t)); break;
400 -case 3: pt[2] = m[2];
401 -case 2: pt[1] = m[1];
402 -case 1: pt[0] = m[0];
400 +case 3: pt[2] = m[2]; /* fall through */
401 +case 2: pt[1] = m[1]; /* fall through */
402 +case 1: pt[0] = m[0]; /* fall through */
403 403 }
404 404 b |= _le64toh(t);
405 405
Original file line number Diff line number Diff line change
@@ -28,10 +28,13 @@ write_op_arg(_Py_CODEUNIT *codestr, unsigned char opcode,
28 28 switch (ilen) {
29 29 case 4:
30 30 *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 24) & 0xff);
31 +/* fall through */
31 32 case 3:
32 33 *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 16) & 0xff);
34 +/* fall through */
33 35 case 2:
34 36 *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 8) & 0xff);
37 +/* fall through */
35 38 case 1:
36 39 *codestr++ = PACKOPARG(opcode, oparg & 0xff);
37 40 break;