[Nut-upsdev] gcc4 compiler warnings

Arjen de Korte nut+devel at de-korte.org
Thu Feb 9 16:03:04 UTC 2006



> The following files emits warnings when compiled with gcc 4.0:
> al175.c
> bcmxcp_ser.c
> belkinunv.c
> cyberpower.c
> everups.c
> powercom.c
> solis.c
>
> All warnings seem to be of this variety:
> everups.c:38: warning: pointer targets in passing argument 2 of
> 'ser_get_char' differ in signedness

This is due to the fact that some drivers need to pass character values
between 0x80 and 0xFF to or from the drivers, but the serial functions use
signed chars. Unless some drivers use negative values, my preference would
be to fix/create serial functions (to use unsigned chars), rather than to
convert the characters between 0x80 and 0xFF to negative numbers.
Especially where status bits are used, listing a hex value is more
readable then.

> I suggest that those who fiddles with those drivers fixes the warnings
and verifies that it works afterwards. I can provide the complete
buildlog if there's anyone that doesn't have access to a gcc4-equipped
machine.

Not needed, gcc will also complain about these problems when you pass it
the '-pedantic' option (which is highly recommended when writing portable
code). This will also spot the places where C++ style comments are used,
which violates the NUT coding standard.

Regards,
Arjen



-- 
Eindhoven - The Netherlands
Key fingerprint - 66 4E 03 2C 9D B5 CB 9B  7A FE 7E C1 EE 88 BC 57



More information about the Nut-upsdev mailing list