Work around build issues on mac instroduced this commmit: e2e7b25 Use union instead of struct for cmsghdr Reference: http://alas.matf.bg.ac.rs/manuals/lspe/snode=153.html
Use of struct with cmsghdr and pad is a GNU extension. When built with Clang, warnings are issued as such. So take the union approach instead. To fix this, I used an example at: http://www.rootr.net/man/man/CMSG_SPACE This is a second try to fix clang warnings in io.cpp. The reverted first try was: a9648cf Ignore all GNU-extension warnings As an alternative approach to it, I fixed the code itself.
This commit suppresses following warnings from Clang: vm/builtin/io.cpp:1101:22: error: field 'hdr' with variable sized type 'struct cmsghdr' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu] struct cmsghdr hdr; ^ vm/builtin/io.cpp:1146:22: error: field 'hdr' with variable sized type 'struct cmsghdr' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu] struct cmsghdr hdr; ^ 2 errors generated.
This suppresses a following warning by running specs with Rubinius built by clang: spec/ruby/optional/capi/ext/class_spec.c:108:2: warning: implicit declaration of function 'rb_cvar_set_internal' is invalid in C99 [-Wimplicit-function-declaration] rb_cvar_set(klass, rb_intern(StringValuePtr(name)), val); ^ vm/capi/19/include/ruby/ruby.h:1096:23: note: expanded from: #define rb_cvar_set rb_cvar_set_internal ^ 1 warning generated.
These methods where called directly by #flush_next_in and #flush_next_out and are not in MRI so let's remove them for the sake of consistency.