[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20121026011645.5a4e6adac51cf0bdc44e48bc@canb.auug.org.au>
Date: Fri, 26 Oct 2012 01:16:45 +1100
From: Stephen Rothwell <sfr@...b.auug.org.au>
To: Richard Yang <weiyang@...ux.vnet.ibm.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-next@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: linux-next: build warnings after merge of the akpm tree
Hi Richard,
On Thu, 25 Oct 2012 22:12:32 +0800 Richard Yang <weiyang@...ux.vnet.ibm.com> wrote:
>
> I did a quick check.
>
> The root reason is,
> 1. kfifo_in() second parameter should be type "const void *"
> 2. kfifo_out_locked() second parameter should be type "void *"
> 3. kfifo_in_locked() second parameter should be type "const void *"
>
> And I am curious about why the original code couldn't detect this type
> mismatch.
>
> The reason is: the original code use = not ==.
> so when a const void * is assigned another pointer type, there is no warning.
>
> While I write this test code, there is still no warning.
> int main()
> {
> int *a;
> void* b;
> b = a; // this should be ok.
> a = b; // this should need the type transfer, but still no warning.
> return 0;
> }
>
> Hmm... not understand. Any error in my test code?
Yes, any pointer can be assigned to a void pointer and a void pointer can
be assigned to any pointer, so neither of the above should complain.
--
Cheers,
Stephen Rothwell sfr@...b.auug.org.au
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists