Thread (1 message) 1 message, 1 author, 2012-10-25

Re: linux-next: build warnings after merge of the akpm tree

From: Stephen Rothwell <hidden>
Date: 2012-10-25 14:16:59
Also in: lkml

Hi Richard,

On Thu, 25 Oct 2012 22:12:32 +0800 Richard Yang [off-list ref] 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@canb.auug.org.au

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help