From 51fdd2c6ca1c96740cb202770c559acb791b3f12 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 10 Oct 2024 11:30:37 +0900 Subject: [PATCH] Move directives outside `rb_ary_new3` call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function may be a macro for optimization, which will be expanded to `rb_ary_new_from_values`. ``` ext/socket/ancdata.c: In function ‘bsock_recvmsg_internal’: ext/socket/ancdata.c:1648:1: error: embedding a directive within macro arguments is not portable 1648 | #if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) | ^ ext/socket/ancdata.c:1650:1: error: embedding a directive within macro arguments is not portable 1650 | #else | ^ ext/socket/ancdata.c:1652:1: error: embedding a directive within macro arguments is not portable 1652 | #endif | ^ ``` --- ext/socket/ancdata.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index 6ef040b692..f1e9e42524 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -1643,14 +1643,14 @@ bsock_recvmsg_internal(VALUE sock, rb_obj_reveal(dat_str, rb_cString); } +#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) + VALUE msg_flags = INT2NUM(mh.msg_flags); +#else + VALUE msg_flags = Qnil; +#endif ret = rb_ary_new3(3, dat_str, rsock_io_socket_addrinfo(sock, mh.msg_name, mh.msg_namelen), -#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) - INT2NUM(mh.msg_flags) -#else - Qnil -#endif - ); + msg_flags); #if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) family = rsock_getfamily(fptr);