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: 3.4/3.5 PATCH: Fix many Solaris 10 g++ testsuite failures


B. Kosnik writes:

> >> Would we be better off not using int64_t from system headers, but instead
> >> via __attribute__((mode("DI"))) or somesuch?
> >
> >That's for the libstdc++-v3 guys to comment.  Currently, I find both
> >constructs: include/bits/postypes.h uses int64_t if available,
> >libmath/mathconf.h defines U_int64_t with __attribute ((mode (DI))).  I
> >understand that there's some desire to have libstdc++-v3 buildable with
> >other compilers, so the use of __attribute__ seems not too desirable.
> 
> We prefer to use int64_t from system headers. 
> 
> The mathconf.h bits are build-only, and do not end up visible to the end user.

Ok, thanks.  If so, can this revised patch, which addresses Richard's
comments, go in now (both 3.4 branch and mainline)?

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University


Thu Apr 29 00:08:16 2004  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* config/sol2.h (TARGET_OS_CPP_BUILTINS): Define __STDC_VERSION__
	for Solaris 10.  Use XPG6 instead of XPG5.

	* config/i386/i386.h (TARGET_SOLARIS2): Provide default.
	* config/i386/sol2.h (TARGET_SOLARIS2): Override.
	* config/i386/i386.c (ix86_build_builtin_va_list): Return default
	for 32-bit Solaris 2.

	* fixinc/inclhack.def (solaris___restrict): New fix.
	* fixinc/fixincl.x: Regenerate.
	* fixinc/tests/base/sys/feature_tests.h: New test.
	
Index: gcc/config/sol2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sol2.h,v
retrieving revision 1.9
diff -u -p -r1.9 sol2.h
--- gcc/config/sol2.h	18 Dec 2003 20:13:50 -0000	1.9
+++ gcc/config/sol2.h	10 May 2004 17:40:00 -0000
@@ -1,6 +1,6 @@
 /* Operating system specific defines to be used when targeting GCC for any
    Solaris 2 system.
-   Copyright 2002, 2003 Free Software Foundation, Inc.
+   Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -65,10 +65,15 @@ Boston, MA 02111-1307, USA.  */
 	builtin_assert ("system=svr4");			\
 	/* For C++ we need to add some additional macro	\
 	   definitions required by the C++ standard	\
-	   library.  */					\
+	   library.					\
+	   In Solaris 10, int64_t from <sys/int_types.h>\
+	   is only visible with g++ -ansi for ISO C99	\
+	   compilations.  Those only work together with	\
+	   XPG6.  */					\
 	if (c_dialect_cxx ())				\
 	  {						\
-	    builtin_define ("_XOPEN_SOURCE=500");	\
+	    builtin_define ("__STDC_VERSION__=199901L");\
+	    builtin_define ("_XOPEN_SOURCE=600");	\
 	    builtin_define ("_LARGEFILE_SOURCE=1");	\
 	    builtin_define ("_LARGEFILE64_SOURCE=1");	\
 	    builtin_define ("__EXTENSIONS__");		\
Index: gcc/config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.667
diff -u -p -r1.667 i386.c
--- gcc/config/i386/i386.c	7 May 2004 14:29:41 -0000	1.667
+++ gcc/config/i386/i386.c	10 May 2004 17:40:01 -0000
@@ -2972,9 +2972,15 @@ ix86_build_builtin_va_list (void)
 {
   tree f_gpr, f_fpr, f_ovf, f_sav, record, type_decl;
 
-  /* For i386 we use plain pointer to argument area.  */
   if (!TARGET_64BIT)
-    return build_pointer_type (char_type_node);
+    {
+      /* 32-bit Solaris 2/x86, like SPARC, uses the default.  */
+      if (TARGET_SOLARIS2)
+	return std_build_builtin_va_list ();
+      else
+	/* For i386 we use plain pointer to argument area.  */
+	return build_pointer_type (char_type_node);
+    }
 
   record = (*lang_hooks.types.make_type) (RECORD_TYPE);
   type_decl = build_decl (TYPE_DECL, get_identifier ("__va_list_tag"), record);
Index: gcc/config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.384
diff -u -p -r1.384 i386.h
--- gcc/config/i386/i386.h	9 Apr 2004 19:57:45 -0000	1.384
+++ gcc/config/i386/i386.h	10 May 2004 17:40:05 -0000
@@ -450,6 +450,9 @@ extern int x86_prefetch_sse;
    redefines this to 1.  */
 #define TARGET_MACHO 0
 
+/* Solaris 2 specific stuff.  */
+#define TARGET_SOLARIS2 0
+
 /* This macro is similar to `TARGET_SWITCHES' but defines names of
    command options that have values.  Its definition is an
    initializer with a subgrouping for each command option.
Index: gcc/config/i386/sol2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/sol2.h,v
retrieving revision 1.28
diff -u -p -r1.28 sol2.h
--- gcc/config/i386/sol2.h	26 Sep 2003 04:07:46 -0000	1.28
+++ gcc/config/i386/sol2.h	10 May 2004 17:40:05 -0000
@@ -1,6 +1,6 @@
 /* Target definitions for GCC for Intel 80386 running Solaris 2
-   Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+   2004 Free Software Foundation, Inc.
    Contributed by Fred Fish (fnf@cygnus.com).
 
 This file is part of GCC.
@@ -19,6 +19,10 @@ You should have received a copy of the G
 along with GCC; see the file COPYING.  If not, write to
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
+
+/* We are compiling for Solaris 2 now.  */
+#undef TARGET_SOLARIS2
+#define TARGET_SOLARIS2 1
 
 /* The Solaris 2.0 x86 linker botches alignment of code sections.
    It tries to align to a 16 byte boundary by padding with 0x00000090
Index: gcc/fixinc/inclhack.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.197
diff -u -p -r1.197 inclhack.def
--- gcc/fixinc/inclhack.def	3 May 2004 15:19:16 -0000	1.197
+++ gcc/fixinc/inclhack.def	10 May 2004 17:40:15 -0000
@@ -2440,6 +2440,27 @@ fix = {
 
 
 /*
+ *  Solaris 10 <sys/feature_tests.h> unconditionally defines
+ *  _RESTRICT_KYWD as restrict iff _STDC_C99.  This is wrong for C++, which
+ *  needs many C99 features, but only supports __restrict.
+ */
+fix = {
+    hackname  = solaris___restrict;
+    files     = sys/feature_tests.h;
+    select    = "#define[ \t]+_RESTRICT_KYWD[ \t]+restrict";
+
+    mach      = "*-*-solaris2*";
+    c_fix     = format;
+    c_fix_arg = "#ifndef __cplusplus\n"
+		"%0\n"
+		"#else\n"
+    		"#define _RESTRICT_KYWD __restrict\n"
+    		"#endif";
+
+    test_text = "#define	_RESTRICT_KYWD	restrict";
+};
+
+/*
  *  Sun Solaris 2.5.1, 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER
  *  incorrectly, so we replace them with versions that correspond to
  *  the definition.  We also explicitly name this fix "1" and the next
Index: gcc/fixinc/tests/base/sys/feature_tests.h
===================================================================
RCS file: gcc/fixinc/tests/base/sys/feature_tests.h
diff -N gcc/fixinc/tests/base/sys/feature_tests.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc/fixinc/tests/base/sys/feature_tests.h	10 May 2004 17:40:15 -0000
@@ -0,0 +1,18 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/sys/feature_tests.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( SOLARIS___RESTRICT_CHECK )
+#ifndef __cplusplus
+#define	_RESTRICT_KYWD	restrict
+#else
+#define _RESTRICT_KYWD __restrict
+#endif
+#endif  /* SOLARIS___RESTRICT_CHECK */


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