Hi, On Wed, Mar 26, 2003 at 10:29:53PM +0100, Oliver Rauch wrote: > - A lot of "unused parameter" warnings. I saw some SANE code that does > "var=var;" to quell such warnings, so presumably at least some people > care.
Probably 99% of those are harmless, just annoying. > - Twelve "unused variable" warnings. Maybe #ifdef problems. > - 13 warnings which indicate carelessness with `const': two "assignment > discards `const' from pointer target type" and 11 "passing arg 1 of > `free' discards `const' from pointer target type". How serious SANE > considers these depends on how serious it is about doing real const > poisoning; since the gcc instructions don't say to use > -Wwrite-strings, presumably it's not really all that serious. Usually that's because of something like sane.name = strdup (name); [...] free (sane.name); To avoid these, either use sane.name = "some name"; or name = (use any method to set the name); sane.name = name; [...] free (name); > - 30 "comparison between signed and unsigned". I consider these total > noise, to the point where I use -Wno-sign-compare. I found two or three errors becasue of these warnings in my code, so sometimes they make sense. E.g. if (result < 0) to catche errors when result is unsigned int. > - 133 "int format, long int arg" messages. These will matter on > architectures where long and int are not the same size, like alpha or > sparc64. (I suspect the successful build on NetBSD/alpha despite > these is because they are the last format argument, and the alpha is > little-endian. On a big-endian platform like sparc64, I would expect > incorrect results to ensue.) That's definitely a bug. And it's mentioned for ages in backend-writing.txt. > - Various other format/argument type mismatches: > "canon630u-common.c", line 305: warning: unsigned int format, long > unsigned > int arg (arg 3) "canon630u-common.c", line 331: warning: unsigned int > format, long unsigned int arg (arg 3) "epson.c", line 908: warning: unsigned > int format, long unsigned int arg (arg 3) "epson.c", line 837: warning: > unsigned int format, size_t arg (arg 3) "canon630u-common.c", line 239: > warning: unsigned int format, size_t arg (arg 4) "canon630u-common.c", line > 261: warning: unsigned int format, size_t arg (arg 4) > > - One "missing initializer". > > - One call to mktemp(), which actually is broken anyway, since the > return value test is reversed. (backend/bh.c line 1865.) This and > the following open() should be collapsed into a call to mkstemp() to > avoid the race between testing for nonexistence of the file and > opening it - though I note the open uses O_EXCL, so losing the race > merely produces an unnecessary error rather than a serious bug. Most of the warnings are known. But I hesitate to touch this code because I don't have the equipment to test it and at least some maintainers aren't active anymore. > - Two "passing arg N of `...' from incompatible pointer type", both in > the same call: > "coolscan.c", line 2641: warning: passing arg 2 of `RGBIfix16' from > incompatible pointer type "coolscan.c", line 2641: warning: passing arg 3 of > `RGBIfix16' from incompatible pointer type Coolscan is one of those backends, there are already TODO entries for it. > If SANE is interested, I can try to clean these up and send in patches > for them. (Since it works for me, I'm not inclined to bother unless > there's a reasonable chance SANE would actually pick up the patches.) Please send patches. I can't gurantee that I'll apply them all but I'll do that at least for the obvious ones for unmaintained backends. Bye, Henning
