From c2d9d8408869af50fd5802542a4f032375e5e7bc Mon Sep 17 00:00:00 2001 From: Aaron Dierking Date: Thu, 14 Jun 2018 11:38:32 -0700 Subject: [PATCH] Guard non-portable forwarded includes These headers are not available on Windows. ensures that __has_include() and __has_include_next() are defined. Signed-off-by: Guillem Jover --- include/bsd/err.h | 12 ++++++------ include/bsd/getopt.h | 6 ++++++ include/bsd/sys/endian.h | 6 ++++++ include/bsd/sys/time.h | 6 ++++++ include/bsd/unistd.h | 11 ++++++----- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/include/bsd/err.h b/include/bsd/err.h index 12fd051..cf043e4 100644 --- a/include/bsd/err.h +++ b/include/bsd/err.h @@ -26,20 +26,20 @@ */ #ifdef LIBBSD_OVERLAY +#include +#if __has_include_next() #include_next +#endif #else +#include +#if __has_include() #include #endif +#endif #ifndef LIBBSD_ERR_H #define LIBBSD_ERR_H -#ifdef LIBBSD_OVERLAY -#include -#else -#include -#endif - #include __BEGIN_DECLS diff --git a/include/bsd/getopt.h b/include/bsd/getopt.h index a6505e9..48c3be8 100644 --- a/include/bsd/getopt.h +++ b/include/bsd/getopt.h @@ -25,9 +25,15 @@ */ #ifdef LIBBSD_OVERLAY +#include +#if __has_include_next() #include_next +#endif #include #else +#include +#if __has_include() #include +#endif #include #endif diff --git a/include/bsd/sys/endian.h b/include/bsd/sys/endian.h index 1af844c..a4a8e9c 100644 --- a/include/bsd/sys/endian.h +++ b/include/bsd/sys/endian.h @@ -27,10 +27,16 @@ */ #ifdef LIBBSD_OVERLAY +#include +#if __has_include_next() #include_next +#endif #else +#include +#if __has_include() #include #endif +#endif #ifndef LIBBSD_SYS_ENDIAN_H #define LIBBSD_SYS_ENDIAN_H diff --git a/include/bsd/sys/time.h b/include/bsd/sys/time.h index 0aaf0e2..1eaa76b 100644 --- a/include/bsd/sys/time.h +++ b/include/bsd/sys/time.h @@ -33,10 +33,16 @@ */ #ifdef LIBBSD_OVERLAY +#include +#if __has_include_next() #include_next +#endif #else +#include +#if __has_include() #include #endif +#endif #ifndef LIBBSD_SYS_TIME_H #define LIBBSD_SYS_TIME_H diff --git a/include/bsd/unistd.h b/include/bsd/unistd.h index c25977d..167241b 100644 --- a/include/bsd/unistd.h +++ b/include/bsd/unistd.h @@ -26,19 +26,20 @@ */ #ifdef LIBBSD_OVERLAY +#include +#if __has_include_next() #include_next +#endif #else +#include +#if __has_include() #include #endif +#endif #ifndef LIBBSD_UNISTD_H #define LIBBSD_UNISTD_H -#ifdef LIBBSD_OVERLAY -#include -#else -#include -#endif #include #if !defined(S_ISTXT) && defined(S_ISVTX)