hash.h warnings

Garrett Cooper youshi10 at u.washington.edu
Sun Mar 25 10:18:45 UTC 2007


On Mar 25, 2007, at 1:38 AM, Andrew Thompson wrote:

> Hi,
>
>
> There was a discussion late last year about how to fix the warnings in
> sys/sys/hash.h.
>
> http://lists.freebsd.org/pipermail/freebsd-net/2006-October/ 
> 012098.html
>
> There were a few suggestions put forward but nothing was ever  
> committed.  I
> need to include this file in the kernel for a new driver but do not  
> know
> enough about this type of warning to fix it. Can anyone recommend  
> the correct
> fix?
>
> @/sys/hash.h: In function `hash32_stre':
> @/sys/hash.h:97: warning: cast discards qualifiers from pointer  
> target type
> @/sys/hash.h: In function `hash32_strne':
> @/sys/hash.h:116: warning: cast discards qualifiers from pointer  
> target type
>
>
>
> cheers,
> Andrew

After looking at the source it appears that part of the problem stems  
from the fact that p is an unsigned char pointer, where ep is a  
signed char double pointer. So you're losing some precision in the  
process (hence where the error's coming from I believe).

So, if you modified buf (the pointer that p is pointing to) or ep to  
be compatible with one another, you probably wouldn't get this warning..

-Garrett


More information about the freebsd-hackers mailing list