creachadair / imath

Arbitrary precision integer and rational arithmetic library
Other
131 stars 20 forks source link

Warnings when compiled with -Wextra #24

Closed lhf closed 5 years ago

lhf commented 6 years ago

I get these warnings when compiling with -Wextra:

gcc -pedantic -Wall -Wextra -I. -O3 -funroll-loops -finline-functions -std=c99 -DUSE_64BIT_WORDS -c imath.c imrat.c
imath.c: In function 's_realloc':
imath.c:1986: warning: unused parameter 'osize'
imath.c: In function 's_udiv_knuth':
imath.c:2869: warning: comparison of unsigned expression >= 0 is always true
imrat.c: In function 'mp_rat_to_decimal':
imrat.c:543: warning: comparison between signed and unsigned integer expressions
imrat.c:551: warning: comparison between signed and unsigned integer expressions
imrat.c:626: warning: comparison between signed and unsigned integer expressions

Similar warnings in other files.

creachadair commented 5 years ago

Commit 1d281772 adds -Wextra and -Wno-unused-parameter. Commit 15ba02af fixes up all the warned cases of mixed-sign comparisons. I flirted with suppressing the unused parameter warnings individually, but there are too many legitimate cases in imdrover.c to be worthwhile.