[En-Nut-Discussion] -Wsign-compare warnings

Matthias Ringwald mringwal at inf.ethz.ch
Thu Oct 14 15:11:42 CEST 2004


hi

my colleague tried to compile our subset of the ethernut 3.5.0 CVS 
sources with an older avr-gcc
which had -Wsign-compare enabled as default. compiling ethernut failed 
because of some comparisons
between signed and unsigned variables in gmtime.c localim.c and usart.c.
(...log attached)

anybody volunteering to check those (there might be more locations, as 
we only used a subset)
location and fix them to not produce warnings?

in our bt stack, those warnings actually turned out to hint a potential 
bug, which in our
software probablity would not be triggerd, but better to fix on time 
than to debug later.

what about more warnings per default ?

matthias


avr-gcc -c -mmcu=atmega128 -Os -Wsign-compare -Wall -Wstrict-prototypes 
-Wa,-ahlms=gmtime.btnode2.lst -D__HARVARD_ARCH__ -DNUT_CPU_FREQ=7372800 
-DNUTRAMEND=0xFFFF -D__BTNODE2__  -I../../btnode/include 
-I../../nut/include gmtime.c -o gmtime.btnode2.o
gmtime.c: In function `gmtime_r':
gmtime.c:109: warning: comparison between signed and unsigned
gmtime.c:112: warning: comparison between signed and unsigned
gmtime.c:116: warning: comparison between signed and unsigned

avr-gcc -c -mmcu=atmega128 -Os -Wsign-compare -Wall -Wstrict-prototypes 
-Wa,-ahlms=localtim.btnode2.lst -D__HARVARD_ARCH__ 
-DNUT_CPU_FREQ=7372800 -DNUTRAMEND=0xFFFF -D__BTNODE2__  
-I../../btnode/include -I../../nut/include localtim.c -o 
localtim.btnode2.o
localtim.c: In function `localtime_r':
localtim.c:76: warning: comparison between signed and unsigned
localtim.c:76: warning: comparison between signed and unsigned

avr-gcc -c -mmcu=atmega128 -Os -Wsign-compare -Wall -Wstrict-prototypes 
-Wa,-ahlms=usart.btnode2.lst -D__HARVARD_ARCH__ -DNUT_CPU_FREQ=7372800 
-DNUTRAMEND=0xFFFF -D__BTNODE2__  -I../../btnode/include 
-I../../nut/include usart.c -o usart.btnode2.o
usart.c: In function `UsartRead':
usart.c:231: warning: comparison between signed and unsigned

  




More information about the En-Nut-Discussion mailing list