At expansion time, diagnostic about the size of shifts is issued by an helper check_shift_count() and the condition are checked before calling this functions. Move the condition checking insdie the helper as it make the code more readable (and this corresponds to the helper's name). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- expand.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/expand.c b/expand.c index 484ead468..449dac05b 100644 --- a/expand.c +++ b/expand.c @@ -160,6 +160,8 @@ Float: static void check_shift_count(struct expression *expr, struct symbol *ctype, unsigned int count) { + if (count < ctype->bit_size) + return; warning(expr->pos, "shift too big (%u) for type %s", count, show_typename(ctype)); } @@ -181,11 +183,9 @@ static int simplify_int_binop(struct expression *expr, struct symbol *ctype) return 0; r = right->value; if (expr->op == SPECIAL_LEFTSHIFT || expr->op == SPECIAL_RIGHTSHIFT) { - if (r >= ctype->bit_size) { - if (conservative) - return 0; - check_shift_count(expr, ctype, r); - } + if (conservative) + return 0; + check_shift_count(expr, ctype, r); } if (left->type != EXPR_VALUE) return 0; -- 2.18.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html