diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-01-21 06:47:07 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-01-31 17:54:23 +0100 |
commit | b61bfb16326e034ec12c31491bf3897cce9f3e4d (patch) | |
tree | f04ca6383ea847514679734e693d42e449fcb0e8 /evaluate.c | |
parent | 1829a899f5062fc010a4603533f944a08a1aba1d (diff) | |
download | sparse-b61bfb16326e034ec12c31491bf3897cce9f3e4d.tar.gz |
report type & size on non-power-of-2 pointer subtraction
The option -Wptr-subtraction-blows warns when pointer subtraction
is done and the base size is not a power-of-2.
However, the current message doesn't give much context.
Change this by giving the base type and the size in the warning.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'evaluate.c')
-rw-r--r-- | evaluate.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -847,8 +847,10 @@ static struct symbol *evaluate_ptr_sub(struct expression *expr) val->value = value; if (value & (value-1)) { - if (Wptr_subtraction_blows) + if (Wptr_subtraction_blows) { warning(expr->pos, "potentially expensive pointer subtraction"); + info(expr->pos, " '%s' has a non-power-of-2 size: %lu", show_typename(lbase), value); + } } sub->op = '-'; |