please clean up C warnings
If i compile with gcc 8.2.0 with all warnings enabled, the compiler produces a lot of noise.
Some of the warnings are probably worth paying attention to, but they're drowned in the flood of what seems like spurious noise. It would be great to clean up some of those warnings to reduce the noise and help catch other errors.
I ran:
make -j4 V=1 CFLAGS='-std=gnu11 -Wpedantic -Wall' -k 2>&1 | \
awk -F: '($4 == " warning" || $4 == " error"){ print $5 }' | sort | uniq -c | sort -n
and i got:
1 ISO C does not support %n$ operand number formats [-Wformat=]
1 ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
1 ISO C forbids conversion of object pointer to function pointer type [-Wpedantic]
1 ISO C forbids empty initializer braces [-Wpedantic]
1 ISO C forbids initialization between function pointer and ‘void *’ [-Wpedantic]
1 ISO C forbids ‘return’ with expression, in function returning void [-Wpedantic]
1 ISO C forbids zero-size array ‘buf’ [-Wpedantic]
1 overflow in conversion from ‘int’ to ‘char’ changes value from ‘189’ to ‘-67’ [-Woverflow]
1 overflow in conversion from ‘int’ to ‘char’ changes value from ‘191’ to ‘-65’ [-Woverflow]
1 overflow in conversion from ‘int’ to ‘char’ changes value from ‘239’ to ‘-17’ [-Woverflow]
2 ISO C forbids passing argument 2 of ‘lua_pushlightuserdata’ between function pointer and ‘void *’ [-Wpedantic]
2 pointer of type ‘void *’ used in subtraction [-Wpointer-arith]
5 ISO C forbids assignment between function pointer and ‘void *’ [-Wpedantic]
6 invalid use of structure with flexible array member [-Wpedantic]
13 pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
41 ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
46 ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
57 ISO C does not permit named variadic macros [-Wvariadic-macros]
134 ISO C99 requires at least one argument for the "..." in a variadic macro
Avoiding gcc extensions for variadic macros, extraneous semicolons, unnamed structs/unions, and void*
pointer arithmetic ought to bring the warnings down enough that the remaining errors can be dealt with individually.