cvs commit: src/sys/i386/include atomic.h
des at des.no
Tue Mar 28 19:51:50 UTC 2006
John Baldwin <jhb at freebsd.org> writes:
> On Tuesday 28 March 2006 13:05, Dag-Erling Smørgrav wrote:
> > John Baldwin <jhb at freebsd.org> writes:
> > > One reason for not having the casts, btw, is that you lose type
> > > checking.
> > Huh? Before my patch, any use of atomic_*_ptr with warnings turned
> > off would result in a slew of warnings because you'd be passing
> > pointers to a function which is declared to take u_int. The only way
> > to make this type safe is to use inline functions instead of the
> > macros I wrote.
> s/off/on/ I trust
> Not true. The tinderbox would attest to that. Please see code such as
> this: [...]
which uses uintptr_t, not actual pointers, to avoid warnings. In
effect, that code is broken.
Apply the attached patch, see how far a buildkernel gets...
I think the proper thing to do, to cover all your bases, would be to
define a MD atomic_*_intptr family which operated on uintptr_t, and
define an MI atomic_*_ptr family which operates on void * based on
> Even userland uses casts when it uses void * rather than uintptr_t for
> the underlying type. See src/lib/libpthread/sys/lock.c or
The latter only works because libthr is built with warnings disabled.
I just finished working on making it build at WARNS level 2; higher
levels will require a major overhaul, because the kernel interface it
uses is fundamentally broken.
Dag-Erling Smørgrav - des at des.no
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4996 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20060328/e81a66f7/i386-atomic.bin
More information about the cvs-src