[sane-devel] Some warnings/errors - please verify your backends

Oliver Rauch oliver.rauch@rauch-domain.de
Wed, 26 Mar 2003 22:29:53 +0100


Hello.

I got the following mail that contains some information
about warnings/errors that may break compatablity with
some platforms. Please would every backend author
read this mail and take care about the listed problems.

Best regards
Oliver

----------  Forwarded Message  ----------

Subject: Re: Two small `sane' questions
Date: Wed, 26 Mar 2003 16:08:00 -0500 (EST)
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
To: Oliver Rauch <oliver.rauch@rauch-domain.de>

Okay, my rebuild is done.  Here are the warnings I got.

- A lot of "unused parameter" warnings.  I saw some SANE code that does
  "var=3Dvar;" to quell such warnings, so presumably at least some people
  care.

- Twelve "unused variable" warnings.

- 18 "defined but not used" warnings.  I haven't investigated to see
  which ones are probably errors and which ones just indicate slight
  carelessness with #ifdefs and the like.

- 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.

- 30 "comparison between signed and unsigned".  I consider these total
  noise, to the point where I use -Wno-sign-compare.

- Implicit declaration of two functions in getopt.c, getpid and
  strncmp.  These are ignorable on SPARC, where the calling conventions
  involved are such that the defaults work.  On an architecture with
  more widely varying calling conventions they could become important.

- 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.)

- Various other format/argument type mismatches:
=09"canon630u-common.c", line 305: warning: unsigned int format, long uns=
igned
 int arg (arg 3) "canon630u-common.c", line 331: warning: unsigned int
 format, long unsigned int arg (arg 3) "epson.c", line 908: warning: unsi=
gned
 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", l=
ine
 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.

- Two "passing arg N of `...' from incompatible pointer type", both in
  the same call:
=09"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

- Two dangling elses:
=09"agfafocus.c", line 781: warning: suggest explicit braces to avoid amb=
iguous
 `else' "getopt.c", line 596: warning: suggest explicit braces to avoid
 ambiguous `else'

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.)

/~\ The ASCII=09=09=09=09der Mouse
\ / Ribbon Campaign
 X  Against HTML=09       mouse@rodents.montreal.qc.ca
/ \ Email!=09     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

-------------------------------------------------------

--=20
http://www.xsane.org
http://www.mostang.com/sane
http://www.rauch-domain.de
mailto:Oliver.Rauch@Rauch-Domain.DE