| From dec4f95751a103f132e9674adf184188ec69176f Mon Sep 17 00:00:00 2001 |
| From: PJ Reiniger <pj.reiniger@gmail.com> |
| Date: Tue, 26 Apr 2022 15:19:14 -0400 |
| Subject: [PATCH 3/9] Preprocessor cleanup |
| |
| --- |
| include/uv.h | 18 +----------------- |
| include/uv/unix.h | 8 -------- |
| include/uv/win.h | 6 +----- |
| 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(+), 30 deletions(-) |
| |
| diff --git a/include/uv.h b/include/uv.h |
| index ee1c94cc..dbaeb1e9 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." |
| @@ -56,11 +53,7 @@ extern "C" { |
| #include <stddef.h> |
| #include <stdio.h> |
| |
| -#if defined(_MSC_VER) && _MSC_VER < 1600 |
| -# include "uv/stdint-msvc2008.h" |
| -#else |
| -# include <stdint.h> |
| -#endif |
| +#include <stdint.h> |
| |
| #if defined(_WIN32) |
| # include "uv/win.h" |
| @@ -767,16 +760,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<uv_tty_mode_t>(mode)); |
| } |
| |
| -} |
| -#endif |
| - |
| UV_EXTERN uv_handle_type uv_guess_handle(uv_file file); |
| |
| /* |
| @@ -1844,7 +1831,4 @@ UV_EXTERN void uv_loop_set_data(uv_loop_t*, void* data); |
| #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 420be86c..256fef37 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/include/uv/win.h b/include/uv/win.h |
| index 10d5e8f1..0a33366f 100644 |
| --- a/include/uv/win.h |
| +++ b/include/uv/win.h |
| @@ -60,11 +60,7 @@ typedef struct pollfd { |
| #include <fcntl.h> |
| #include <sys/stat.h> |
| |
| -#if defined(_MSC_VER) && _MSC_VER < 1600 |
| -# include "uv/stdint-msvc2008.h" |
| -#else |
| -# include <stdint.h> |
| -#endif |
| +#include <stdint.h> |
| |
| #include "uv/tree.h" |
| #include "uv/threadpool.h" |
| diff --git a/src/unix/internal.h b/src/unix/internal.h |
| index f9d1666d..2b654157 100644 |
| --- a/src/unix/internal.h |
| +++ b/src/unix/internal.h |
| @@ -192,6 +192,8 @@ struct uv__stream_queued_fds_s { |
| #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 f71b3c04..71c9b169 100644 |
| --- a/src/win/fs.c |
| +++ b/src/win/fs.c |
| @@ -38,6 +38,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 d7522668..9753784d 100644 |
| --- a/src/win/tty.c |
| +++ b/src/win/tty.c |
| @@ -42,6 +42,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 c655f532..7a5dd2ef 100644 |
| --- a/src/win/util.c |
| +++ b/src/win/util.c |
| @@ -63,12 +63,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 a68b0953..7843e9f1 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; |