BZ #6: Build error on gcc 4.0.1

Status fields:

creation_ts:2005-07-20 19:59
component:threads
version:unspecified
rep_platform:All
op_sys:Linux
bug_status:RESOLVED
resolution:FIXED
reporter:greenrd@greenrd.org
CVS fails to build on gcc 4.0.1 with this error

if /bin/sh ../../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.
-I../../.. -I../../../src -I../../../src/vm/jit/i386
-I../../../src/vm/jit/i386/linux    -ansi -pedantic -Wall -Wno-long-long -O0 -g3
-D__I386__ -D__LINUX__ -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500
-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_REENTRANT -MT threads.lo -MD -MP -MF
".deps/threads.Tpo" -c -o threads.lo threads.c; \
then mv -f ".deps/threads.Tpo" ".deps/threads.Plo"; else rm -f
".deps/threads.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../src
-I../../../src/vm/jit/i386 -I../../../src/vm/jit/i386/linux -ansi -pedantic
-Wall -Wno-long-long -O0 -g3 -D__I386__ -D__LINUX__ -D_POSIX_C_SOURCE=199506L
-D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_REENTRANT -MT
threads.lo -MD -MP -MF .deps/threads.Tpo -c threads.c -o threads.o
threads.c:147: error: static declaration of 'mainthreadobj' follows non-static
declaration
../../../src/threads/native/threads.h:208: error: previous declaration of
'mainthreadobj' was here
make: *** [threads.lo] Error 1

This patch fixes it:

--- threads.h.orig      2005-07-20 18:57:05.000000000 +0100
+++ threads.h   2005-07-20 18:24:00.000000000 +0100
@@ -205,7 +205,7 @@
 u1 *thread_checkcritical(u1*);

 extern volatile int stopworldwhere;
-extern threadobject *mainthreadobj;
+//extern threadobject *mainthreadobj;


 void cast_stopworld();

Comment #1 by stefan@complang.tuwien.ac.at on 2005-07-20 20:13:11

motse added this, reassigning.

Comment #2 by motse@complang.tuwien.ac.at on 2005-07-20 21:17:49

fixed in cvs

Comment #3 by twisti@complang.tuwien.ac.at on 2005-07-22 11:59:04

Don't declare static variables in headers.

../../../../src/threads/native/threads.h:208: warning: 'mainthreadobj' defined
but not used

Comment #4 by twisti@complang.tuwien.ac.at on 2005-12-11 02:30:00

I think this one is fixed.  At least it builds for me.