[libc++] Use __has_include instead of complex logic in thread.cpp

We might end up including more headers than strictly necessary this way,
but it's much simpler and it makes it easier to port thread.cpp to systems
not handled by the existing conditionals.
This commit is contained in:
Louis Dionne 2020-10-05 16:39:33 -04:00
parent fe7245b772
commit 477a68760b
1 changed files with 11 additions and 7 deletions

View File

@ -14,17 +14,21 @@
#include "vector"
#include "future"
#include "limits"
#include <sys/types.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#if __has_include(<sys/types.h>)
# include <sys/types.h>
#endif
#if __has_include(<sys/param.h>)
# include <sys/param.h>
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
# include <sys/sysctl.h>
# endif
#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#endif
#if __has_include(<sys/sysctl.h>)
# include <sys/sysctl.h>
#endif
#if __has_include(<unistd.h>)
#include <unistd.h>
# include <unistd.h>
#endif
#if defined(__NetBSD__)