Subject: Re: lint warning in /usr/include/machine/lock.h.
To: None <thorpej@zembu.com>
From: Simon Burge <simonb@netbsd.org>
List: port-alpha
Date: 06/06/2000 16:37:08
Jason R Thorpe wrote:

> On Tue, Jun 06, 2000 at 09:09:18AM +1000, Simon Burge wrote:
> 
>  > In /usr/include/machine/lock.h, lint complains that the following
>  > 
>  > 	static __inline int
>  > 	__cpu_simple_lock_try(__cpu_simple_lock_t *alp)
>  > 	{
>  > 		unsigned long t0, v0;
>  > 		...
>  > 		return (v0);
>  > 	}
>  > 
>  > "warning: conversion from 'unsigned long' may lose accuracy".
>  > 
>  > Should __cpu_simple_lock_try return an 'unsigned long'?  I haven't
>  > looked further to see where this is used...
> 
> Hm.  Try changing that to:
> 
> 	return (v0 != 0);

Cool.

return (v0):

	alpha:src/lib/libarch 229> make alpha_pci_conf.ln
	lint -chapbxzF  -i /NetBSD/src/lib/libarch/alpha/alpha_pci_conf.c
	/usr/include/machine/lock.h(127): warning: conversion from 'unsigned long' may lose accuracy
	alpha:src/lib/libarch 230>

return (v0 != 0):

	alpha:src/lib/libarch 232> make alpha_pci_conf.ln
	lint -chapbxzF  -i /NetBSD/src/lib/libarch/alpha/alpha_pci_conf.c
	alpha:src/lib/libarch 233> 

So __cpu_simple_lock_try only needs to return true/false?  One more
step, there appears to be no non-kernel users of this - should it
just be '#ifdef _KERNEL'd?

Simon.