stephane / libmodbus

A Modbus library for Linux, Mac OS, FreeBSD and Windows
http://libmodbus.org
GNU Lesser General Public License v2.1
3.33k stars 1.71k forks source link

MinGW: make warnings "comparison between signed and unsigned" #119

Closed ghost closed 11 years ago

ghost commented 11 years ago

when compiling the newest libmodbus master branch with GCC 4.7.2 in MinGW on Win7 via the steps:

autogen.sh
./configure
make

make warns:

modbus.c: In function '_modbus_receive_msg':
modbus.c:367:5: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

modbus-rtu.c: In function '_modbus_rtu_send':
modbus-rtu.c:283:86: warning: signed and unsigned type in conditional expression [-Wsign-compare]

modbus-tcp.c: In function '_connect':
modbus-tcp.c:274:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

modbus-tcp.c: In function '_modbus_tcp_flush':
modbus-tcp.c:451:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

modbus-tcp.c: In function '_modbus_tcp_select':
modbus-tcp.c:693:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

bandwidth-server-many-up.c: In function 'main':
bandwidth-server-many-up.c:80:5: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
bandwidth-server-many-up.c:113:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
bandwidth-server-many-up.c:134:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
stephane commented 11 years ago

Yes I'm aware of these warnings but I can't change FD_SET macro for Windows! I need a signed socket to set it to -1 on init.

Excepted if you know a solution, I will close this issue as 'WONTFIX'...

ghost commented 11 years ago

i don't know an alternative. thanks for the info, it's good to know, since known warnings won't be a surprise or something to worry about during compiling.