Guard non-portable forwarded includes

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>
This commit is contained in:
Aaron Dierking
2018-06-14 11:38:32 -07:00
committed by Guillem Jover
parent 2ebe6d5a02
commit c2d9d84088
5 changed files with 30 additions and 11 deletions

View File

@@ -26,19 +26,20 @@
*/
#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)