[sane-devel] How to avoid gcc warnings (was: hs2p backend)

Volker Grabsch vog at notjusthosting.com
Tue Nov 20 11:32:39 UTC 2007


On Mon, Nov 19, 2007 at 11:36:20AM -0500, m. allan noah wrote:
> ok, lets start by saying that lots of other sane backends produce
> warnings, and i am probably running a newer version of gcc than you,
> so it's not a requirement that we remove all of them. it's just a pet
> peev of mine.
> 
> 1. if you put a little 'arg = arg;' line in the function, gcc will
> shutup about the param.

I'd rather recommend:

    (void)arg;

because this command has no "action". ('arg = arg;' is an assigment)
This solution also works better for 'const' arguments.

> 2. if you wrap the unused functions in #if 0/#endif, you can keep them
> for later.

That's a nice technique. It's far better than commenting the function
out, because C doesn't support nested comments. :-(


Greets,

    Volker

-- 
Volker Grabsch
---<<(())>>---
Administrator
NotJustHosting GbR



More information about the sane-devel mailing list