Re: [xml] Build failure on darwin



As has already been reported a few times, 2.9.0 won't build on any version of OS X. The problem line is 
always this:

threads.c:918: error: expected expression before '{' token

The line in question is:

once_control = PTHREAD_ONCE_INIT;

This happens to work on linux, but it's not legal. As the name and the manpage example code imply, and the 
POSIX documentation makes clear, PTHREAD_ONCE_INIT can only be used in initializations, not assignments. This 
is because some platforms defined PTHREAD_ONCE_INIT as an aggregate initializer.

Linux is not such a platform, but Darwin is. From the 10.8.1 version of pthread.h:

#define PTHREAD_ONCE_INIT {_PTHREAD_ONCE_SIG_init, {0}}

Also, if I understand what the code is trying to accomplish (to allow the pthread_once to get called again 
after you've done this), it's really sketchy and probably shouldn't work reliably even on platforms where it 
compiles.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]