On 01/07/2013 01:22 AM, Paul Eggert wrote:
It's been a long time since I had access to those obsolete platforms
(even my last Solaris 8 production host bit the dust a few months
ago) so I'm afraid that you'll have to do more of the digging;
it doesn't appear to be something that I can easily do remotely.
I understand.
I've looked more at allocator.i this time with -dD added to bring even
more context.
What happens is that the preprocessor is getting "derailed" and ends up
parsing gnulib <stdlib.h> before finishing the system <stdlib.h>.
The start of this chain of events is when system <stdlib.h> includes
gnulib <sys/wait.h> which then include_nexts the system <sys/wait.h>.
Some time later it gets to gnulib <pthread.h> (via atleast
<sys/select.h> -> <signal.h> -> <pthread.h>) which unconditionally
includes <stdlib.h>. This makes the preprocessor return to gnulib
<stdlib.h> which is then parsed (include_next <stdlib.h> is skipped this
time, I presume because the guard in system <stdlib.h> has already been
registered earlier).
Removing #include <stdlib.h> from <pthread.h> makes allocator.c build.
This is probably not the right solution but atleast it gets me further.
Parsing system <stdlib.h> last is not confined to Solaris 2.6, it
happens on Solaris 7,8 and 9 aswell only it does not trigger an error
since the putenv function prototype match the one from gnulib.
If I tweak the gnulib putenv function prototype to be incompatible I get
this on Solaris 9:
depbase=`echo allocator.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC
-DEXEEXT=\"\" -I. -I.. -DGNULIB_STRICT_CHECKING=1 -I../intl
-I/usr/tgcware/include -D_REENTRANT -fvisibility=hidden -g -O2 -MT
allocator.o -MD -MP -MF $depbase.Tpo -c -o allocator.o allocator.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ./stdlib.h:35:0,
from allocator.c:4:
/usr/tgcware/lib/gcc/sparc-sun-solaris2.9/4.6.3/include-fixed/stdlib.h:135:12:
error: conflicting types for 'rpl_putenv'
./stdlib.h:836:1: note: previous declaration of 'rpl_putenv' was here
On Solaris 10 the system <stdlib.h> is parsed before gnulib <stdlib.h>
as expected.
-tgc