On 09/23/2016 11:37 AM, Denis Davydov wrote:
/usr/include/pthread_impl.h:32:18: error: missing binary operator
before token "("
#if __has_feature(assume_nonnull)
My guess is that sched.h isn't including sys/cdefs.h as it should on
Darwin. The Darwin guys are not that big on supporting GCC, I'm afraid.
Does the attached gnulib patch work around the Darwin bug for you?
errno.h is just a way to get cdefs.h included.
diff --git a/m4/nproc.m4 b/m4/nproc.m4
index fead234..abe785e 100644
--- a/m4/nproc.m4
+++ b/m4/nproc.m4
@@ -40,7 +40,8 @@ AC_DEFUN([gl_PREREQ_NPROC],
[gl_cv_func_sched_getaffinity3],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
- [[#include <sched.h>]],
+ [[#include <errno.h>
+ #include <sched.h>]],
[[sched_getaffinity (0, 0, (cpu_set_t *) 0);]])],
[gl_cv_func_sched_getaffinity3=yes],
[gl_cv_func_sched_getaffinity3=no])
diff --git a/m4/sched_h.m4 b/m4/sched_h.m4
index f564541..7133747 100644
--- a/m4/sched_h.m4
+++ b/m4/sched_h.m4
@@ -10,6 +10,7 @@ AC_DEFUN([gl_SCHED_H],
[
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
+ #include <errno.h>
#include <sched.h>
struct sched_param a;
int b[] = { SCHED_FIFO, SCHED_RR, SCHED_OTHER };
@@ -30,7 +31,8 @@ AC_DEFUN([gl_SCHED_H],
if test "$HAVE_SCHED_H" = 1; then
AC_CHECK_TYPE([struct sched_param],
[HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
- [#include <sched.h>])
+ [#include <errno.h>
+ #include <sched.h>])
else
dnl On OS/2 kLIBC, struct sched_param is in spawn.h.
AC_CHECK_TYPE([struct sched_param],
diff --git a/tests/test-sched.c b/tests/test-sched.c
index 52e0a8a..073fd04 100644
--- a/tests/test-sched.c
+++ b/tests/test-sched.c
@@ -18,6 +18,7 @@
#include <config.h>
+#include <errno.h>
#include <sched.h>
/* Check that 'struct sched_param' is defined. */