Subject: Re: Lots of pkgsrc warnings...
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Richard Rauch <rkr@olib.org>
List: port-amd64
Date: 11/30/2003 21:57:16
On Mon, Dec 01, 2003 at 01:31:22AM +0100, Manuel Bouyer wrote:
> On Sun, Nov 30, 2003 at 03:55:12AM -0600, Richard Rauch wrote:
> > I've been seeing a lot of pkgsrc code complain that a logical expression
> > is always true (or false, as the case may be) due to the size of the
 [...]
> > Have others noticed this?  Is it a -current, GCC 3.x, general 64-bit,
> > or port-amd64 issue?  Or none of the above?
> 
> I've seen complains from some packages on alpha too.
> I suspect at last some of these packages are buggy.

It may just be a more pedantic set of warnings from the compiler.
But I'm bothered.  One case that I tried to sort out was in a
while() (I think) test-case, which used a macro to check for
character-classes of unicode data.  If the symbol {UNICODE} was
defined, you got a 16-bit (or larger) data type.  Else, you got
a {char}.

The macro was defined with a long list of test-cases.  One or
two fell in the range of ASCII (e.g., test for upper-case let-
ters; 0x41 through 0x5b, I believe).  Others were in the posi-
tive range of a signed 16-bit value (0x4???, for example).
The overall test condition should not have *always* been true,
nor *always* false.  *Many* of the individual cases should have
been *always* false, however, because of range limits on an 8-
bit {char}.

The compiler produced a single warning for the entire statement,
leading me to wonder at exactly what it was trying to tell me.
I would have been happier if it had somehow conveyed that there
were multiple sub-expressions that were going to always be
true and/or multiple ones that were always false (preferably
also making it clear that the overall expression, as it appears
to my eye, could yet be true *or* false depending on the input
data).

Even a slough of "duplicate" warnings for the one macro (with
its many tests on the one line of code) would be preferable,
if the warning is legitimate.


Ah well, I won't worry about it much for now, I guess, if
the behavior is observed elsewhere.  Thanks.  (^&


-- 
  "I probably don't know what I'm talking about."  http://www.olib.org/~rkr/