> the problem with a gnulib testdir for the modules > > unistd stdlib pthread signal sys_select allocator mkstemp pthread_sigmask > ... > 2012-02-04 Bruno Haible <br...@clisp.org> > > sys_select: Avoid syntax error on OpenBSD 5.0. > * lib/sys_select.in.h: Include <signal.h> only after the include_next > <sys/select.h>, not before. > Reported by Jiri B <ji...@devio.us>.
This fixed the first error, but a second one appears: In file included from ./signal.h:65, from ./sys/select.h:84, from /usr/include/sys/types.h:224, from /usr/include/pthread.h:49, from ./pthread.h:31, from glthread/threadlib.c:28: ./pthread.h:237: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'pthread_spinlock_t' ./pthread.h:240: error: expected ')' before '*' token ./pthread.h:246: error: expected ')' before '*' token ./pthread.h:252: error: expected ')' before '*' token ./pthread.h:258: error: expected ')' before '*' token ./pthread.h:264: error: expected ')' before '*' token In file included from ./pthread.h:31, from glthread/threadlib.c:28: /usr/include/pthread.h:188: error: expected identifier before numeric constant *** Error code 1 We have a circular loop of #includes: <pthread.h> -> <sys/types.h> -> <sys/select.h> -> <signal.h> -> <pthread.h>. This fixes it. 2012-02-04 Bruno Haible <br...@clisp.org> sys_select: Avoid syntax error on OpenBSD 5.0. * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is currently being included, just include the system's <sys/select.h>. --- lib/sys_select.in.h.orig Sat Feb 4 14:52:19 2012 +++ lib/sys_select.in.h Sat Feb 4 14:50:57 2012 @@ -42,6 +42,15 @@ # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ +/* On OpenBSD 5.0, <pthread.h> includes <sys/types.h>, which includes + <sys/select.h>. At this point we cannot include <signal.h>, because that + includes gnulib's pthread.h override, which gives a syntax error because + /usr/include/pthread.h has not been completely processed. Simply delegate + to the system's header in this case. */ +#elif @HAVE_SYS_SELECT_H@ && defined __OpenBSD__ && (defined _PTHREAD_H_ && !defined PTHREAD_MUTEX_INITIALIZER) + +# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ + #else #ifndef _@GUARD_PREFIX@_SYS_SELECT_H