Warnings I created which don't make sense to me

Mark Doliner mark at kingant.net
Sat Feb 24 15:41:38 EST 2007


On Sat, 24 Feb 2007 13:27:25 -0500, Evan Schoenberg wrote
> I hate muddying up the compiler output with spurious warnings.
> 
> My recent changes to proxy.c generated 4 new warnings:
> proxy.c: In function `socket_ready_cb':
> proxy.c:406: warning: passing arg 2 of `gaim_input_get_error' from  
> incompatible pointer type
> proxy.c: In function `proxy_connect_none':
> proxy.c:481: warning: passing arg 2 of `gaim_input_get_error' from  
> incompatible pointer type
> proxy.c: In function `http_canwrite':
> proxy.c:805: warning: passing arg 2 of `gaim_input_get_error' from  
> incompatible pointer type
> proxy.c: In function `s4_canwrite':
> proxy.c:965: warning: passing arg 2 of `gaim_input_get_error' from  
> incompatible pointer type
> proxy.c: In function `s5_canwrite':
> proxy.c:1531: warning: passing arg 2 of `gaim_input_get_error' from  
> incompatible pointer type
> 
> gaim_input_get_error() is defined by eventloop.h as:
> int  gaim_input_get_error(int fd, int *errno);
> 
> And the lines in question look like:
> 		int error = ETIMEDOUT;
> 		int ret;
> 		ret = gaim_input_get_error(connect_data->fd, &error);
> 
> Why is &error not an int *?
> 
> It'll be really nice when discussion about new code can be back in  
> public rather than on cabal :)
> 
> -Evan

The problem is that the declaration of gaim_input_get_error() in eventloop.h
uses "errno" as the parameter name (eventloop.c uses "error").  errno is a
global extern variable declared in errno.h.  I guess if you reuse the name
this way the compiler thinks the function should accept an int instead of an int*

I dunno, it's weird.  I checked in a fix.

-Mark


More information about the Cabal mailing list