bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. (#3157)
This commit is contained in:
parent
0267128aa4
commit
f432a3234f
|
@ -3616,7 +3616,7 @@ _build_callargs(PyCFuncPtrObject *self, PyObject *argtypes,
|
||||||
case (PARAMFLAG_FIN | PARAMFLAG_FOUT):
|
case (PARAMFLAG_FIN | PARAMFLAG_FOUT):
|
||||||
*pinoutmask |= (1 << i); /* mark as inout arg */
|
*pinoutmask |= (1 << i); /* mark as inout arg */
|
||||||
(*pnumretvals)++;
|
(*pnumretvals)++;
|
||||||
/* fall through to PARAMFLAG_FIN... */
|
/* fall through */
|
||||||
case 0:
|
case 0:
|
||||||
case PARAMFLAG_FIN:
|
case PARAMFLAG_FIN:
|
||||||
/* 'in' parameter. Copy it from inargs. */
|
/* 'in' parameter. Copy it from inargs. */
|
||||||
|
|
|
@ -499,7 +499,7 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **arg
|
||||||
if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
|
if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
|
||||||
goto no_keyword_error;
|
goto no_keyword_error;
|
||||||
}
|
}
|
||||||
/* fall through next case */
|
/* fall through */
|
||||||
|
|
||||||
case METH_VARARGS | METH_KEYWORDS:
|
case METH_VARARGS | METH_KEYWORDS:
|
||||||
{
|
{
|
||||||
|
@ -656,7 +656,7 @@ _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, PyObject *
|
||||||
if (nkwargs) {
|
if (nkwargs) {
|
||||||
goto no_keyword_error;
|
goto no_keyword_error;
|
||||||
}
|
}
|
||||||
/* fall through next case */
|
/* fall through */
|
||||||
|
|
||||||
case METH_VARARGS | METH_KEYWORDS:
|
case METH_VARARGS | METH_KEYWORDS:
|
||||||
{
|
{
|
||||||
|
|
|
@ -330,7 +330,7 @@ STRINGLIB(utf8_encoder)(PyObject *unicode,
|
||||||
case _Py_ERROR_REPLACE:
|
case _Py_ERROR_REPLACE:
|
||||||
memset(p, '?', endpos - startpos);
|
memset(p, '?', endpos - startpos);
|
||||||
p += (endpos - startpos);
|
p += (endpos - startpos);
|
||||||
/* fall through the ignore handler */
|
/* fall through */
|
||||||
case _Py_ERROR_IGNORE:
|
case _Py_ERROR_IGNORE:
|
||||||
i += (endpos - startpos - 1);
|
i += (endpos - startpos - 1);
|
||||||
break;
|
break;
|
||||||
|
@ -378,7 +378,7 @@ STRINGLIB(utf8_encoder)(PyObject *unicode,
|
||||||
}
|
}
|
||||||
startpos = k;
|
startpos = k;
|
||||||
assert(startpos < endpos);
|
assert(startpos < endpos);
|
||||||
/* fall through the default handler */
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
rep = unicode_encode_call_errorhandler(
|
rep = unicode_encode_call_errorhandler(
|
||||||
errors, &error_handler_obj, "utf-8", "surrogates not allowed",
|
errors, &error_handler_obj, "utf-8", "surrogates not allowed",
|
||||||
|
|
|
@ -1794,6 +1794,7 @@ unicode_dealloc(PyObject *unicode)
|
||||||
|
|
||||||
case SSTATE_INTERNED_IMMORTAL:
|
case SSTATE_INTERNED_IMMORTAL:
|
||||||
Py_FatalError("Immortal interned string died.");
|
Py_FatalError("Immortal interned string died.");
|
||||||
|
/* fall through */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Py_FatalError("Inconsistent interned string state.");
|
Py_FatalError("Inconsistent interned string state.");
|
||||||
|
@ -6778,7 +6779,7 @@ unicode_encode_ucs1(PyObject *unicode,
|
||||||
case _Py_ERROR_REPLACE:
|
case _Py_ERROR_REPLACE:
|
||||||
memset(str, '?', collend - collstart);
|
memset(str, '?', collend - collstart);
|
||||||
str += (collend - collstart);
|
str += (collend - collstart);
|
||||||
/* fall through ignore error handler */
|
/* fall through */
|
||||||
case _Py_ERROR_IGNORE:
|
case _Py_ERROR_IGNORE:
|
||||||
pos = collend;
|
pos = collend;
|
||||||
break;
|
break;
|
||||||
|
@ -6817,7 +6818,7 @@ unicode_encode_ucs1(PyObject *unicode,
|
||||||
break;
|
break;
|
||||||
collstart = pos;
|
collstart = pos;
|
||||||
assert(collstart != collend);
|
assert(collstart != collend);
|
||||||
/* fallback to general error handling */
|
/* fall through */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rep = unicode_encode_call_errorhandler(errors, &error_handler_obj,
|
rep = unicode_encode_call_errorhandler(errors, &error_handler_obj,
|
||||||
|
|
|
@ -1182,6 +1182,7 @@ ast_for_comp_op(struct compiling *c, const node *n)
|
||||||
return In;
|
return In;
|
||||||
if (strcmp(STR(n), "is") == 0)
|
if (strcmp(STR(n), "is") == 0)
|
||||||
return Is;
|
return Is;
|
||||||
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
PyErr_Format(PyExc_SystemError, "invalid comp_op: %s",
|
PyErr_Format(PyExc_SystemError, "invalid comp_op: %s",
|
||||||
STR(n));
|
STR(n));
|
||||||
|
@ -1196,6 +1197,7 @@ ast_for_comp_op(struct compiling *c, const node *n)
|
||||||
return NotIn;
|
return NotIn;
|
||||||
if (strcmp(STR(CHILD(n, 0)), "is") == 0)
|
if (strcmp(STR(CHILD(n, 0)), "is") == 0)
|
||||||
return IsNot;
|
return IsNot;
|
||||||
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
PyErr_Format(PyExc_SystemError, "invalid comp_op: %s %s",
|
PyErr_Format(PyExc_SystemError, "invalid comp_op: %s %s",
|
||||||
STR(CHILD(n, 0)), STR(CHILD(n, 1)));
|
STR(CHILD(n, 0)), STR(CHILD(n, 1)));
|
||||||
|
@ -3147,6 +3149,7 @@ ast_for_flow_stmt(struct compiling *c, const node *n)
|
||||||
}
|
}
|
||||||
return Raise(expression, cause, LINENO(n), n->n_col_offset, c->c_arena);
|
return Raise(expression, cause, LINENO(n), n->n_col_offset, c->c_arena);
|
||||||
}
|
}
|
||||||
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
PyErr_Format(PyExc_SystemError,
|
PyErr_Format(PyExc_SystemError,
|
||||||
"unexpected flow_stmt: %d", TYPE(ch));
|
"unexpected flow_stmt: %d", TYPE(ch));
|
||||||
|
|
|
@ -1807,9 +1807,11 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
|
||||||
switch (oparg) {
|
switch (oparg) {
|
||||||
case 2:
|
case 2:
|
||||||
cause = POP(); /* cause */
|
cause = POP(); /* cause */
|
||||||
|
/* fall through */
|
||||||
case 1:
|
case 1:
|
||||||
exc = POP(); /* exc */
|
exc = POP(); /* exc */
|
||||||
case 0: /* Fallthrough */
|
/* fall through */
|
||||||
|
case 0:
|
||||||
if (do_raise(exc, cause)) {
|
if (do_raise(exc, cause)) {
|
||||||
why = WHY_EXCEPTION;
|
why = WHY_EXCEPTION;
|
||||||
goto fast_block_end;
|
goto fast_block_end;
|
||||||
|
|
|
@ -4154,6 +4154,7 @@ expr_constant(struct compiler *c, expr_ty e)
|
||||||
else if (o == Py_False)
|
else if (o == Py_False)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -4446,13 +4447,13 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
|
||||||
switch (e->v.Attribute.ctx) {
|
switch (e->v.Attribute.ctx) {
|
||||||
case AugLoad:
|
case AugLoad:
|
||||||
ADDOP(c, DUP_TOP);
|
ADDOP(c, DUP_TOP);
|
||||||
/* Fall through to load */
|
/* Fall through */
|
||||||
case Load:
|
case Load:
|
||||||
ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr, names);
|
ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr, names);
|
||||||
break;
|
break;
|
||||||
case AugStore:
|
case AugStore:
|
||||||
ADDOP(c, ROT_TWO);
|
ADDOP(c, ROT_TWO);
|
||||||
/* Fall through to save */
|
/* Fall through */
|
||||||
case Store:
|
case Store:
|
||||||
ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names);
|
ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1454,7 +1454,7 @@ _Py_dg_strtod(const char *s00, char **se)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '-':
|
case '-':
|
||||||
sign = 1;
|
sign = 1;
|
||||||
/* no break */
|
/* fall through */
|
||||||
case '+':
|
case '+':
|
||||||
c = *++s;
|
c = *++s;
|
||||||
}
|
}
|
||||||
|
@ -1523,7 +1523,7 @@ _Py_dg_strtod(const char *s00, char **se)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '-':
|
case '-':
|
||||||
esign = 1;
|
esign = 1;
|
||||||
/* no break */
|
/* fall through */
|
||||||
case '+':
|
case '+':
|
||||||
c = *++s;
|
c = *++s;
|
||||||
}
|
}
|
||||||
|
@ -2441,7 +2441,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
leftright = 0;
|
leftright = 0;
|
||||||
/* no break */
|
/* fall through */
|
||||||
case 4:
|
case 4:
|
||||||
if (ndigits <= 0)
|
if (ndigits <= 0)
|
||||||
ndigits = 1;
|
ndigits = 1;
|
||||||
|
@ -2449,7 +2449,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
leftright = 0;
|
leftright = 0;
|
||||||
/* no break */
|
/* fall through */
|
||||||
case 5:
|
case 5:
|
||||||
i = ndigits + k + 1;
|
i = ndigits + k + 1;
|
||||||
ilim = i;
|
ilim = i;
|
||||||
|
|
|
@ -312,6 +312,7 @@ parse_internal_render_format_spec(PyObject *format_spec,
|
||||||
format->thousands_separators = LT_UNDER_FOUR_LOCALE;
|
format->thousands_separators = LT_UNDER_FOUR_LOCALE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
invalid_comma_type(format->type);
|
invalid_comma_type(format->type);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2304,8 +2304,8 @@ skipitem(const char **p_format, va_list *p_va, int flags)
|
||||||
/* after 'e', only 's' and 't' is allowed */
|
/* after 'e', only 's' and 't' is allowed */
|
||||||
goto err;
|
goto err;
|
||||||
format++;
|
format++;
|
||||||
/* explicit fallthrough to string cases */
|
|
||||||
}
|
}
|
||||||
|
/* fall through */
|
||||||
|
|
||||||
case 's': /* string */
|
case 's': /* string */
|
||||||
case 'z': /* string or None */
|
case 'z': /* string or None */
|
||||||
|
|
|
@ -1112,6 +1112,7 @@ r_object(RFILE *p)
|
||||||
|
|
||||||
case TYPE_ASCII_INTERNED:
|
case TYPE_ASCII_INTERNED:
|
||||||
is_interned = 1;
|
is_interned = 1;
|
||||||
|
/* fall through */
|
||||||
case TYPE_ASCII:
|
case TYPE_ASCII:
|
||||||
n = r_long(p);
|
n = r_long(p);
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
|
@ -1124,6 +1125,7 @@ r_object(RFILE *p)
|
||||||
|
|
||||||
case TYPE_SHORT_ASCII_INTERNED:
|
case TYPE_SHORT_ASCII_INTERNED:
|
||||||
is_interned = 1;
|
is_interned = 1;
|
||||||
|
/* fall through */
|
||||||
case TYPE_SHORT_ASCII:
|
case TYPE_SHORT_ASCII:
|
||||||
n = r_byte(p);
|
n = r_byte(p);
|
||||||
if (n == EOF) {
|
if (n == EOF) {
|
||||||
|
@ -1149,6 +1151,7 @@ r_object(RFILE *p)
|
||||||
|
|
||||||
case TYPE_INTERNED:
|
case TYPE_INTERNED:
|
||||||
is_interned = 1;
|
is_interned = 1;
|
||||||
|
/* fall through */
|
||||||
case TYPE_UNICODE:
|
case TYPE_UNICODE:
|
||||||
{
|
{
|
||||||
const char *buffer;
|
const char *buffer;
|
||||||
|
|
|
@ -393,13 +393,13 @@ siphash24(const void *src, Py_ssize_t src_sz) {
|
||||||
pt = (uint8_t *)&t;
|
pt = (uint8_t *)&t;
|
||||||
m = (uint8_t *)in;
|
m = (uint8_t *)in;
|
||||||
switch (src_sz) {
|
switch (src_sz) {
|
||||||
case 7: pt[6] = m[6];
|
case 7: pt[6] = m[6]; /* fall through */
|
||||||
case 6: pt[5] = m[5];
|
case 6: pt[5] = m[5]; /* fall through */
|
||||||
case 5: pt[4] = m[4];
|
case 5: pt[4] = m[4]; /* fall through */
|
||||||
case 4: memcpy(pt, m, sizeof(uint32_t)); break;
|
case 4: memcpy(pt, m, sizeof(uint32_t)); break;
|
||||||
case 3: pt[2] = m[2];
|
case 3: pt[2] = m[2]; /* fall through */
|
||||||
case 2: pt[1] = m[1];
|
case 2: pt[1] = m[1]; /* fall through */
|
||||||
case 1: pt[0] = m[0];
|
case 1: pt[0] = m[0]; /* fall through */
|
||||||
}
|
}
|
||||||
b |= _le64toh(t);
|
b |= _le64toh(t);
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,13 @@ write_op_arg(_Py_CODEUNIT *codestr, unsigned char opcode,
|
||||||
switch (ilen) {
|
switch (ilen) {
|
||||||
case 4:
|
case 4:
|
||||||
*codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 24) & 0xff);
|
*codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 24) & 0xff);
|
||||||
|
/* fall through */
|
||||||
case 3:
|
case 3:
|
||||||
*codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 16) & 0xff);
|
*codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 16) & 0xff);
|
||||||
|
/* fall through */
|
||||||
case 2:
|
case 2:
|
||||||
*codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 8) & 0xff);
|
*codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 8) & 0xff);
|
||||||
|
/* fall through */
|
||||||
case 1:
|
case 1:
|
||||||
*codestr++ = PACKOPARG(opcode, oparg & 0xff);
|
*codestr++ = PACKOPARG(opcode, oparg & 0xff);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue