[sane-devel] [epson2] Fixing unused-but-set-variable compiler warning

Olaf Meeuwissen paddy-hack at member.fsf.org
Sun Aug 28 05:27:38 UTC 2016


Hi Alessandro,

I'm making a last push to fix all compiler warnings for debian-8-full
builds[1].  The epson2 backend triggers an "unused-but-set-variable"
warning for the needStrangeReorder variable in the e2_block_read
function in epson2-ops.c.

 [1] https://gitlab.com/sane-project/backends/environments

At epson2-ops.c:2160, it has:

>		/* never used, beta testers required */
>		needStrangeReorder =
>			(strstr(s->hw->model, "GT-2200") ||
>			 ((strstr(s->hw->model, "1640")
>			   && strstr(s->hw->model, "Perfection"))
>			  || strstr(s->hw->model, "GT-8700")))
>			&& s->params.format == SANE_FRAME_RGB;

The GT-2200 is listed as unsupported, the GT-8700 and Perfection 1640
are listed with status complete (good for the TPU unit).  These devices
are all pretty old, BTW (judging by their USB product IDs).

I could simply remove the variable and be done with it but that doesn't
look quite right.  There are a reorder variable and a need_color_reorder
member variable (for the Perfection 1650) in the same piece of code that
seem to be involved in controlling this reorder behaviour.  I could
combine the needStrangeReorder value with reorder instead.

Also, these devices may actually already set reorder to true at
epson2-ops.c:2122, which says:

>			/* do we have to reorder the data ? */
>			if (get_color(result.status) == 0x01)
>				reorder = SANE_TRUE;

What do you think is the best approach?

 - simply remove needStrangeReorder
 - combine with reorder via a logical-or (and drop the "never used" from
   the comment)

Let me know and I'll fix it up whichever way you please or just do it
yourself ;-)

Hope this helps,
-- 
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Software                        https://my.fsf.org/donate
 Join the Free Software Foundation              https://my.fsf.org/join




More information about the sane-devel mailing list