From 21514304be9e98a4386cb18542582068a59c5586 Mon Sep 17 00:00:00 2001 From: "E. Westbrook" Date: Thu, 28 Feb 2019 16:32:07 -0700 Subject: [PATCH] wrap visibility pragmas in #ifndef _WIN32 --- src/auxiliar.h | 4 ++++ src/buffer.h | 4 ++++ src/compat.h | 4 ++++ src/except.h | 4 ++++ src/inet.h | 4 ++++ src/io.h | 5 ++++- src/options.h | 4 ++++ src/select.h | 4 ++++ src/socket.h | 4 ++++ src/tcp.h | 4 ++++ src/timeout.c | 8 -------- src/timeout.h | 4 ++++ src/udp.h | 4 ++++ src/unixdgram.h | 4 ++++ src/unixstream.h | 4 ++++ src/wsocket.c | 8 -------- 16 files changed, 56 insertions(+), 17 deletions(-) diff --git a/src/auxiliar.h b/src/auxiliar.h index 234b00a..e8c3ead 100644 --- a/src/auxiliar.h +++ b/src/auxiliar.h @@ -31,7 +31,9 @@ #include "luasocket.h" +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int auxiliar_open(lua_State *L); void auxiliar_newclass(lua_State *L, const char *classname, luaL_Reg *func); @@ -45,6 +47,8 @@ void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx); void *auxiliar_getclassudata(lua_State *L, const char *groupname, int objidx); int auxiliar_typeerror(lua_State *L, int narg, const char *tname); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* AUXILIAR_H */ diff --git a/src/buffer.h b/src/buffer.h index 4218ea0..a0901fc 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -33,7 +33,9 @@ typedef struct t_buffer_ { } t_buffer; typedef t_buffer *p_buffer; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int buffer_open(lua_State *L); void buffer_init(p_buffer buf, p_io io, p_timeout tm); @@ -43,6 +45,8 @@ int buffer_meth_send(lua_State *L, p_buffer buf); int buffer_meth_receive(lua_State *L, p_buffer buf); int buffer_isempty(p_buffer buf); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* BUF_H */ diff --git a/src/compat.h b/src/compat.h index 8c32b07..fa2d7d7 100644 --- a/src/compat.h +++ b/src/compat.h @@ -3,12 +3,16 @@ #if LUA_VERSION_NUM==501 +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif void luasocket_setfuncs (lua_State *L, const luaL_Reg *l, int nup); void *luasocket_testudata ( lua_State *L, int arg, const char *tname); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #define luaL_setfuncs luasocket_setfuncs #define luaL_testudata luasocket_testudata diff --git a/src/except.h b/src/except.h index baa7b09..71c31fd 100644 --- a/src/except.h +++ b/src/except.h @@ -33,10 +33,14 @@ #include "luasocket.h" +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int except_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif diff --git a/src/inet.h b/src/inet.h index 2e00e58..5618b61 100644 --- a/src/inet.h +++ b/src/inet.h @@ -22,7 +22,9 @@ #define LUASOCKET_INET_ATON #endif +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int inet_open(lua_State *L); @@ -47,6 +49,8 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt); int inet_pton(int af, const char *src, void *dst); #endif +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* INET_H */ diff --git a/src/io.h b/src/io.h index e08eb0e..b8a54df 100644 --- a/src/io.h +++ b/src/io.h @@ -56,12 +56,15 @@ typedef struct t_io_ { } t_io; typedef t_io *p_io; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx); const char *io_strerror(int err); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* IO_H */ - diff --git a/src/options.h b/src/options.h index 1457f43..41f7337 100644 --- a/src/options.h +++ b/src/options.h @@ -18,7 +18,9 @@ typedef struct t_opt { } t_opt; typedef t_opt *p_opt; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps); int opt_meth_getoption(lua_State *L, p_opt opt, p_socket ps); @@ -93,6 +95,8 @@ int opt_get_ip6_v6only(lua_State *L, p_socket ps); int opt_get_error(lua_State *L, p_socket ps); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif diff --git a/src/select.h b/src/select.h index 95272db..5d45fe7 100644 --- a/src/select.h +++ b/src/select.h @@ -10,10 +10,14 @@ * true if there is data ready for reading (required for buffered input). \*=========================================================================*/ +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int select_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* SELECT_H */ diff --git a/src/socket.h b/src/socket.h index 4adc562..e541f27 100644 --- a/src/socket.h +++ b/src/socket.h @@ -36,7 +36,9 @@ typedef struct sockaddr SA; * interface to sockets \*=========================================================================*/ +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int socket_waitfd(p_socket ps, int sw, p_timeout tm); int socket_open(void); @@ -64,6 +66,8 @@ const char *socket_strerror(int err); const char *socket_ioerror(p_socket ps, int err); const char *socket_gaistrerror(int err); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* SOCKET_H */ diff --git a/src/tcp.h b/src/tcp.h index 9b12b53..9b282ef 100644 --- a/src/tcp.h +++ b/src/tcp.h @@ -30,10 +30,14 @@ typedef struct t_tcp_ { typedef t_tcp *p_tcp; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int tcp_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* TCP_H */ diff --git a/src/timeout.c b/src/timeout.c index 0e3ee27..2bdc069 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -26,10 +26,6 @@ #define MAX(x, y) ((x) > (y) ? x : y) #endif -#ifndef _WIN32 -#pragma GCC visibility push(hidden) -#endif - /*=========================================================================*\ * Internal function prototypes \*=========================================================================*/ @@ -228,7 +224,3 @@ int timeout_lua_sleep(lua_State *L) return 0; } #endif - -#ifndef _WIN32 -#pragma GCC visibility pop -#endif diff --git a/src/timeout.h b/src/timeout.h index df05eaf..9e5250d 100644 --- a/src/timeout.h +++ b/src/timeout.h @@ -14,7 +14,9 @@ typedef struct t_timeout_ { } t_timeout; typedef t_timeout *p_timeout; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif void timeout_init(p_timeout tm, double block, double total); double timeout_get(p_timeout tm); @@ -29,7 +31,9 @@ int timeout_open(lua_State *L); int timeout_meth_settimeout(lua_State *L, p_timeout tm); int timeout_meth_gettimeout(lua_State *L, p_timeout tm); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #define timeout_iszero(tm) ((tm)->block == 0.0) diff --git a/src/udp.h b/src/udp.h index 9e80ccd..07d5247 100644 --- a/src/udp.h +++ b/src/udp.h @@ -26,10 +26,14 @@ typedef struct t_udp_ { } t_udp; typedef t_udp *p_udp; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int udp_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* UDP_H */ diff --git a/src/unixdgram.h b/src/unixdgram.h index 433fe25..a1a0166 100644 --- a/src/unixdgram.h +++ b/src/unixdgram.h @@ -15,10 +15,14 @@ #include "unix.h" +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int unixdgram_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* UNIXDGRAM_H */ diff --git a/src/unixstream.h b/src/unixstream.h index 8ffba8f..7916aff 100644 --- a/src/unixstream.h +++ b/src/unixstream.h @@ -16,10 +16,14 @@ \*=========================================================================*/ #include "unix.h" +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int unixstream_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* UNIXSTREAM_H */ diff --git a/src/wsocket.c b/src/wsocket.c index 1da984c..20da330 100755 --- a/src/wsocket.c +++ b/src/wsocket.c @@ -12,10 +12,6 @@ #include "socket.h" #include "pierror.h" -#ifndef _WIN32 -#pragma GCC visibility push(hidden) -#endif - /* WinSock doesn't have a strerror... */ static const char *wstrerror(int err); @@ -436,7 +432,3 @@ const char *socket_gaistrerror(int err) { default: return gai_strerror(err); } } - -#ifndef _WIN32 -#pragma GCC visibility pop -#endif