From 49bbaacc79dc73ed797450aa94463106b18d2a5d Mon Sep 17 00:00:00 2001 From: Justin Brewer Date: Fri, 13 Apr 2018 14:40:34 -0500 Subject: Strip down fmacros.h strerror_r and addrinfo require _POSIX_C_SOURCE >= 200112L, which is implied by _XOPEN_SOURCE >= 600. With the removal of AF_LOCAL usage, the only non-standard features being used are the TCP_KEEP* socket flags. _DARWIN_C_SOURCE is required to expose TCP_KEEPALIVE. Fall back to using _XOPEN_SOURCE 600 for all platforms, and additionally define _DARWIN_C_SOURCE for Darwin. Signed-off-by: Justin Brewer --- fmacros.h | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'fmacros.h') diff --git a/fmacros.h b/fmacros.h index 4cdbc13..3227faa 100644 --- a/fmacros.h +++ b/fmacros.h @@ -1,38 +1,12 @@ #ifndef __HIREDIS_FMACRO_H #define __HIREDIS_FMACRO_H -#if defined(__linux__) -#define _BSD_SOURCE -#define _DEFAULT_SOURCE -#endif - -#if defined(__CYGWIN__) -#include -#endif - -#if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) #define _XOPEN_SOURCE 600 -#elif defined(__APPLE__) && defined(__MACH__) -#define _XOPEN_SOURCE -#elif defined(__FreeBSD__) -// intentionally left blank, don't define _XOPEN_SOURCE -#elif defined(AIX) -// intentionally left blank, don't define _XOPEN_SOURCE -#else -#define _XOPEN_SOURCE -#endif - -#if defined(__sun__) #define _POSIX_C_SOURCE 200112L -#endif #if defined(__APPLE__) && defined(__MACH__) -#define _OSX -#endif - -#ifndef AIX -# define _XOPEN_SOURCE_EXTENDED 1 -# define _ALL_SOURCE +/* Enable TCP_KEEPALIVE */ +#define _DARWIN_C_SOURCE #endif #endif -- cgit v1.2.3