Hi Martin,
thanks for the hint. Some comments below.
Martin Husemann wrote:
On Tue, May 29, 2018 at 08:29:02AM +0200, Riccardo wrote:
Hi all,
I am testing build og GNUstep base (head) on NetBSD 6.1.5/sparc
Build fails with:
Compiling file NSObject.m ...
NSObject.m: In function '+[NSObject initialize]':
NSObject.m:1049:34: error: expected expression before '{' token
NSObject.m: At top level:
you can see the file here:
https://github.com/gnustep/libs-base/blob/master/Source/NSObject.m
I bet the issue is with PTHREAD_MUTEX_INITIALIZER
The code is doing something strange there. PTHREAD_MUTEX_INITIALIZER is
only needed for static mutex initializations. In this case it is way
easier to just do:
for (i = 0; i < LOCKCOUNT; i++)
{
pthread_mutex_init(&allocationLocks[i], NULL);
}
As the name says it is an initializer, which does not necessarily mean
it is an rvalue (that you could just assign).
well it should return a value, look here for POSIX:
http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_mutex_init.html
Interestingly in NetBSD, used in a static context, the macro works, used
in the other context it doesn't. So your suggestion remains valid and
works, although it is a little more subtle.
Upstream already fixed & committed, I am doing regression tests on other
platforms now.
But I always love when things work on my ol' SparcStation! It catches so
many memory errors :)
Riccardo