[Nut-upsdev] gcc4 compiler warnings

Kjell Claesson kjell.claesson at telia.com
Fri Feb 10 16:09:33 UTC 2006


fre 2006-02-10 klockan 11:29 -0400 skrev Peter Selinger:
> Gentlemen,
> 
> attached my proposed changes. I figured, since we discussed them for
> so long, it might be a good idea to let you see them before I commit.
> I changed many of the functions in serial.h to use unsigned char (but
> not all of them; I conservatively stayed away from ser_get_line_alert
> and friends, because they actually compare characters that are passed
> by value).
> 
> I resisted the temptation to muck with the drivers themselves (except
> for undoing the changes to the belkinunv and bcmxcp_ser drivers from
> earlier today). This means, in the short run, there will be *more*
> compiler warnings, but that is a good thing, as it will hopefully lead
> to some of the drivers rethinking their char/uchar choices, and others
> to just put in the typecasts.
> 
About the bcmxcp_ser.c:
The only change made was that i forgot to declare the answer as 
unsigned char in pw_comm_setup. (Line 241)

And it resulted in warnings on line 259 and 271 (command_read_sequence)
as the answer is declared as unsigned char in that function.

So it hade nothing to do with the ser_get_char or ser_send_buf ......
that is fixed in your patch.

So if you revert the latest submit i get a warning again.
Apply the patch to the current version.

/Kjell

> If no complaints about the attached patch, I will commit it later. 
> -- Peter
> 
> Arjen de Korte wrote:
> > 
> > 
> > >> I believe the type (void *) should only be used for data whose value
> > >> is intended to be typecast (such as malloc()), or where the nature of
> > >> the data truly does not matter (such as memset()).
> > > I agree completely on this. Using void * just to get rid of
> > > compiler warnings is the wrong way to go, it'll bite you in the long
> > > run.
> > 
> > *SLAP!*
> > 
> > I stand corrected, that was definitly not one of my finest ideas today.
> > I'll convert my driver later today, to use unsigned char's.
> > 
> > Regards, Arjen
> > 





More information about the Nut-upsdev mailing list