creationix / moonslice-luv

A port of moonslice running on top of luv and lhttp_parser
39 stars 4 forks source link

luv: "error: variable 'delay' is used uninitialized whenever 'if' condition is false" #14

Closed wscherphof closed 10 years ago

wscherphof commented 10 years ago

On OSX Mavericks:

/Applications/Xcode.app/Contents/Developer/usr/bin/make -C luv
cc -c luv.c -o luv.o -Ilibuv/include -g -I/usr/local/include/luajit-2.0 -DLUV_STACK_CHECK -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Werror -fPIC
In file included from luv.c:4:
./luv_functions.c:896:7: error: variable 'delay' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  if (enable) {
      ^~~~~~
./luv_functions.c:899:40: note: uninitialized use occurs here
  if (uv_tcp_keepalive(handle, enable, delay)) {
                                       ^~~~~
./luv_functions.c:896:3: note: remove the 'if' if its condition is always true
  if (enable) {
  ^~~~~~~~~~~~
./luv_functions.c:895:21: note: initialize the variable 'delay' to silence this warning
  unsigned int delay;
                    ^
                     = 0
1 error generated.
make[1]: *** [luv.o] Error 1
make: *** [luv/luv.so] Error 2

(Not able to get past this by taking the current master of the luv repo; could also not exactly find it within luvit (luvit does build fine) )