On Thu, 6 Sep 2001, John Baldwin wrote:
> On 07-Sep-01 Julian Elischer wrote:
> > Here is a hack to remove the 20 or so warning messages from if_ie.c
No hacks please.
I fixed some of these locally a few years ago without using any hacks,
but gave up. if_ie.c should be rewritten to not use volatile qualifiers
to a fault.
> > Most of them are due to the supply of volatile pointers to bcopy and
> > bzero.
> > I do the following to produce macros that call bzero and bcopy, but
> > don't produce
> > warning messages when called with volatile arguments.
> > typedef void Xcopy( void volatile *, void volatile *, int);
> >#define VBCOPY(A,B,L) (*(Xcopy *)&bcopy)((A),(B),(L))
> > typedef void Xzero( void volatile *, int);
> >#define VBZERO(A,L) (*(Xzero *)&bzero)((A),(L))
This just breaks the warning.
> sys/cdef.h already has some rather general purpose macros for thsi sort of
> thing in the form of __DEVOLATILE(), __DECONST(), and __DEQUALIFY().
These will be terminated with extreme prejudice. Making it easy to
break the warnings for removing const qualifiers is bad enough, but
there are cases where removing const qualifiers is not a bug. I can't
think of any cases where removing volatile qualifiers is not a bug.
Well, there are cases where volatile memory becomes unvolatile because
you lock it while it is being accessed, but these cases are probably
better handled by not declaring it as volatile.
In the case of if_ie.c and bcopy(), bcopy() is not suitable for copying
memory that doesn't behave like RAM. Some optimized versions of it
do out of order and/or repeated copies. This might be very bad for
volatile device memory. I think rewriting if_ie.c to use bus_space
would make most of the warnings go away automatically.
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message