From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 26 Apr 2022 15:19:14 -0400 Subject: [PATCH 4/9] Preprocessor cleanup --- include/uv.h | 12 ------------ include/uv/unix.h | 8 -------- src/unix/darwin-syscalls.h | 2 ++ src/unix/internal.h | 2 ++ src/win/fs.c | 1 + src/win/tty.c | 2 ++ src/win/util.c | 8 ++++++++ src/win/winsock.c | 1 + 8 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/uv.h b/include/uv.h index 9e450c5110fe57117b686bf683cc6631f37efaeb..d8d59a03512eff879d9688c09fb4a9a57a82ffb7 100644 --- a/include/uv.h +++ b/include/uv.h @@ -23,9 +23,6 @@ #ifndef UV_H #define UV_H -#ifdef __cplusplus -extern "C" { -#endif #if defined(BUILDING_UV_SHARED) && defined(USING_UV_SHARED) #error "Define either BUILDING_UV_SHARED or USING_UV_SHARED, not both." @@ -824,16 +821,10 @@ UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height); UV_EXTERN void uv_tty_set_vterm_state(uv_tty_vtermstate_t state); UV_EXTERN int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state); -#ifdef __cplusplus -extern "C++" { - inline int uv_tty_set_mode(uv_tty_t* handle, int mode) { return uv_tty_set_mode(handle, static_cast(mode)); } -} -#endif - UV_EXTERN uv_handle_type uv_guess_handle(uv_file file); enum { @@ -1964,7 +1955,4 @@ UV_EXTERN void uv_wtf8_to_utf16(const char* wtf8, #undef UV_LOOP_PRIVATE_PLATFORM_FIELDS #undef UV__ERR -#ifdef __cplusplus -} -#endif #endif /* UV_H */ diff --git a/include/uv/unix.h b/include/uv/unix.h index 538f98b6c5d657169e2750a549dd82bf0b948542..2073fe61a569386cc850d733a6c94cbb77a0a369 100644 --- a/include/uv/unix.h +++ b/include/uv/unix.h @@ -47,14 +47,6 @@ #if defined(__linux__) # include "uv/linux.h" -#elif defined (__MVS__) -# include "uv/os390.h" -#elif defined(__PASE__) /* __PASE__ and _AIX are both defined on IBM i */ -# include "uv/posix.h" /* IBM i needs uv/posix.h, not uv/aix.h */ -#elif defined(_AIX) -# include "uv/aix.h" -#elif defined(__sun) -# include "uv/sunos.h" #elif defined(__APPLE__) # include "uv/darwin.h" #elif defined(__DragonFly__) || \ diff --git a/src/unix/darwin-syscalls.h b/src/unix/darwin-syscalls.h index dc2d1bd234b1f12e39b7e76d6e290c15b19a3735..851af81c74e5b5d62f5f7e72da84703c15eace90 100644 --- a/src/unix/darwin-syscalls.h +++ b/src/unix/darwin-syscalls.h @@ -11,7 +11,9 @@ struct mmsghdr { size_t msg_len; }; +extern "C" { ssize_t recvmsg_x(int s, const struct mmsghdr* msgp, u_int cnt, int flags); ssize_t sendmsg_x(int s, const struct mmsghdr* msgp, u_int cnt, int flags); +} #endif /* UV_DARWIN_SYSCALLS_H_ */ diff --git a/src/unix/internal.h b/src/unix/internal.h index 1daf4d81da3a5bf931c4a5db8fd9116c4c303012..9377e970c4a7adafb8195974f6dc5ba40437ef1a 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -237,6 +237,8 @@ struct uv__statx { #if defined(__linux__) && O_NDELAY != O_NONBLOCK #undef uv__nonblock #define uv__nonblock uv__nonblock_fcntl +#undef UV__NONBLOCK_IS_IOCTL +#define UV__NONBLOCK_IS_FCNTL #endif /* core */ diff --git a/src/win/fs.c b/src/win/fs.c index f1966ab5c0245af0f56ca407a1697a5c8609ebb4..572a82dca3cbcdb7829241dd520e8f34591d81e9 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -43,6 +43,7 @@ #include "handle-inl.h" #include "fs-fd-hash-inl.h" +#pragma comment(lib, "Advapi32.lib") #define UV_FS_FREE_PATHS 0x0002 #define UV_FS_FREE_PTR 0x0008 diff --git a/src/win/tty.c b/src/win/tty.c index 62ddf32f0fbd29664dd05c6ba426532a2faf4668..9a4252d9d89d82fdd316312cc4550dd3c0fe798d 100644 --- a/src/win/tty.c +++ b/src/win/tty.c @@ -37,6 +37,8 @@ #include "stream-inl.h" #include "req-inl.h" +#pragma comment(lib, "User32.lib") + #ifndef InterlockedOr # define InterlockedOr _InterlockedOr #endif diff --git a/src/win/util.c b/src/win/util.c index 1aca4e9a081cd7e4481503d59f39872acbbc6a9c..1239831dcc0c5fdb8e267d4dd8e73cb73fdc88c9 100644 --- a/src/win/util.c +++ b/src/win/util.c @@ -64,12 +64,20 @@ /* A RtlGenRandom() by any other name... */ +extern "C" { extern BOOLEAN NTAPI SystemFunction036(PVOID Buffer, ULONG BufferLength); +} /* Cached copy of the process title, plus a mutex guarding it. */ static char *process_title; static CRITICAL_SECTION process_title_lock; +#pragma comment(lib, "Advapi32.lib") +#pragma comment(lib, "IPHLPAPI.lib") +#pragma comment(lib, "Psapi.lib") +#pragma comment(lib, "Userenv.lib") +#pragma comment(lib, "kernel32.lib") + /* Frequency of the high-resolution clock. */ static uint64_t hrtime_frequency_ = 0; diff --git a/src/win/winsock.c b/src/win/winsock.c index a68b095366a78e78675b49a078749f45dbad6015..7843e9f13321c32419cebaacde82d30f471e11d7 100644 --- a/src/win/winsock.c +++ b/src/win/winsock.c @@ -25,6 +25,7 @@ #include "uv.h" #include "internal.h" +#pragma comment(lib, "Ws2_32.lib") /* Whether there are any non-IFS LSPs stacked on TCP */ int uv_tcp_non_ifs_lsp_ipv4;