summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-09-12 23:09:44 (GMT)
committerGitHub <noreply@github.com>2017-09-12 23:09:44 (GMT)
commitc0e77364ca29df6cfb311e79892955c92bd8e595 (patch)
tree17f4a3d23ff42877420078441f2534d427fb21c0 /Python
parent5013a5ebc9978a58435036fa3860c465882c21da (diff)
downloadcpython-c0e77364ca29df6cfb311e79892955c92bd8e595.zip
cpython-c0e77364ca29df6cfb311e79892955c92bd8e595.tar.gz
cpython-c0e77364ca29df6cfb311e79892955c92bd8e595.tar.bz2
[3.6] bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0 (#3518)
* bpo-30923: Disable warning that has been part of -Wextra since gcc-7.0. (#3142) (cherry picked from commit d73a960c575207539c3f9765cff26d4fff400b45) * bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. (#3157) (cherry picked from commit f432a3234f9f2ee09bd40be03e06bf72865ee375) * bpo-31275: Small refactoring to silence a fall-through warning. (#3206) (cherry picked from commit 138753c1b96b5e06a5c5d409fa4cae5e2fe1108b)
Diffstat (limited to 'Python')
-rw-r--r--Python/ast.c3
-rw-r--r--Python/ceval.c4
-rw-r--r--Python/compile.c5
-rw-r--r--Python/dtoa.c8
-rw-r--r--Python/formatter_unicode.c1
-rw-r--r--Python/getargs.c2
-rw-r--r--Python/marshal.c3
-rw-r--r--Python/pyhash.c12
-rw-r--r--Python/wordcode_helpers.h3
9 files changed, 27 insertions, 14 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 4fa68a3..aa4acc9 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -1175,6 +1175,7 @@ ast_for_comp_op(struct compiling *c, const node *n)
return In;
if (strcmp(STR(n), "is") == 0)
return Is;
+ /* fall through */
default:
PyErr_Format(PyExc_SystemError, "invalid comp_op: %s",
STR(n));
@@ -1189,6 +1190,7 @@ ast_for_comp_op(struct compiling *c, const node *n)
return NotIn;
if (strcmp(STR(CHILD(n, 0)), "is") == 0)
return IsNot;
+ /* fall through */
default:
PyErr_Format(PyExc_SystemError, "invalid comp_op: %s %s",
STR(CHILD(n, 0)), STR(CHILD(n, 1)));
@@ -3149,6 +3151,7 @@ ast_for_flow_stmt(struct compiling *c, const node *n)
}
return Raise(expression, cause, LINENO(n), n->n_col_offset, c->c_arena);
}
+ /* fall through */
default:
PyErr_Format(PyExc_SystemError,
"unexpected flow_stmt: %d", TYPE(ch));
diff --git a/Python/ceval.c b/Python/ceval.c
index 2b74d0e..b6ad444 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1875,9 +1875,11 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
switch (oparg) {
case 2:
cause = POP(); /* cause */
+ /* fall through */
case 1:
exc = POP(); /* exc */
- case 0: /* Fallthrough */
+ /* fall through */
+ case 0:
if (do_raise(exc, cause)) {
why = WHY_EXCEPTION;
goto fast_block_end;
diff --git a/Python/compile.c b/Python/compile.c
index 6255ec7..797a184 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -4069,6 +4069,7 @@ expr_constant(struct compiler *c, expr_ty e)
else if (o == Py_False)
return 0;
}
+ /* fall through */
default:
return -1;
}
@@ -4361,13 +4362,13 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
switch (e->v.Attribute.ctx) {
case AugLoad:
ADDOP(c, DUP_TOP);
- /* Fall through to load */
+ /* Fall through */
case Load:
ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr, names);
break;
case AugStore:
ADDOP(c, ROT_TWO);
- /* Fall through to save */
+ /* Fall through */
case Store:
ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names);
break;
diff --git a/Python/dtoa.c b/Python/dtoa.c
index efcadc3..01ca9b0 100644
--- a/Python/dtoa.c
+++ b/Python/dtoa.c
@@ -1454,7 +1454,7 @@ _Py_dg_strtod(const char *s00, char **se)
switch (c) {
case '-':
sign = 1;
- /* no break */
+ /* fall through */
case '+':
c = *++s;
}
@@ -1523,7 +1523,7 @@ _Py_dg_strtod(const char *s00, char **se)
switch (c) {
case '-':
esign = 1;
- /* no break */
+ /* fall through */
case '+':
c = *++s;
}
@@ -2441,7 +2441,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
break;
case 2:
leftright = 0;
- /* no break */
+ /* fall through */
case 4:
if (ndigits <= 0)
ndigits = 1;
@@ -2449,7 +2449,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
break;
case 3:
leftright = 0;
- /* no break */
+ /* fall through */
case 5:
i = ndigits + k + 1;
ilim = i;
diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c
index a2c2b36..9192bfd 100644
--- a/Python/formatter_unicode.c
+++ b/Python/formatter_unicode.c
@@ -312,6 +312,7 @@ parse_internal_render_format_spec(PyObject *format_spec,
format->thousands_separators = LT_UNDER_FOUR_LOCALE;
break;
}
+ /* fall through */
default:
invalid_comma_type(format->type);
return 0;
diff --git a/Python/getargs.c b/Python/getargs.c
index 1381964..ed6b815 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -2260,8 +2260,8 @@ skipitem(const char **p_format, va_list *p_va, int flags)
/* after 'e', only 's' and 't' is allowed */
goto err;
format++;
- /* explicit fallthrough to string cases */
}
+ /* fall through */
case 's': /* string */
case 'z': /* string or None */
diff --git a/Python/marshal.c b/Python/marshal.c
index 7b12ab7..22ca49c 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -1105,6 +1105,7 @@ r_object(RFILE *p)
case TYPE_ASCII_INTERNED:
is_interned = 1;
+ /* fall through */
case TYPE_ASCII:
n = r_long(p);
if (PyErr_Occurred())
@@ -1117,6 +1118,7 @@ r_object(RFILE *p)
case TYPE_SHORT_ASCII_INTERNED:
is_interned = 1;
+ /* fall through */
case TYPE_SHORT_ASCII:
n = r_byte(p);
if (n == EOF) {
@@ -1142,6 +1144,7 @@ r_object(RFILE *p)
case TYPE_INTERNED:
is_interned = 1;
+ /* fall through */
case TYPE_UNICODE:
{
const char *buffer;
diff --git a/Python/pyhash.c b/Python/pyhash.c
index 57a2da7..a2ec230 100644
--- a/Python/pyhash.c
+++ b/Python/pyhash.c
@@ -393,13 +393,13 @@ siphash24(const void *src, Py_ssize_t src_sz) {
pt = (uint8_t *)&t;
m = (uint8_t *)in;
switch (src_sz) {
- case 7: pt[6] = m[6];
- case 6: pt[5] = m[5];
- case 5: pt[4] = m[4];
+ case 7: pt[6] = m[6]; /* fall through */
+ case 6: pt[5] = m[5]; /* fall through */
+ case 5: pt[4] = m[4]; /* fall through */
case 4: memcpy(pt, m, sizeof(uint32_t)); break;
- case 3: pt[2] = m[2];
- case 2: pt[1] = m[1];
- case 1: pt[0] = m[0];
+ case 3: pt[2] = m[2]; /* fall through */
+ case 2: pt[1] = m[1]; /* fall through */
+ case 1: pt[0] = m[0]; /* fall through */
}
b |= _le64toh(t);
diff --git a/Python/wordcode_helpers.h b/Python/wordcode_helpers.h
index b0e3a91..cce81c1 100644
--- a/Python/wordcode_helpers.h
+++ b/Python/wordcode_helpers.h
@@ -28,10 +28,13 @@ write_op_arg(_Py_CODEUNIT *codestr, unsigned char opcode,
switch (ilen) {
case 4:
*codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 24) & 0xff);
+ /* fall through */
case 3:
*codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 16) & 0xff);
+ /* fall through */
case 2:
*codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 8) & 0xff);
+ /* fall through */
case 1:
*codestr++ = PACKOPARG(opcode, oparg & 0xff);
break;