This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: 3.4 PATCH: Several IRIX 6.5.1[89] ISO C99 fixes
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org, Bruce Korb <bkorb at gnu dot org>, "Billinghurst, David (CRTS)" <David dot Billinghurst at riotinto dot com>
- Date: Thu, 27 Mar 2003 14:32:23 +0100 (MET)
- Subject: Re: 3.4 PATCH: Several IRIX 6.5.1[89] ISO C99 fixes
- References: <15953.10805.281616.252741@xayide.TechFak.Uni-Bielefeld.DE><m365ri39rf.fsf@uniton.integrable-solutions.net>
Gabriel Dos Reis writes:
> | Since the patch fixes problems caused by IRIX header bugs which affect the
> | 3.2 and 3.3 branches as well, I'd like to apply it there as well. Ok?
>
> Once bootstrapped and regtested, please apply it to gcc-3_2-branch
sorry I let this drop for so long: the patch doesn't apply to the 3.2
branch as is, but an equivalent is required since otherwise the branch
doesn't bootstrap on IRIX 6.5.1[89]. Here's what I'm using. The patch
differs from the 3.[34] patch by not defining __c99 for ISO C99
compilations since it is not easy to detect if -std=c99 is in effect with
specs. Since this is not strictly a bug fix, but rather a new feature,
this shouldn't matter.
With this patch, the 3.2 branch bootstraps again on mips-sgi-irix6.5 (not
really regtested since there's no baseline to compare against).
Ok for 3.2 branch?
Btw., there's one strange thing about gcc/fixinc/fixincl.x on the 3.2
branch: regenerating the file without the inclhack.def patch below with
autogen 5.2 changes the file: though there seem to be no material
differences, the ordering of a couple of entries changes? Is this a
problem with autogen 5.2, or with the file currently on the 3.2 branch?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Fri Feb 14 15:16:33 2003 Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
* config/mips/iris6.h (CPLUSPLUS_CPP_SPEC): Define __c99.
* fixinc/inclhack.def (irix___restrict): Don't change __restrict
for C++ on IRIX 6.5.1[89].
* fixinc/tests/base/internal/sgimacros.h: New file.
* fixinc/inclhack.def (irix_wcsftime): Use XPG5 variant for C99.
* fixincl/fixincl.x: Regenerate.
* fixinc/tests/base/internal/wchar_core.h: New file.
Index: gcc/config/mips/iris6.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris6.h,v
retrieving revision 1.43.8.1
diff -u -p -r1.43.8.1 iris6.h
--- gcc/config/mips/iris6.h 19 May 2002 15:21:35 -0000 1.43.8.1
+++ gcc/config/mips/iris6.h 27 Mar 2003 13:09:29 -0000
@@ -129,11 +129,12 @@ Boston, MA 02111-1307, USA. */
prior to 6.5. They normally get defined in SUBTARGET_CPP_SPEC if
!ansi, for g++ we want them regardless. We don't need this on
irix6.5 itself, but it shouldn't hurt other than the namespace
- pollution. */
+ pollution. libstdc++ v3 needs many ISO C99 features provided
+ in IRIX 6.5.18, but protected by the __c99 macro. */
#undef CPLUSPLUS_CPP_SPEC
#define CPLUSPLUS_CPP_SPEC "\
-D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS \
-%{ansi:-D__EXTENSIONS__ -D_SGI_SOURCE} %(cpp) \
+%{ansi:-D__EXTENSIONS__ -D_SGI_SOURCE} -D__c99 %(cpp) \
"
/* Irix 6 uses DWARF-2. */
Index: gcc/fixinc/inclhack.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.120.2.6.4.5
diff -u -p -r1.120.2.6.4.5 inclhack.def
--- gcc/fixinc/inclhack.def 1 Mar 2003 20:45:11 -0000 1.120.2.6.4.5
+++ gcc/fixinc/inclhack.def 27 Mar 2003 13:09:35 -0000
@@ -1502,6 +1502,24 @@ fix = {
/*
+ * IRIX 6.5.1[89] <internal/sgimacros.h> unconditionally defines
+ * __restrict as restrict iff __c99. This is wrong for C++, which
+ * needs many C99 features, but only supports __restrict.
+ */
+fix = {
+ hackname = irix___restrict;
+ files = internal/sgimacros.h;
+ select = "(#ifdef __c99\n)(#[ \t]*define __restrict restrict)";
+
+ mach = "mips-sgi-irix6.5";
+ c_fix = format;
+ c_fix_arg = "%1"
+ "# ifndef __cplusplus\n%2\n# endif";
+
+ test_text = "#ifdef __c99\n# define __restrict restrict";
+};
+
+/*
* IRIX 6.5.1[78] <sys/socket.h> has a broken definition of socklen_t.
* Various socket function prototypes use different types instead,
* depending on the API in use (BSD, XPG4/5), but the socklen_t
@@ -1540,6 +1558,23 @@ fix = {
"extern int printf( const char *, /* va_list */ char * );";
};
+
+/*
+ * IRIX 6.5.19 <internal/wchar_core.h> provides the XPG4 variant of
+ * wcsftime by default. ISO C99 requires the XPG5 variant instead.
+ */
+fix = {
+ hackname = irix_wcsftime;
+ files = internal/wchar_core.h;
+ select = "#if _NO_XOPEN5\n(extern size_t[ \t]+wcsftime.*const char \*.*)";
+
+ mach = "mips-sgi-irix6.5";
+ c_fix = format;
+ c_fix_arg = "#if _NO_XOPEN5 && !defined(__c99)\n%1";
+
+ test_text = "#if _NO_XOPEN5\n"
+ "extern size_t wcsftime(wchar_t *, __SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, const struct tm *);";
+};
/*
* Fixing ISC fmod declaration
Index: gcc/fixinc/tests/base/internal/sgimacros.h
===================================================================
RCS file: gcc/fixinc/tests/base/internal/sgimacros.h
diff -N gcc/fixinc/tests/base/internal/sgimacros.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gcc/fixinc/tests/base/internal/sgimacros.h 27 Mar 2003 13:09:35 -0000
@@ -0,0 +1,17 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/internal/sgimacros.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( IRIX___RESTRICT_CHECK )
+#ifdef __c99
+# ifndef __cplusplus
+# define __restrict restrict
+# endif
+#endif /* IRIX___RESTRICT_CHECK */
Index: gcc/fixinc/tests/base/internal/wchar_core.h
===================================================================
RCS file: gcc/fixinc/tests/base/internal/wchar_core.h
diff -N gcc/fixinc/tests/base/internal/wchar_core.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gcc/fixinc/tests/base/internal/wchar_core.h 27 Mar 2003 13:09:35 -0000
@@ -0,0 +1,15 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/internal/wchar_core.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( IRIX_WCSFTIME_CHECK )
+#if _NO_XOPEN5 && !defined(__c99)
+extern size_t wcsftime(wchar_t *, __SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, const struct tm *);
+#endif /* IRIX_WCSFTIME_CHECK */