From 53e60a60fd5ec9bb974eafc71cd3b8fde55566b2 Mon Sep 17 00:00:00 2001 From: Sven Fink Date: Wed, 4 Dec 2024 09:58:24 +0100 Subject: [PATCH] fix: avoid macro replacements in includes Use strings in include strings definitions to avoid replacements by macros. This solves the issues with errno.h which could have end up in strange include errors, before. --- include/pistache/common.h | 6 +- include/pistache/eventmeth.h | 2 +- include/pistache/listener.h | 2 +- include/pistache/mailbox.h | 4 +- include/pistache/net.h | 10 +-- include/pistache/pist_timelog.h | 2 +- include/pistache/ps_basename.h | 2 +- include/pistache/pst_errno.h | 2 +- include/pistache/timer_pool.h | 2 +- include/pistache/transport.h | 2 +- include/pistache/winornix.h | 120 ++++++++++++++++---------------- src/client/client.cc | 8 +-- src/common/eventmeth.cc | 8 +-- src/common/http.cc | 8 +-- src/common/http_defs.cc | 2 +- src/common/http_header.cc | 2 +- src/common/net.cc | 8 +-- src/common/os.cc | 6 +- src/common/peer.cc | 6 +- src/common/pist_check.cc | 4 +- src/common/pist_strerror_r.cc | 11 ++- src/common/pist_syslog.cc | 10 +-- src/common/pist_timelog.cc | 2 +- src/common/reactor.cc | 4 +- src/common/stream.cc | 6 +- src/common/transport.cc | 4 +- src/common/utils.cc | 4 +- src/server/listener.cc | 16 ++--- tests/helpers_test.cc | 2 +- tests/listener_test.cc | 12 ++-- tests/net_test.cc | 8 +-- tests/tcp_client.h | 6 +- 32 files changed, 149 insertions(+), 142 deletions(-) diff --git a/include/pistache/common.h b/include/pistache/common.h index 7a88f2d28..c6d650c86 100644 --- a/include/pistache/common.h +++ b/include/pistache/common.h @@ -20,10 +20,10 @@ #include -#include PIST_QUOTE(PST_STRERROR_R_HDR) +#include PST_STRERROR_R_HDR -#include PIST_QUOTE(PST_NETDB_HDR) -#include PIST_QUOTE(PST_SOCKET_HDR) +#include PST_NETDB_HDR +#include PST_SOCKET_HDR #include diff --git a/include/pistache/eventmeth.h b/include/pistache/eventmeth.h index 6c96476c4..2b6ce6f1d 100644 --- a/include/pistache/eventmeth.h +++ b/include/pistache/eventmeth.h @@ -209,7 +209,7 @@ namespace Pistache #include #include -#include PIST_QUOTE(PST_FCNTL_HDR) // For FD_CLOEXEC and O_NONBLOCK +#include PST_FCNTL_HDR // For FD_CLOEXEC and O_NONBLOCK /* ------------------------------------------------------------------------- */ diff --git a/include/pistache/listener.h b/include/pistache/listener.h index 3a9c8280f..c86604f03 100644 --- a/include/pistache/listener.h +++ b/include/pistache/listener.h @@ -24,7 +24,7 @@ #include #include -#include PIST_QUOTE(PST_SYS_RESOURCE_HDR) +#include PST_SYS_RESOURCE_HDR #include #include diff --git a/include/pistache/mailbox.h b/include/pistache/mailbox.h index 8e262fcbc..79cbe8541 100644 --- a/include/pistache/mailbox.h +++ b/include/pistache/mailbox.h @@ -14,12 +14,12 @@ #include -#include PIST_QUOTE(PST_STRERROR_R_HDR) +#include PST_STRERROR_R_HDR #include #include -#include PIST_QUOTE(PIST_SOCKFNS_HDR) +#include PIST_SOCKFNS_HDR #include #include diff --git a/include/pistache/net.h b/include/pistache/net.h index 3bea8d179..1d5847e63 100644 --- a/include/pistache/net.h +++ b/include/pistache/net.h @@ -19,16 +19,16 @@ #include -#include PIST_QUOTE(PST_NETDB_HDR) +#include PST_NETDB_HDR // netinet/in.h defines in_port_t, in_addr_t, in_addr, sockaddr_in, // sockaddr_in6, IPPROTO_IP, INADDR_ANY, etc. -#include PIST_QUOTE(PST_NETINET_IN_HDR) +#include PST_NETINET_IN_HDR -#include PIST_QUOTE(PST_SOCKET_HDR) -#include PIST_QUOTE(PST_SYS_UN_HDR) +#include PST_SOCKET_HDR +#include PST_SYS_UN_HDR -#include PIST_QUOTE(PIST_SOCKFNS_HDR) +#include PIST_SOCKFNS_HDR #ifndef _KERNEL_FASTOPEN #define _KERNEL_FASTOPEN diff --git a/include/pistache/pist_timelog.h b/include/pistache/pist_timelog.h index 2d7395779..d0f63f9b4 100644 --- a/include/pistache/pist_timelog.h +++ b/include/pistache/pist_timelog.h @@ -19,7 +19,7 @@ #include #include // For _IS_BSD -#include PIST_QUOTE(PST_CLOCK_GETTIME_HDR) // for clock_gettime and asctime +#include PST_CLOCK_GETTIME_HDR // for clock_gettime and asctime #include // snprintf #include // for vsnprintf diff --git a/include/pistache/ps_basename.h b/include/pistache/ps_basename.h index 9bd659b77..26c0f48d5 100644 --- a/include/pistache/ps_basename.h +++ b/include/pistache/ps_basename.h @@ -13,7 +13,7 @@ #include -#include PIST_QUOTE(PST_MAXPATH_HDR) // for PST_MAXPATHLEN +#include PST_MAXPATH_HDR // for PST_MAXPATHLEN /* ------------------------------------------------------------------------- */ #ifdef __APPLE__ diff --git a/include/pistache/pst_errno.h b/include/pistache/pst_errno.h index 9f08900ec..6bc0470c6 100644 --- a/include/pistache/pst_errno.h +++ b/include/pistache/pst_errno.h @@ -8,7 +8,7 @@ // // Note that we use this intermediate include, rather than just relying solely // on defining PST_ERRNO_HDR to be 'errno.h' for Windows, because of mingw -// gcc's treatment of errno as a macro - 'include PIST_QUOTE(PST_ERRNO_HDR)', +// gcc's treatment of errno as a macro - 'include PST_ERRNO_HDR', // with PST_ERRNO_HDR defined as 'errno.h', can translate to "(*_errno()).h", // which is not what we want. // diff --git a/include/pistache/timer_pool.h b/include/pistache/timer_pool.h index 2cb262930..08e22d4af 100644 --- a/include/pistache/timer_pool.h +++ b/include/pistache/timer_pool.h @@ -25,7 +25,7 @@ #include #include -#include PIST_QUOTE(PST_MISC_IO_HDR) // e.g. unistd.h +#include PST_MISC_IO_HDR // e.g. unistd.h namespace Pistache { diff --git a/include/pistache/transport.h b/include/pistache/transport.h index 6245e6759..d316309eb 100644 --- a/include/pistache/transport.h +++ b/include/pistache/transport.h @@ -14,7 +14,7 @@ #include -#include PIST_QUOTE(PST_SYS_RESOURCE_HDR) // for PST_RUSAGE + PST_GETRUSAGE +#include PST_SYS_RESOURCE_HDR // for PST_RUSAGE + PST_GETRUSAGE #include #include diff --git a/include/pistache/winornix.h b/include/pistache/winornix.h index b1151d156..e849bb0a0 100644 --- a/include/pistache/winornix.h +++ b/include/pistache/winornix.h @@ -12,8 +12,6 @@ #ifndef _WINORNIX_H_ #define _WINORNIX_H_ -#include - // DO NOT include emosandlibevdefs.h here // emosandlibevdefs.h includes winornix.h, and depends on it @@ -66,11 +64,11 @@ #define PST_GETRUSAGE getrusage #endif -// Use #include PIST_QUOTE(PST_SYS_RESOURCE_HDR) +// Use #include PST_SYS_RESOURCE_HDR #ifdef _IS_WINDOWS -#define PST_SYS_RESOURCE_HDR pistache/pist_resource.h +#define PST_SYS_RESOURCE_HDR "pistache/pist_resource.h" #else -#define PST_SYS_RESOURCE_HDR sys/resource.h +#define PST_SYS_RESOURCE_HDR "sys/resource.h" #endif #ifdef _IS_WINDOWS @@ -150,45 +148,45 @@ typedef int PST_SOCK_OPT_VAL_T; // #define PST_CLOCK_BOOTTIME_ALARM CLOCK_BOOTTIME_ALARM #endif -// Use #include PIST_QUOTE(PST_CLOCK_GETTIME_HDR) +// Use #include PST_CLOCK_GETTIME_HDR #ifdef _IS_WINDOWS -#define PST_CLOCK_GETTIME_HDR pistache/pist_clock_gettime.h +#define PST_CLOCK_GETTIME_HDR "pistache/pist_clock_gettime.h" #else -#define PST_CLOCK_GETTIME_HDR time.h +#define PST_CLOCK_GETTIME_HDR "time.h" #endif -// Use #include PIST_QUOTE(PST_IFADDRS_HDR) +// Use #include PST_IFADDRS_HDR #ifdef _IS_WINDOWS -#define PST_IFADDRS_HDR pistache/pist_ifaddrs.h +#define PST_IFADDRS_HDR "pistache/pist_ifaddrs.h" #else -#define PST_IFADDRS_HDR ifaddrs.h +#define PST_IFADDRS_HDR "ifaddrs.h" #endif -// Use #include PIST_QUOTE(PST_MAXPATH_HDR) +// Use #include PST_MAXPATH_HDR #ifdef _IS_WINDOWS -#define PST_MAXPATH_HDR Stdlib.h +#define PST_MAXPATH_HDR "Stdlib.h" #define PST_MAXPATHLEN _MAX_PATH #elif defined __APPLE__ -#define PST_MAXPATH_HDR sys/syslimits.h +#define PST_MAXPATH_HDR "sys/syslimits.h" #define PST_MAXPATHLEN PATH_MAX #else -#define PST_MAXPATH_HDR sys/param.h +#define PST_MAXPATH_HDR "sys/param.h" #define PST_MAXPATHLEN MAXPATHLEN #endif // Do this so the PST_DECL_SE_ERR_P_EXTRA / PST_STRERROR_R_ERRNO macros have // PST_MAXPATHLEN fully defined -#include PIST_QUOTE(PST_MAXPATH_HDR) +#include PST_MAXPATH_HDR -// Use #include PIST_QUOTE(PST_STRERROR_R_HDR) +// Use #include PST_STRERROR_R_HDR // mingw gcc doesn't define strerror_r (Oct/2024) // gcc on macOS does define strerror_r, but the XSI version not the POSIX one #if defined(__linux__) || (defined(__GNUC__) && (!defined(__MINGW32__)) && \ (!defined(__clang__)) && (!defined(__NetBSD__)) && (!defined(__APPLE__))) -#define PST_STRERROR_R_HDR string.h +#define PST_STRERROR_R_HDR "string.h" #define PST_STRERROR_R strerror_r // returns char * #else -#define PST_STRERROR_R_HDR pistache/pist_strerror_r.h +#define PST_STRERROR_R_HDR "pistache/pist_strerror_r.h" #define PST_STRERROR_R pist_strerror_r // returns char * #endif @@ -204,9 +202,9 @@ typedef int PST_SOCK_OPT_VAL_T; #define PST_DBG_DECL_SE_ERR_P_EXTRA #endif -// Use #include PIST_QUOTE(PST_FCNTL_HDR) +// Use #include PST_FCNTL_HDR #ifdef _IS_WINDOWS -#define PST_FCNTL_HDR pistache/pist_fcntl.h +#define PST_FCNTL_HDR "pistache/pist_fcntl.h" #define PST_FCNTL pist_fcntl // As per Linux /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h @@ -216,7 +214,7 @@ typedef int PST_SOCK_OPT_VAL_T; #define PST_F_SETFL 4 /* Set file status flags. */ #else -#define PST_FCNTL_HDR fcntl.h +#define PST_FCNTL_HDR "fcntl.h" #define PST_FCNTL fcntl #define PST_F_GETFD F_GETFD @@ -229,60 +227,60 @@ typedef int PST_SOCK_OPT_VAL_T; (static_cast((static_cast((-1)/2))) - (0xded - 97)) -// Use #include PIST_QUOTE(PST_NETDB_HDR) +// Use #include PST_NETDB_HDR #ifdef _IS_WINDOWS -#define PST_NETDB_HDR ws2tcpip.h +#define PST_NETDB_HDR "ws2tcpip.h" #else -#define PST_NETDB_HDR netdb.h +#define PST_NETDB_HDR "netdb.h" #endif -// Use #include PIST_QUOTE(PST_SOCKET_HDR) +// Use #include PST_SOCKET_HDR #ifdef _IS_WINDOWS -#define PST_SOCKET_HDR winsock2.h +#define PST_SOCKET_HDR "winsock2.h" #else -#define PST_SOCKET_HDR sys/socket.h +#define PST_SOCKET_HDR "sys/socket.h" #endif -// Use #include PIST_QUOTE(PST_ARPA_INET_HDR) +// Use #include PST_ARPA_INET_HDR #ifdef _IS_WINDOWS -#define PST_ARPA_INET_HDR winsock2.h +#define PST_ARPA_INET_HDR "winsock2.h" #else -#define PST_ARPA_INET_HDR arpa/inet.h +#define PST_ARPA_INET_HDR "arpa/inet.h" #endif -// Use #include PIST_QUOTE(PST_NETINET_IN_HDR) +// Use #include PST_NETINET_IN_HDR #ifdef _IS_WINDOWS -#define PST_NETINET_IN_HDR ws2def.h +#define PST_NETINET_IN_HDR "ws2def.h" #else -#define PST_NETINET_IN_HDR netinet/in.h +#define PST_NETINET_IN_HDR "netinet/in.h" #endif -// Use #include PIST_QUOTE(PST_NETINET_TCP_HDR) +// Use #include PST_NETINET_TCP_HDR #ifdef _IS_WINDOWS -#define PST_NETINET_TCP_HDR winsock2.h +#define PST_NETINET_TCP_HDR "winsock2.h" #else -#define PST_NETINET_TCP_HDR netinet/tcp.h +#define PST_NETINET_TCP_HDR "netinet/tcp.h" #endif -// Use #include PIST_QUOTE(PST_IFADDRS_HDR) +// Use #include PST_IFADDRS_HDR #ifdef _IS_WINDOWS -#define PST_IFADDRS_HDR pistache/pist_ifaddrs.h +#define PST_IFADDRS_HDR "pistache/pist_ifaddrs.h" #define PST_IFADDRS pist_ifaddrs #define PST_GETIFADDRS pist_getifaddrs #define PST_FREEIFADDRS pist_freeifaddrs #else -#define PST_IFADDRS_HDR ifaddrs.h +#define PST_IFADDRS_HDR "ifaddrs.h" #define PST_IFADDRS ifaddrs #define PST_GETIFADDRS getifaddrs #define PST_FREEIFADDRS freeifaddrs #endif -// Use #include PIST_QUOTE(PST_SYS_UN_HDR) +// Use #include PST_SYS_UN_HDR #ifdef _IS_WINDOWS -#define PST_SYS_UN_HDR afunix.h +#define PST_SYS_UN_HDR "afunix.h" #else -#define PST_SYS_UN_HDR sys/un.h +#define PST_SYS_UN_HDR "sys/un.h" #endif @@ -300,56 +298,56 @@ typedef struct in_addr PST_IN_ADDR_T; -// Use #include PIST_QUOTE(PST_THREAD_HDR) +// Use #include PST_THREAD_HDR #ifdef _IS_WINDOWS // Note: processthreadsapi.h appears to require the prior inclusion of // windows.h as well. // So make sure to include PST_THREAD_HDR only in C/C++ files, not in a header // file where it could end up including the massive windows.h all over the // place. -#define PST_THREAD_HDR processthreadsapi.h +#define PST_THREAD_HDR "processthreadsapi.h" #else -#define PST_THREAD_HDR pthread.h +#define PST_THREAD_HDR "pthread.h" #endif -// Use #include PIST_QUOTE(PST_ERRNO_HDR) +// Use #include PST_ERRNO_HDR #ifndef __linux__ // pistache/pst_errno.h prevents mingw gcc's bad macro substitution on errno // Same issue with clang on macOS and gcc on OpenBSD -#define PST_ERRNO_HDR pistache/pst_errno.h +#define PST_ERRNO_HDR "pistache/pst_errno.h" #else -#define PST_ERRNO_HDR sys/errno.h +#define PST_ERRNO_HDR "sys/errno.h" #endif -// Use #include PIST_QUOTE(PST_MISC_IO_HDR) +// Use #include PST_MISC_IO_HDR #ifdef _IS_WINDOWS -#define PST_MISC_IO_HDR io.h +#define PST_MISC_IO_HDR "io.h" // For _close etc. #else -#define PST_MISC_IO_HDR unistd.h +#define PST_MISC_IO_HDR "unistd.h" #endif -// Use #include PIST_QUOTE(PIST_FILEFNS_HDR) +// Use #include PIST_FILEFNS_HDR #ifdef _IS_WINDOWS -#define PIST_FILEFNS_HDR pistache/pist_filefns.h +#define PIST_FILEFNS_HDR "pistache/pist_filefns.h" #else // unistd.h defines pread -#define PIST_FILEFNS_HDR unistd.h +#define PIST_FILEFNS_HDR "unistd.h" #endif -// Use #include PIST_QUOTE(PIST_POLL_HDR) +// Use #include PIST_POLL_HDR #ifdef _IS_WINDOWS -#define PIST_POLL_HDR pistache/pist_sockfns.h +#define PIST_POLL_HDR "pistache/pist_sockfns.h" #else -#define PIST_POLL_HDR poll.h +#define PIST_POLL_HDR "poll.h" #endif -// Use #include PIST_QUOTE(PIST_SOCKFNS_HDR) +// Use #include PIST_SOCKFNS_HDR #ifdef _IS_WINDOWS -#define PIST_SOCKFNS_HDR pistache/pist_sockfns.h +#define PIST_SOCKFNS_HDR "pistache/pist_sockfns.h" #else // unistd.h defines pread -#define PIST_SOCKFNS_HDR unistd.h // has close, read and write in Linux +#define PIST_SOCKFNS_HDR "unistd.h" // has close, read and write in Linux #endif // PST_SOCK_xxx macros are for sockets. For files, use PST_FILE_xxx diff --git a/src/client/client.cc b/src/client/client.cc index 94283005a..3e05b3285 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -19,14 +19,14 @@ #include #include -#include PIST_QUOTE(PST_NETDB_HDR) -#include PIST_QUOTE(PST_SOCKET_HDR) -#include PIST_QUOTE(PIST_SOCKFNS_HDR) +#include PST_NETDB_HDR +#include PST_SOCKET_HDR +#include PIST_SOCKFNS_HDR // ps_sendfile.h includes sys/uio.h in macOS, and sys/sendfile.h in Linux #include -#include PIST_QUOTE(PST_STRERROR_R_HDR) +#include PST_STRERROR_R_HDR #include diff --git a/src/common/eventmeth.cc b/src/common/eventmeth.cc index e67c2ec40..9fbd424e2 100644 --- a/src/common/eventmeth.cc +++ b/src/common/eventmeth.cc @@ -5,7 +5,7 @@ */ #include -#include PIST_QUOTE(PST_ERRNO_HDR) +#include PST_ERRNO_HDR #include #include @@ -748,9 +748,9 @@ namespace Pistache #include #include -#include PIST_QUOTE(PST_MISC_IO_HDR) // unistd.h, for close -#include PIST_QUOTE(PST_FCNTL_HDR) -#include PIST_QUOTE(PIST_SOCKFNS_HDR) // socket read, write and close +#include PST_MISC_IO_HDR // unistd.h, for close +#include PST_FCNTL_HDR +#include PIST_SOCKFNS_HDR // socket read, write and close #include diff --git a/src/common/http.cc b/src/common/http.cc index 9c52f3ab7..03f1695f2 100644 --- a/src/common/http.cc +++ b/src/common/http.cc @@ -20,7 +20,7 @@ #include #include -#include PIST_QUOTE(PST_STRERROR_R_HDR) +#include PST_STRERROR_R_HDR #include #include @@ -33,10 +33,10 @@ #include #include // for file-constants (_O_RDONLY etc.) in Windows -#include PIST_QUOTE(PST_FCNTL_HDR) // for function fcntl() +#include PST_FCNTL_HDR // for function fcntl() -#include PIST_QUOTE(PST_MISC_IO_HDR) // for _close (io.h / unistd.h) -#include PIST_QUOTE(PIST_FILEFNS_HDR) // for "open" +#include PST_MISC_IO_HDR // for _close (io.h / unistd.h) +#include PIST_FILEFNS_HDR // for "open" #include #include diff --git a/src/common/http_defs.cc b/src/common/http_defs.cc index a31dbc7fb..e1d525d08 100644 --- a/src/common/http_defs.cc +++ b/src/common/http_defs.cc @@ -24,7 +24,7 @@ #endif #include -#include PIST_QUOTE(PST_CLOCK_GETTIME_HDR) +#include PST_CLOCK_GETTIME_HDR namespace Pistache::Http { diff --git a/src/common/http_header.cc b/src/common/http_header.cc index 78f00a1e8..3b6dbebbe 100644 --- a/src/common/http_header.cc +++ b/src/common/http_header.cc @@ -29,7 +29,7 @@ #include #include -#include PIST_QUOTE(PST_SOCKET_HDR) +#include PST_SOCKET_HDR namespace Pistache::Http::Header { diff --git a/src/common/net.cc b/src/common/net.cc index a5f46c0ca..6892bf2fc 100644 --- a/src/common/net.cc +++ b/src/common/net.cc @@ -26,12 +26,12 @@ #include -#include PIST_QUOTE(PST_ARPA_INET_HDR) +#include PST_ARPA_INET_HDR -#include PIST_QUOTE(PST_IFADDRS_HDR) +#include PST_IFADDRS_HDR -#include PIST_QUOTE(PST_NETDB_HDR) -#include PIST_QUOTE(PST_SOCKET_HDR) +#include PST_NETDB_HDR +#include PST_SOCKET_HDR #include diff --git a/src/common/os.cc b/src/common/os.cc index 2d27c07d8..9890936b3 100644 --- a/src/common/os.cc +++ b/src/common/os.cc @@ -16,8 +16,8 @@ #include #include -#include PIST_QUOTE(PST_FCNTL_HDR) -#include PIST_QUOTE(PIST_SOCKFNS_HDR) +#include PST_FCNTL_HDR +#include PIST_SOCKFNS_HDR #include @@ -27,7 +27,7 @@ #include #endif -#include PIST_QUOTE(PST_MISC_IO_HDR) // unistd.h e.g. close +#include PST_MISC_IO_HDR // unistd.h e.g. close #include #include diff --git a/src/common/peer.cc b/src/common/peer.cc index 5aa178506..2b4195710 100644 --- a/src/common/peer.cc +++ b/src/common/peer.cc @@ -14,9 +14,9 @@ #include #include -#include PIST_QUOTE(PST_ARPA_INET_HDR) -#include PIST_QUOTE(PST_NETDB_HDR) -#include PIST_QUOTE(PST_SOCKET_HDR) +#include PST_ARPA_INET_HDR +#include PST_NETDB_HDR +#include PST_SOCKET_HDR #include diff --git a/src/common/pist_check.cc b/src/common/pist_check.cc index c8d8d8406..81a8102b7 100644 --- a/src/common/pist_check.cc +++ b/src/common/pist_check.cc @@ -18,7 +18,7 @@ #include #include -#include PIST_QUOTE(PST_MISC_IO_HDR) // unistd.h e.g. close +#include PST_MISC_IO_HDR // unistd.h e.g. close #include #include @@ -34,7 +34,7 @@ #include // Dl_info #endif -#include PIST_QUOTE(PST_MAXPATH_HDR) // for PST_MAXPATHLEN +#include PST_MAXPATH_HDR // for PST_MAXPATHLEN #include // for PS_BASENAME_R diff --git a/src/common/pist_strerror_r.cc b/src/common/pist_strerror_r.cc index 926b13734..8b7d7e2c0 100644 --- a/src/common/pist_strerror_r.cc +++ b/src/common/pist_strerror_r.cc @@ -12,7 +12,16 @@ #include #include -#include PIST_QUOTE(PST_ERRNO_HDR) +// #ifdef errno +// #error "already defined" +// #endif + +// // PIST_Q(PST_ERRNO_HDR) +// PST_ERRNO_HDR + + +// #include PST_ERRNO_HDR +#include PST_ERRNO_HDR /* ------------------------------------------------------------------------- */ diff --git a/src/common/pist_syslog.cc b/src/common/pist_syslog.cc index 57cc649aa..c53e05fa8 100644 --- a/src/common/pist_syslog.cc +++ b/src/common/pist_syslog.cc @@ -22,7 +22,7 @@ #include // snprintf #include // malloc -#include PIST_QUOTE(PST_CLOCK_GETTIME_HDR) +#include PST_CLOCK_GETTIME_HDR #include #include @@ -39,7 +39,7 @@ #include // std::remove_copy_if #include // #include // PATH_MAX -#include PIST_QUOTE(PST_MAXPATH_HDR) +#include PST_MAXPATH_HDR #ifdef __APPLE__ #include // _NSGetExecutablePath @@ -168,12 +168,12 @@ #include #include // for strcat -#include PIST_QUOTE(PST_THREAD_HDR) // for pthread_self (getting thread ID) +#include PST_THREAD_HDR // for pthread_self (getting thread ID) -#include PIST_QUOTE(PST_MAXPATH_HDR) +#include PST_MAXPATH_HDR #include // for getpid() -#include PIST_QUOTE(PST_MISC_IO_HDR) // unistd.h e.g. close +#include PST_MISC_IO_HDR // unistd.h e.g. close #include "pistache/pist_syslog.h" #include // for std::shared_ptr diff --git a/src/common/pist_timelog.cc b/src/common/pist_timelog.cc index 5962586fd..e2c93c600 100644 --- a/src/common/pist_timelog.cc +++ b/src/common/pist_timelog.cc @@ -16,7 +16,7 @@ #ifdef _IS_WINDOWS #include // required for PST_THREAD_HDR (processthreadsapi.h) #endif -#include PIST_QUOTE(PST_THREAD_HDR) //e.g. pthread.h +#include PST_THREAD_HDR //e.g. pthread.h #ifdef DEBUG #include diff --git a/src/common/reactor.cc b/src/common/reactor.cc index c1b538cf4..9c11dc4d9 100644 --- a/src/common/reactor.cc +++ b/src/common/reactor.cc @@ -25,7 +25,7 @@ #ifdef _IS_BSD // For pthread_set_name_np -#include PIST_QUOTE(PST_THREAD_HDR) +#include PST_THREAD_HDR #ifndef __NetBSD__ #include #endif @@ -33,7 +33,7 @@ #ifdef _IS_WINDOWS #include // Needed for PST_THREAD_HDR (processthreadsapi.h) -#include PIST_QUOTE(PST_THREAD_HDR) // for SetThreadDescription +#include PST_THREAD_HDR // for SetThreadDescription #endif #ifdef _IS_WINDOWS diff --git a/src/common/stream.cc b/src/common/stream.cc index 2a2350f15..d74580166 100644 --- a/src/common/stream.cc +++ b/src/common/stream.cc @@ -20,12 +20,12 @@ #include // Needs this as well in Windows for file-open constants -#include PIST_QUOTE(PST_FCNTL_HDR) +#include PST_FCNTL_HDR #include #include -#include PIST_QUOTE(PST_MISC_IO_HDR) // unistd.h e.g. close -#include PIST_QUOTE(PIST_FILEFNS_HDR) // PST_FILE_OPEN +#include PST_MISC_IO_HDR // unistd.h e.g. close +#include PIST_FILEFNS_HDR // PST_FILE_OPEN namespace Pistache { diff --git a/src/common/transport.cc b/src/common/transport.cc index dd5bdd383..b2b0b5605 100644 --- a/src/common/transport.cc +++ b/src/common/transport.cc @@ -32,9 +32,9 @@ // ps_sendfile.h includes sys/uio.h in macOS, and sys/sendfile.h in Linux #include -#include PIST_QUOTE(PST_MISC_IO_HDR) // unistd.h/lseek in BSD. +#include PST_MISC_IO_HDR // unistd.h/lseek in BSD. -#include PIST_QUOTE(PIST_SOCKFNS_HDR) // socket read, write and close +#include PIST_SOCKFNS_HDR // socket read, write and close #ifndef _USE_LIBEVENT_LIKE_APPLE // Note: sys/timerfd.h is linux-only (and certainly POSIX only) diff --git a/src/common/utils.cc b/src/common/utils.cc index ae62daa43..6cb8d2ea9 100644 --- a/src/common/utils.cc +++ b/src/common/utils.cc @@ -14,8 +14,8 @@ #include -#include PIST_QUOTE(PST_MISC_IO_HDR) // unistd.h e.g. close -#include PIST_QUOTE(PIST_FILEFNS_HDR) // for pist_pread +#include PST_MISC_IO_HDR // unistd.h e.g. close +#include PIST_FILEFNS_HDR // for pist_pread #ifdef PISTACHE_USE_SSL diff --git a/src/server/listener.cc b/src/server/listener.cc index 8157207f1..2601fb1c1 100644 --- a/src/server/listener.cc +++ b/src/server/listener.cc @@ -19,22 +19,22 @@ #include #include -#include PIST_QUOTE(PST_ARPA_INET_HDR) -#include PIST_QUOTE(PST_NETDB_HDR) -#include PIST_QUOTE(PST_NETINET_IN_HDR) -#include PIST_QUOTE(PST_NETINET_TCP_HDR) +#include PST_ARPA_INET_HDR +#include PST_NETDB_HDR +#include PST_NETINET_IN_HDR +#include PST_NETINET_TCP_HDR #include -#include PIST_QUOTE(PST_MISC_IO_HDR) // unistd.h e.g. close -#include PIST_QUOTE(PST_FCNTL_HDR) -#include PIST_QUOTE(PIST_SOCKFNS_HDR) // socket read, write and close +#include PST_MISC_IO_HDR // unistd.h e.g. close +#include PST_FCNTL_HDR +#include PIST_SOCKFNS_HDR // socket read, write and close #ifndef _USE_LIBEVENT #include #endif -#include PIST_QUOTE(PST_SOCKET_HDR) +#include PST_SOCKET_HDR #ifndef _USE_LIBEVENT_LIKE_APPLE // Note: sys/timerfd.h is linux-only (and certainly POSIX only) diff --git a/tests/helpers_test.cc b/tests/helpers_test.cc index 69cf14149..65a9eee2e 100644 --- a/tests/helpers_test.cc +++ b/tests/helpers_test.cc @@ -13,7 +13,7 @@ #include #include -#include PIST_QUOTE(PIST_SOCKFNS_HDR) // e.g. unistd.h +#include PIST_SOCKFNS_HDR // e.g. unistd.h using namespace Pistache; diff --git a/tests/listener_test.cc b/tests/listener_test.cc index 4516a8b2e..be7799eba 100644 --- a/tests/listener_test.cc +++ b/tests/listener_test.cc @@ -7,18 +7,18 @@ #include #include -#include PIST_QUOTE(PST_ARPA_INET_HDR) -#include PIST_QUOTE(PST_NETDB_HDR) -#include PIST_QUOTE(PST_NETINET_IN_HDR) +#include PST_ARPA_INET_HDR +#include PST_NETDB_HDR +#include PST_NETINET_IN_HDR #include #include -#include PIST_QUOTE(PST_SOCKET_HDR) -#include PIST_QUOTE(PIST_SOCKFNS_HDR) +#include PST_SOCKET_HDR +#include PIST_SOCKFNS_HDR #include -#include PIST_QUOTE(PST_MISC_IO_HDR) // unistd.h +#include PST_MISC_IO_HDR // unistd.h #include #include diff --git a/tests/net_test.cc b/tests/net_test.cc index 708384f34..5c025e49f 100644 --- a/tests/net_test.cc +++ b/tests/net_test.cc @@ -14,10 +14,10 @@ #include #include -#include PIST_QUOTE(PST_ARPA_INET_HDR) -#include PIST_QUOTE(PST_NETDB_HDR) -#include PIST_QUOTE(PST_NETINET_IN_HDR) -#include PIST_QUOTE(PST_SYS_UN_HDR) +#include PST_ARPA_INET_HDR +#include PST_NETDB_HDR +#include PST_NETINET_IN_HDR +#include PST_SYS_UN_HDR using namespace Pistache; using testing::Eq; diff --git a/tests/tcp_client.h b/tests/tcp_client.h index b014d6dcf..52ece65e3 100644 --- a/tests/tcp_client.h +++ b/tests/tcp_client.h @@ -10,9 +10,9 @@ #include #include -#include PIST_QUOTE(PST_NETDB_HDR) -#include PIST_QUOTE(PIST_POLL_HDR) -#include PIST_QUOTE(PST_SOCKET_HDR) // best in C/C++, not .h, for non-test code +#include PST_NETDB_HDR +#include PIST_POLL_HDR +#include PST_SOCKET_HDR // best in C/C++, not .h, for non-test code #include