]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
Guard non-portable forwarded includes
authorAaron Dierking <aarond@fb.com>
Thu, 14 Jun 2018 18:38:32 +0000 (11:38 -0700)
committerGuillem Jover <guillem@hadrons.org>
Mon, 18 Jun 2018 02:31:00 +0000 (04:31 +0200)
These headers are not available on Windows. <bsd/sys/cdefs.h> ensures
that __has_include() and __has_include_next() are defined.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
include/bsd/err.h
include/bsd/getopt.h
include/bsd/sys/endian.h
include/bsd/sys/time.h
include/bsd/unistd.h

index 12fd051d2fd452a6baa5d3d51835f7622fedbaec..cf043e4c5e6f4d18af1926cff3002b6a98707f3c 100644 (file)
  */
 
 #ifdef LIBBSD_OVERLAY
+#include <sys/cdefs.h>
+#if __has_include_next(<err.h>)
 #include_next <err.h>
+#endif
 #else
+#include <bsd/sys/cdefs.h>
+#if __has_include(<err.h>)
 #include <err.h>
 #endif
+#endif
 
 #ifndef LIBBSD_ERR_H
 #define LIBBSD_ERR_H
 
-#ifdef LIBBSD_OVERLAY
-#include <sys/cdefs.h>
-#else
-#include <bsd/sys/cdefs.h>
-#endif
-
 #include <stdarg.h>
 
 __BEGIN_DECLS
index a6505e900f293314922f7d437bb34bfa0ed2273c..48c3be8abd7036c5931289826595d5fc247e58fa 100644 (file)
  */
 
 #ifdef LIBBSD_OVERLAY
+#include <sys/cdefs.h>
+#if __has_include_next(<getopt.h>)
 #include_next <getopt.h>
+#endif
 #include <unistd.h>
 #else
+#include <bsd/sys/cdefs.h>
+#if __has_include(<getopt.h>)
 #include <getopt.h>
+#endif
 #include <bsd/unistd.h>
 #endif
index 1af844cf9d455f5bf1a8b85124ee46d065ca14c1..a4a8e9c0c931de52fbca166257f9b7b7e001b9fc 100644 (file)
  */
 
 #ifdef LIBBSD_OVERLAY
+#include <sys/cdefs.h>
+#if __has_include_next(<endian.h>)
 #include_next <endian.h>
+#endif
 #else
+#include <bsd/sys/cdefs.h>
+#if __has_include(<endian.h>)
 #include <endian.h>
 #endif
+#endif
 
 #ifndef LIBBSD_SYS_ENDIAN_H
 #define LIBBSD_SYS_ENDIAN_H
index 0aaf0e2b05b1629e707020762e7c4e66c2befcce..1eaa76b44660223108ca957a69b60be8e8fb9653 100644 (file)
  */
 
 #ifdef LIBBSD_OVERLAY
+#include <sys/cdefs.h>
+#if __has_include_next(<sys/time.h>)
 #include_next <sys/time.h>
+#endif
 #else
+#include <bsd/sys/cdefs.h>
+#if __has_include(<sys/time.h>)
 #include <sys/time.h>
 #endif
+#endif
 
 #ifndef LIBBSD_SYS_TIME_H
 #define LIBBSD_SYS_TIME_H
index c25977d5d13cf57134e52bcddff1b95b6b643194..167241b4b56b9ae61894eef7c33dfe28ebba32e0 100644 (file)
  */
 
 #ifdef LIBBSD_OVERLAY
+#include <sys/cdefs.h>
+#if __has_include_next(<unistd.h>)
 #include_next <unistd.h>
+#endif
 #else
+#include <bsd/sys/cdefs.h>
+#if __has_include(<unistd.h>)
 #include <unistd.h>
 #endif
+#endif
 
 #ifndef LIBBSD_UNISTD_H
 #define LIBBSD_UNISTD_H
 
-#ifdef LIBBSD_OVERLAY
-#include <sys/cdefs.h>
-#else
-#include <bsd/sys/cdefs.h>
-#endif
 #include <sys/stat.h>
 
 #if !defined(S_ISTXT) && defined(S_ISVTX)