Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jun 2008 03:33:33 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Garrett Cooper <yanefbsd@gmail.com>
Cc:        freebsd-bugs@FreeBSD.org, Bruce Evans <brde@optusnet.com.au>
Subject:   Re: kern/68081: [headers] [patch] sys/time.h (lint fix)
Message-ID:  <20080623031321.G71280@delplex.bde.org>
In-Reply-To: <7d6fde3d0806210854y1c3be9ds1e1836b1c08ee671@mail.gmail.com>
References:  <200806210030.m5L0U3Jr079362@freefall.freebsd.org>  <20080621224835.L67195@delplex.bde.org> <7d6fde3d0806210854y1c3be9ds1e1836b1c08ee671@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 21 Jun 2008, Garrett Cooper wrote:

> On Sat, Jun 21, 2008 at 6:22 AM, Bruce Evans <brde@optusnet.com.au> wrote:
>> On Sat, 21 Jun 2008, Garrett Cooper wrote:
>>
>>> Haven't used lint(1) before, but I don't think this is an issue (at
>>> least not on 8-CURRENT):
>>
>> All these bugs (in lint, not in the source code) seem to be unchanged
>> in -current.  You probably tested on amd64, where the proposed fix has
>> no effect except to add even more style bugs than on i386.
>>
>> tv_nsec has type long on all machines, and lint doesn't like assigning
>> uint64_t's to longs when uint64_t is longer than long.  On amd64,
>> ...

> Actually I was using x86:
>
> [gcooper@optimus /devel/ncvs/ports]$ uname -mr
> 8.0-CURRENT i386
>
> (I'm not 100% sure) but a lot of things could have changed since 5.x,
> most notably the defining types of some of the structures. They seem
> to now properly align with one another, and if I apply your changes,
> gcc (with the default warnings enabled) complains that the shifting
> doesn't fit the actual data type size.

Er, I didn't submit any changes.  Only null changes in the header are
correct.

Your reported success was actually from not running lint with any of
the options -cghapbx as specified in the How-To-Repeat.  It is the -a
option that gives the warning for assignments of long variables to
variables that are not long.  In fact, this option is documented to do
give warnings for precisely this, and there is -aa option that gives
warnings for all implicit narrowing conversions.  However the documentation
is wrong: plain -a also gives warnings for assignments of long long
variables to longs and for similar assignments with unsigned types.

Testing with this option alone gives the behaviour that I described
-- no warning on amd64 since there are no long longs in sight (most
variables are long), but warnings on i386 since there is a mixture
of long longs and longs.  (There are a few ints in sight, but only
expanding conversions from these.)

Header files should also be clean against -aa.

The largest source of spurious warnings is now the incomplete pthread
struct declarations in <sys/types.h>.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080623031321.G71280>