This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Go patch committed: Implement new syscall package


Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> Now IRIX finally bootstrap again, I had to make two adjustments to have
> libgo build there.
>
> * go/syscall/wait.c doesn't compile:
>
> /vol/gcc/src/hg/trunk/local/libgo/go/syscall/wait.c:11:0: error: "__EXTENSIONS__" redefined [-Werror]
> /vol/gcc/src/hg/trunk/local/libgo/go/syscall/wait.c:1:0: note: this is the location of the previous definition
>
>   I've wrapped the __EXTENSIONS__ definition in #ifndef/#endif, but
>   think this is the wrong approach: definitions of _GNU_SOURCE,
>   __EXTENSIONS__ and other platform-specific stuff should go into
>   configure.ac or mksysinfo.sh, not individual sources.  There are more
>   instances of this problem, but they don't hurt me on IRIX.

Makes sense.  I have committed this patch to try to clean this up a bit.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.

Ian

diff -r 870b56a3d07e libgo/Makefile.am
--- a/libgo/Makefile.am	Fri Dec 16 06:45:11 2011 -0800
+++ b/libgo/Makefile.am	Tue Dec 20 09:18:16 2011 -0800
@@ -37,7 +37,7 @@
 ACLOCAL_AMFLAGS = -I ./config -I ../config
 
 AM_CFLAGS = -fexceptions -fplan9-extensions $(SPLIT_STACK) $(WARN_CFLAGS) \
-	$(STRINGOPS_FLAG) \
+	$(STRINGOPS_FLAG) $(OSCFLAGS) \
 	-I $(srcdir)/../libgcc -I $(MULTIBUILDTOP)../../gcc/include
 
 if USING_SPLIT_STACK
diff -r 870b56a3d07e libgo/configure.ac
--- a/libgo/configure.ac	Fri Dec 16 06:45:11 2011 -0800
+++ b/libgo/configure.ac	Tue Dec 20 09:18:16 2011 -0800
@@ -277,23 +277,24 @@
 AC_SUBST(GO_SYSCALL_OS_FILE)
 AC_SUBST(GO_SYSCALL_OS_ARCH_FILE)
 
-dnl Some targets need special flags to build sysinfo.go.
+dnl Special flags used to generate sysinfo.go.
+OSCFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
 case "$target" in
     mips-sgi-irix6.5*)
 	# IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct
 	# msghdr in <sys/socket.h>.
-	OSCFLAGS='-D_XOPEN_SOURCE=500'
+	OSCFLAGS="$OSCFLAGS -D_XOPEN_SOURCE=500"
 	;;
     *-*-solaris2.[[89]])
 	# Solaris 8/9 need this so struct msghdr gets the msg_control
 	# etc. fields in <sys/socket.h> (_XPG4_2).
-	OSCFLAGS='-D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D__EXTENSIONS__'
+	OSCFLAGS="$OSCFLAGS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D__EXTENSIONS__"
 	;;
     *-*-solaris2.1[[01]])
 	# Solaris 10+ needs this so struct msghdr gets the msg_control
 	# etc. fields in <sys/socket.h> (_XPG4_2).  _XOPEN_SOURCE=500 as
 	# above doesn't work with C99.
-	OSCFLAGS='-D_XOPEN_SOURCE=600 -D__EXTENSIONS__'
+	OSCFLAGS="$OSCFLAGS -D_XOPEN_SOURCE=600 -D__EXTENSIONS__"
 	;;
 esac
 AC_SUBST(OSCFLAGS)
diff -r 870b56a3d07e libgo/go/syscall/wait.c
--- a/libgo/go/syscall/wait.c	Fri Dec 16 06:45:11 2011 -0800
+++ b/libgo/go/syscall/wait.c	Tue Dec 20 09:18:16 2011 -0800
@@ -7,9 +7,6 @@
    We use C code to extract the wait status so that we can easily be
    OS-independent.  */
 
-#define _GNU_SOURCE
-#define __EXTENSIONS__
-
 #include <stdint.h>
 #include <sys/wait.h>
 
diff -r 870b56a3d07e libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Fri Dec 16 06:45:11 2011 -0800
+++ b/libgo/mksysinfo.sh	Tue Dec 20 09:18:16 2011 -0800
@@ -25,10 +25,6 @@
 cat > sysinfo.c <<EOF
 #include "config.h"
 
-#define _GNU_SOURCE
-#define _LARGEFILE_SOURCE
-#define _FILE_OFFSET_BITS 64
-
 #include <sys/types.h>
 #include <dirent.h>
 #include <errno.h>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]