public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Provide stdint.h for IRIX 5/6
@ 2009-11-17 13:36 Rainer Orth
  2009-11-17 13:38 ` Joseph S. Myers
  0 siblings, 1 reply; 9+ messages in thread
From: Rainer Orth @ 2009-11-17 13:36 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bruce Korb, Joseph S. Myers, Steve Ellcey

The following patch immplements stdint.h for IRIX 6.5.  In theory, it
should work on IRIX 5.3 and 6.x (x < 5), too, but I haven't revived my
5.3 systems yet and don't have e.g. 6.2 any longer, so I'd appreciate
testing by users that do.

Again, I've added the necessary definitions to config/mips/iris.h
directly.

I need to fix a couple of issues with the IRIX 6.5 stdint.h:

* Type mismatches between the *_{MIN, MAX} constants and the
  corresponding types.

* Uses of casts in *INT*_C macros which inhibit their use in
  preprocessor tests.

With the fixed stdint.h, all the c99-stdint-?.c tests pass in both the
n32 and n64 ABIs.  A full bootstrap is still in progress.

Unfortunately, there's one problem with the fixincludes tests: several
fail make check:

stdint.h /vol/gcc/src/gcc-dist/fixincludes/tests/base/stdint.h differ: char 3915, line 165
*** stdint.h	Tue Nov 17 14:23:58 2009
--- /vol/gcc/src/gcc-dist/fixincludes/tests/base/stdint.h	Mon Nov 16 22:37:26 2009
***************
*** 162,178 ****
  #if defined( IRIX_STDINT_C99_TYPES_CHECK )
  #define INT64_MIN               (-0x7fffffffffffffffLL - 1)
  #define INT64_MAX               0x7fffffffffffffffLL
! #define UINT32_MAX __UINT32_MAX__
  #define UINT64_MAX              0xffffffffffffffffULL
! #define INTPTR_MIN (-INTPTR_MAX - 1)
! #define INTPTR_MAX (2147483647l)
! #define UINTPTR_MAX (4294967295ul)
  #define INTPTR_MIN              (-0x7fffffffffffffffL - 1)
  #define INTPTR_MAX              0x7fffffffffffffffL
  #define UINTPTR_MAX             0xffffffffffffffffUL
! #define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
! #define PTRDIFF_MAX __PTRDIFF_MAX__
! #define SIZE_MAX __SIZE_MAX__
  #endif  /* IRIX_STDINT_C99_TYPES_CHECK */
  
  
--- 162,178 ----
  #if defined( IRIX_STDINT_C99_TYPES_CHECK )
  #define INT64_MIN               (-0x7fffffffffffffffLL - 1)
  #define INT64_MAX               0x7fffffffffffffffLL
! #define UINT32_MAX              0xffffffffU
  #define UINT64_MAX              0xffffffffffffffffULL
! #define INTPTR_MIN              (-0x7fffffffL - 1)
! #define INTPTR_MAX              0x7fffffffL
! #define UINTPTR_MAX             0xffffffffUL
  #define INTPTR_MIN              (-0x7fffffffffffffffL - 1)
  #define INTPTR_MAX              0x7fffffffffffffffL
  #define UINTPTR_MAX             0xffffffffffffffffUL
! #define PTRDIFF_MIN             (-0x7fffffffffffffffL - 1)
! #define PTRDIFF_MAX             0x7fffffffffffffffL
! #define SIZE_MAX                0xffffffffffffffffUL
  #endif  /* IRIX_STDINT_C99_TYPES_CHECK */
  
  
***************
*** 181,188 ****
  #define INT16_C(x)              (x)
  #define INT32_C(x)              (x)
  #define INT64_C(x)              (x ## LL)
! #define UINT8_C(c) __UINT8_C(c)
! #define UINT16_C(c) __UINT16_C(c)
  #define UINT32_C(x)             (x ## U)
  #define UINT64_C(x)             (x ## ULL)
  #define INTMAX_C(x)             (x ## LL)
--- 181,188 ----
  #define INT16_C(x)              (x)
  #define INT32_C(x)              (x)
  #define INT64_C(x)              (x ## LL)
! #define UINT8_C(x)              (x)
! #define UINT16_C(x)             (x)
  #define UINT32_C(x)             (x ## U)
  #define UINT64_C(x)             (x ## ULL)
  #define INTMAX_C(x)             (x ## LL)

This happens because some sed fixes in newlib_stdint_1 (UINT32_MAX,
PTRDIFF_MIN, PTRDIFF_MAX, UINT8_C, UINT16_C) and hpux_c99_intptr
(INTPTR_MIN, INTPTR_MAX, UINTPTR_MAX) aren't specific enough.  I'll
probably need help from Josef (author of newlib_stdint_1) and Steve to
fix this.

When this is fixed, ok for mainline?

     Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2009-11-17  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	fixincludes:
	* inclhack.def (irix_stdint_c99): Renamed to irix_stdint_c99_mode.
	(irix_stdint_c99_types): New fix.
	(irix_stdint_c99_macros): Likewise.
	* fixincl.x: Regenerate.
	* tests/base/stdint.h [IRIX_STDINT_C99_CHECK]: Renamed to
	IRIX_STDINT_C99_MODE_CHECK.
	[IRIX_STDINT_C99_TYPES_CHECK]: New test.
	[IRIX_STDINT_C99_MACROS_CHECK]: Likewise.

	gcc:
	* config.gcc (mips-sgi-irix[56]*): Set use_gcc_stdint.
	* config/mips/iris.h (INT8_TYPE, INT16_TYPE, INT32_TYPE,
	INT64_TYPE): Define.
	(UINT8_TYPE, UINT16_TYPE, UINT32_TYPE, UINT64_TYPE): Define.
	(INT_LEAST8_TYPE, INT_LEAST16_TYPE, INT_LEAST32_TYPE,
	INT_LEAST64_TYPE): Define.
	(UINT_LEAST8_TYPE, UINT_LEAST16_TYPE, UINT_LEAST32_TYPE,
	UINT_LEAST64_TYPE): Define.
	(INT_FAST8_TYPE, INT_FAST16_TYPE, INT_FAST32_TYPE)
	INT_FAST64_TYPE): Define.
	(UINT_FAST8_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE,
	UINT_FAST64_TYPE): Define.
	(INTMAX_TYPE, UINTMAX_TYPE): Define.
	(INTPTR_TYPE, UINTPTR_TYPE): Define.
	(SIG_ATOMIC_TYPE): Define.

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 154216)
+++ gcc/config.gcc	(working copy)
@@ -1647,12 +1648,23 @@
 	case ${target} in
 	*-*-irix5*)
 		tm_file="${tm_file} mips/iris5.h"
+		use_gcc_stdint=provide
 		;;
 
 	*-*-irix6*)
 		tm_file="${tm_file} mips/iris6.h"
 		tmake_file="${tmake_file} mips/t-iris6"
 		tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_N32"
+		case ${target} in
+		*-*-irix6.[0-4]*)
+			use_gcc_stdint=provide
+			;;
+		*-*-irix6.5*)
+			# Only IRIX Development Foundation 1.3 for IRIX 6.5
+			# provides stdint.h.
+			use_gcc_stdint=wrap
+			;;
+		esac
 		;;
 	esac
 	if test "x$stabs" = xyes
Index: gcc/config/mips/iris.h
===================================================================
--- gcc/config/mips/iris.h	(revision 154216)
+++ gcc/config/mips/iris.h	(working copy)
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler.  Generic IRIX version.
    Copyright (C) 1993, 1995, 1996, 1998, 2000,
-   2001, 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
+   2001, 2002, 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -77,6 +77,42 @@
 #undef WINT_TYPE_SIZE
 #define WINT_TYPE_SIZE 32
 
+/* C99 stdint.h types.  */
+#define INT8_TYPE "signed char"
+#define INT16_TYPE "short int"
+#define INT32_TYPE "int"
+#define INT64_TYPE "long long int"
+#define UINT8_TYPE "unsigned char"
+#define UINT16_TYPE "short unsigned int"
+#define UINT32_TYPE "unsigned int"
+#define UINT64_TYPE "long long unsigned int"
+
+#define INT_LEAST8_TYPE "signed char"
+#define INT_LEAST16_TYPE "short int"
+#define INT_LEAST32_TYPE "int"
+#define INT_LEAST64_TYPE "long long int"
+#define UINT_LEAST8_TYPE "unsigned char"
+#define UINT_LEAST16_TYPE "short unsigned int"
+#define UINT_LEAST32_TYPE "unsigned int"
+#define UINT_LEAST64_TYPE "long long unsigned int"
+
+#define INT_FAST8_TYPE "signed char"
+#define INT_FAST16_TYPE "short int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+#define UINT_FAST8_TYPE "unsigned char"
+#define UINT_FAST16_TYPE "short unsigned int"
+#define UINT_FAST32_TYPE "unsigned int"
+#define UINT_FAST64_TYPE "long long unsigned int"
+
+#define INTMAX_TYPE "long long int"
+#define UINTMAX_TYPE "long long unsigned int"
+
+#define INTPTR_TYPE "long int"
+#define UINTPTR_TYPE "long unsigned int"
+
+#define SIG_ATOMIC_TYPE "int"
+
 /* Plain char is unsigned in the SGI compiler.  */
 #undef DEFAULT_SIGNED_CHAR
 #define DEFAULT_SIGNED_CHAR 0
Index: fixincludes/tests/base/stdint.h
===================================================================
--- fixincludes/tests/base/stdint.h	(revision 154216)
+++ fixincludes/tests/base/stdint.h	(working copy)
@@ -152,13 +152,44 @@
 #endif  /* HPUX_STDINT_LEAST_FAST_CHECK */
 
 
-#if defined( IRIX_STDINT_C99_CHECK )
+#if defined( IRIX_STDINT_C99_MODE_CHECK )
 #if 0
 #error This header file is to be used only for c99 mode compilations
 #else
-#endif  /* IRIX_STDINT_C99_CHECK */
+#endif  /* IRIX_STDINT_C99_MODE_CHECK */
 
 
+#if defined( IRIX_STDINT_C99_TYPES_CHECK )
+#define INT64_MIN               (-0x7fffffffffffffffLL - 1)
+#define INT64_MAX               0x7fffffffffffffffLL
+#define UINT32_MAX              0xffffffffU
+#define UINT64_MAX              0xffffffffffffffffULL
+#define INTPTR_MIN              (-0x7fffffffL - 1)
+#define INTPTR_MAX              0x7fffffffL
+#define UINTPTR_MAX             0xffffffffUL
+#define INTPTR_MIN              (-0x7fffffffffffffffL - 1)
+#define INTPTR_MAX              0x7fffffffffffffffL
+#define UINTPTR_MAX             0xffffffffffffffffUL
+#define PTRDIFF_MIN             (-0x7fffffffffffffffL - 1)
+#define PTRDIFF_MAX             0x7fffffffffffffffL
+#define SIZE_MAX                0xffffffffffffffffUL
+#endif  /* IRIX_STDINT_C99_TYPES_CHECK */
+
+
+#if defined( IRIX_STDINT_C99_MACROS_CHECK )
+#define INT8_C(x)               (x)
+#define INT16_C(x)              (x)
+#define INT32_C(x)              (x)
+#define INT64_C(x)              (x ## LL)
+#define UINT8_C(x)              (x)
+#define UINT16_C(x)             (x)
+#define UINT32_C(x)             (x ## U)
+#define UINT64_C(x)             (x ## ULL)
+#define INTMAX_C(x)             (x ## LL)
+#define UINTMAX_C(x)            (x ## ULL)
+#endif  /* IRIX_STDINT_C99_MACROS_CHECK */
+
+
 #if defined( NEWLIB_STDINT_1_CHECK )
 /* @todo - Add support for wint_t types. */
 #define INT32_MIN (-INT32_MAX - 1)
Index: fixincludes/inclhack.def
===================================================================
--- fixincludes/inclhack.def	(revision 154216)
+++ fixincludes/inclhack.def	(working copy)
@@ -2511,7 +2511,7 @@
  *  otherwise.
  */
 fix = {
-    hackname  = irix_stdint_c99;
+    hackname  = irix_stdint_c99_mode;
     files     = stdint.h;
     select = "(#ifndef __c99\n)(#error This header file is to be used only for c99 mode compilations)";
 
@@ -2525,6 +2525,87 @@
 
 
 /*
+ *  IRIX 6.5 <stdint.h> has some *_MIN/MAX constants whose types don't
+ *  match the corresponding types, as required by ISO C99.
+ */
+fix = {
+    hackname  = irix_stdint_c99_types;
+    files     = stdint.h;
+    mach      = "mips-sgi-irix6.5";
+    sed       = "s@^#define INT64_MIN.*$@"
+                "#define INT64_MIN               (-0x7fffffffffffffffLL - 1)@";
+    sed       = "s@^#define INT64_MAX.*$@"
+                "#define INT64_MAX               0x7fffffffffffffffLL@";
+    sed       = "s@^#define UINT32_MAX.*$@"
+                "#define UINT32_MAX              0xffffffffU@";
+    sed       = "s@^#define UINT64_MAX.*$@"
+                "#define UINT64_MAX              0xffffffffffffffffULL@";
+    sed       = "s@^#define INTPTR_MIN.*INT32_MIN$@"
+                "#define INTPTR_MIN              (-0x7fffffffL - 1)@";
+    sed       = "s@^#define INTPTR_MAX.*INT32_MAX$@"
+                "#define INTPTR_MAX              0x7fffffffL@";
+    sed       = "s@^#define UINTPTR_MAX.*UINT32_MAX$@"
+                "#define UINTPTR_MAX             0xffffffffUL@";
+    sed       = "s@^#define INTPTR_MIN.*INT64_MIN@"
+                "#define INTPTR_MIN              (-0x7fffffffffffffffL - 1)@";
+    sed       = "s@^#define INTPTR_MAX.*INT64_MAX$@"
+                "#define INTPTR_MAX              0x7fffffffffffffffL@";
+    sed       = "s@^#define UINTPTR_MAX.*UINT64_MAX$@"
+                "#define UINTPTR_MAX             0xffffffffffffffffUL@";
+    sed       = "s@^#define PTRDIFF_MIN.*INT64_MIN$@"
+                "#define PTRDIFF_MIN             (-0x7fffffffffffffffL - 1)@";
+    sed       = "s@^#define PTRDIFF_MAX.*INT64_MAX$@"
+                "#define PTRDIFF_MAX             0x7fffffffffffffffL@";
+    sed       = "s@^#define SIZE_MAX.*UINT64_MAX#@"
+                "#define SIZE_MAX                0xffffffffffffffffUL@";
+    test_text = "#define INT64_MIN               (-0x7fffffffffffffff - 1)\n"
+                "#define INT64_MAX               0x7fffffffffffffff\n"
+                "#define UINT32_MAX              0xffffffff\n"
+                "#define UINT64_MAX              0xffffffffffffffff\n"
+                "#define INTPTR_MIN              INT32_MIN\n"
+                "#define INTPTR_MAX              INT32_MAX\n"
+                "#define UINTPTR_MAX             UINT32_MAX\n"
+                "#define INTPTR_MIN              INT64_MIN\n"
+                "#define INTPTR_MAX              INT64_MAX\n"
+                "#define UINTPTR_MAX             UINT64_MAX\n"
+                "#define PTRDIFF_MIN             INT64_MIN\n"
+                "#define PTRDIFF_MAX             INT64_MAX\n"
+                "#define SIZE_MAX                UINT64_MAX";
+};
+
+
+/*
+ *  IRIX 6.5 <stdint.h> uses casts in some macros which cannot thus be used
+ *  in preprocessor tests, although ISO C99 requires this.
+ */
+fix = {
+    hackname  = irix_stdint_c99_macros;
+    files     = stdint.h;
+    mach      = "mips-sgi-irix6.5";
+    sed       = "s@^#define INT8_C(x).*$@#define INT8_C(x)               (x)@";
+    sed       = "s@^#define INT16_C(x).*$@#define INT16_C(x)              (x)@";
+    sed       = "s@^#define INT32_C(x).*$@#define INT32_C(x)              (x)@";
+    sed       = "s@^#define INT64_C(x).*$@#define INT64_C(x)              (x ## LL)@";
+    sed       = "s@^#define UINT8_C(x).*$@#define UINT8_C(x)              (x)@";
+    sed       = "s@^#define UINT16_C(x).*$@#define UINT16_C(x)             (x)@";
+    sed       = "s@^#define UINT32_C(x).*$@#define UINT32_C(x)             (x ## U)@";
+    sed       = "s@^#define UINT64_C(x).*$@#define UINT64_C(x)             (x ## ULL)@";
+    sed       = "s@^#define INTMAX_C(x).*$@#define INTMAX_C(x)             (x ## LL)@";
+    sed       = "s@^#define UINTMAX_C(x).*$@#define UINTMAX_C(x)            (x ## ULL)@";
+    test_text = "#define INT8_C(x)               (int_least8_t)(x)\n"
+                "#define INT16_C(x)              (int_least16_t)(x)\n"
+                "#define INT32_C(x)              (int_least32_t)(x)\n"
+                "#define INT64_C(x)              (int_least64_t)(x)\n"
+                "#define UINT8_C(x)              (uint_least8_t)(x)\n"
+                "#define UINT16_C(x)             (uint_least16_t)(x)\n"
+                "#define UINT32_C(x)             (uint_least32_t)(x)\n"
+                "#define UINT64_C(x)             (uint_least64_t)(x)\n"
+                "#define INTMAX_C(x)             (intmax_t)(x)\n"
+                "#define UINTMAX_C(x)            (uintmax_t)(x)";
+};
+
+
+/*
  *  IRIX 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
  *  some functions that take a va_list as
  *  taking char *.  However, GCC uses void * for va_list, so

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: Provide stdint.h for IRIX 5/6
  2009-11-17 13:36 PATCH: Provide stdint.h for IRIX 5/6 Rainer Orth
@ 2009-11-17 13:38 ` Joseph S. Myers
  2009-11-17 19:58   ` Rainer Orth
  0 siblings, 1 reply; 9+ messages in thread
From: Joseph S. Myers @ 2009-11-17 13:38 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, Bruce Korb, Steve Ellcey

On Tue, 17 Nov 2009, Rainer Orth wrote:

> This happens because some sed fixes in newlib_stdint_1 (UINT32_MAX,
> PTRDIFF_MIN, PTRDIFF_MAX, UINT8_C, UINT16_C) and hpux_c99_intptr

The problem newlib definitions were:

#define UINT32_MAX       4294967295U
#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)
#define UINT8_C(x)<TAB>x##U
#define UINT16_C(x)<TAB>x##U

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: Provide stdint.h for IRIX 5/6
  2009-11-17 13:38 ` Joseph S. Myers
@ 2009-11-17 19:58   ` Rainer Orth
  2009-11-18  2:17     ` Bruce Korb
  0 siblings, 1 reply; 9+ messages in thread
From: Rainer Orth @ 2009-11-17 19:58 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: gcc-patches, Bruce Korb, Steve Ellcey

"Joseph S. Myers" <joseph@codesourcery.com> writes:

> On Tue, 17 Nov 2009, Rainer Orth wrote:
>
>> This happens because some sed fixes in newlib_stdint_1 (UINT32_MAX,
>> PTRDIFF_MIN, PTRDIFF_MAX, UINT8_C, UINT16_C) and hpux_c99_intptr
>
> The problem newlib definitions were:
>
> #define UINT32_MAX       4294967295U
> #define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
> #define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)
> #define UINT8_C(x)<TAB>x##U
> #define UINT16_C(x)<TAB>x##U

Thanks, I should have seen this in inclhack.def myself.  Anyway, I've
managed to remove all the testsuite failures, but it turned out to be a
terrible mess:

* All the fixes in newlib_stdint_1 were far too unspecific.
  Unfortunately, the baseline in tests/base/stdint.h used them for the
  AIX, Darwin, and HP-UX tests as well.  I've tightened them all and
  restored the other tests to their `native' fixes to match.

* The fixes in hpux_c99_intptr originally matched the IRIX testcases as
  well.  It turned out that the only difference between the HP-UX and
  IRIX 6 is whitespace: while HP-UX only uses tabs between definition
  and value, IRIX 6 uses blanks.  I've changed the hpux_c99_intptr fix
  to be somewhat less generic, although I realize this is fragile.  The
  proper fix for the testsuite (bootstrap should be unaffected since the
  different mach clauses prevent application of the other fix) would be
  to support select clauses in check.tpl, too, and add a discriminating
  string to the HP-UX testcase.  Unfortunately, I've no idea how to do
  this (I don't speak autogen.  Bruce?) and don't have access to a HP-UX
  system to check what regex could be used as a discriminator.

I'm including the revised fixincludes part of the patch (which needs
approval) below.  It now passes make check; a fresh bootstrap on
mips-sgi-irix6.5 is in progress.

Ok if it passes?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

2009-11-17  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	fixincludes:
	* inclhack.def (irix_stdint_c99): Renamed to irix_stdint_c99_mode.
	(irix_stdint_c99_types): New fix.
	(irix_stdint_c99_macros): Likewise.
	(newlib_stdint_1): Tighten UINT32_MAX, SIZE_MAX, PTRDIFF_MIN,
	PTRDIFF_MAX, UINT8_C, UINT16_C fixes.
	* fixincl.x: Regenerate.
	* tests/base/stdint.h [IRIX_STDINT_C99_CHECK]: Renamed to
	IRIX_STDINT_C99_MODE_CHECK.
	[IRIX_STDINT_C99_TYPES_CHECK]: New test.
	[IRIX_STDINT_C99_MACROS_CHECK]: Likewise.
	[AIX_STDINT_3_CHECK]: Update for tightened newlib_stdint_1 fixes.
	[AIX_STDINT_4_CHECK]: Likewise.
	[AIX_STDINT_5_CHECK]: Likewise.
	[DARWIN_STDINT_1_CHECK]: Likewise.
	[DARWIN_STDINT_4_CHECK]: Likewise.
	[DARWIN_STDINT_6_CHECK]: Likewise.
	[HPUX_C99_INTPTR_CHECK]: Likewise.
	[HPUX_C99_INTTYPES2_CHECK]: Likewise.

Index: tests/base/stdint.h
===================================================================
--- tests/base/stdint.h	(revision 154216)
+++ tests/base/stdint.h	(working copy)
@@ -27,30 +27,30 @@
 
 
 #if defined( AIX_STDINT_3_CHECK )
-#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
-#define PTRDIFF_MAX __PTRDIFF_MAX__
+#define PTRDIFF_MIN	(-9223372036854775807L - 1)
+#define PTRDIFF_MAX	9223372036854775807L
 #else
-#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
-#define PTRDIFF_MAX __PTRDIFF_MAX__
+#define PTRDIFF_MIN	(-2147483647L - 1)
+#define PTRDIFF_MAX	2147483647L
 #endif  /* AIX_STDINT_3_CHECK */
 
 
 #if defined( AIX_STDINT_4_CHECK )
-#define SIZE_MAX __SIZE_MAX__
+#define SIZE_MAX	18446744073709551615UL
 #else
-#define SIZE_MAX __SIZE_MAX__
+#define SIZE_MAX	4294967295UL
 #endif  /* AIX_STDINT_4_CHECK */
 
 
 #if defined( AIX_STDINT_5_CHECK )
-#define UINT8_C(c) __UINT8_C(c)
-#define UINT16_C(c) __UINT16_C(c)
+#define UINT8_C(c)	c
+#define UINT16_C(c)	c
 #endif  /* AIX_STDINT_5_CHECK */
 
 
 #if defined( DARWIN_STDINT_1_CHECK )
-#define UINT8_C(c) __UINT8_C(c)
-#define UINT16_C(c) __UINT16_C(c)
+#define UINT8_C(v)	v
+#define UINT16_C(v)	v
 #endif  /* DARWIN_STDINT_1_CHECK */
 
 
@@ -76,9 +76,9 @@
 
 #if defined( DARWIN_STDINT_4_CHECK )
 #if __WORDSIZE == 64
-#define SIZE_MAX __SIZE_MAX__
+#define SIZE_MAX 18446744073709551615UL
 #else
-#define SIZE_MAX __SIZE_MAX__
+#define SIZE_MAX 4294967295UL
 #endif
 #endif  /* DARWIN_STDINT_4_CHECK */
 
@@ -98,11 +98,11 @@
 
 #if defined( DARWIN_STDINT_6_CHECK )
 #if __WORDSIZE == 64
-#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
-#define PTRDIFF_MAX __PTRDIFF_MAX__
+#define PTRDIFF_MIN (-9223372036854775807L - 1)
+#define PTRDIFF_MAX 9223372036854775807L
 #else
-#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
-#define PTRDIFF_MAX __PTRDIFF_MAX__
+#define PTRDIFF_MIN (-2147483647 - 1)
+#define PTRDIFF_MAX 2147483647
 #endif
 #endif  /* DARWIN_STDINT_6_CHECK */
 
@@ -126,21 +126,21 @@
 
 
 #if defined( HPUX_C99_INTPTR_CHECK )
-#define PTRDIFF_MAX __PTRDIFF_MAX__
+#define PTRDIFF_MAX (2147483647l)
 #define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
 #define INTPTR_MAX (2147483647l)
 #define INTPTR_MIN (-INTPTR_MAX - 1)
 #define UINTPTR_MAX (4294967295ul)
-#define SIZE_MAX __SIZE_MAX__
+#define SIZE_MAX (4294967295ul)
 
 #endif  /* HPUX_C99_INTPTR_CHECK */
 
 
 #if defined( HPUX_C99_INTTYPES2_CHECK )
 #define INT8_C(__c) (__c)
-#define UINT8_C(c) __UINT8_C(c)
+#define UINT8_C(__c) (__c)
 #define INT16_C(__c) (__c)
-#define UINT16_C(c) __UINT16_C(c)
+#define UINT16_C(__c) (__c)
 
 #endif  /* HPUX_C99_INTTYPES2_CHECK */
 
@@ -152,13 +152,44 @@
 #endif  /* HPUX_STDINT_LEAST_FAST_CHECK */
 
 
-#if defined( IRIX_STDINT_C99_CHECK )
+#if defined( IRIX_STDINT_C99_MODE_CHECK )
 #if 0
 #error This header file is to be used only for c99 mode compilations
 #else
-#endif  /* IRIX_STDINT_C99_CHECK */
+#endif  /* IRIX_STDINT_C99_MODE_CHECK */
 
 
+#if defined( IRIX_STDINT_C99_TYPES_CHECK )
+#define INT64_MIN               (-0x7fffffffffffffffLL - 1)
+#define INT64_MAX               0x7fffffffffffffffLL
+#define UINT32_MAX              0xffffffffU
+#define UINT64_MAX              0xffffffffffffffffULL
+#define INTPTR_MIN              (-0x7fffffffL - 1)
+#define INTPTR_MAX              0x7fffffffL
+#define UINTPTR_MAX             0xffffffffUL
+#define INTPTR_MIN              (-0x7fffffffffffffffL - 1)
+#define INTPTR_MAX              0x7fffffffffffffffL
+#define UINTPTR_MAX             0xffffffffffffffffUL
+#define PTRDIFF_MIN             (-0x7fffffffffffffffL - 1)
+#define PTRDIFF_MAX             0x7fffffffffffffffL
+#define SIZE_MAX                0xffffffffffffffffUL
+#endif  /* IRIX_STDINT_C99_TYPES_CHECK */
+
+
+#if defined( IRIX_STDINT_C99_MACROS_CHECK )
+#define INT8_C(x)               (x)
+#define INT16_C(x)              (x)
+#define INT32_C(x)              (x)
+#define INT64_C(x)              (x ## LL)
+#define UINT8_C(x)              (x)
+#define UINT16_C(x)             (x)
+#define UINT32_C(x)             (x ## U)
+#define UINT64_C(x)             (x ## ULL)
+#define INTMAX_C(x)             (x ## LL)
+#define UINTMAX_C(x)            (x ## ULL)
+#endif  /* IRIX_STDINT_C99_MACROS_CHECK */
+
+
 #if defined( NEWLIB_STDINT_1_CHECK )
 /* @todo - Add support for wint_t types. */
 #define INT32_MIN (-INT32_MAX - 1)
Index: inclhack.def
===================================================================
--- inclhack.def	(revision 154216)
+++ inclhack.def	(working copy)
@@ -2159,12 +2159,12 @@
     hackname  = hpux_c99_intptr;
     mach      = "*-hp-hpux11.3*";
     files     = stdint.h;
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN[ \t]*INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX[ \t]*UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX[ \t]*UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX\t*INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN\t*INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX\t*INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN\t*INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX\t*UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX\t*UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@";
     test_text = "#define PTRDIFF_MAX	INT32_MAX\n"
 		"#define PTRDIFF_MIN	INT32_MIN\n"
 		"#define INTPTR_MAX	INT32_MAX\n"
@@ -2511,7 +2511,7 @@
  *  otherwise.
  */
 fix = {
-    hackname  = irix_stdint_c99;
+    hackname  = irix_stdint_c99_mode;
     files     = stdint.h;
     select = "(#ifndef __c99\n)(#error This header file is to be used only for c99 mode compilations)";
 
@@ -2525,6 +2525,87 @@
 
 
 /*
+ *  IRIX 6.5 <stdint.h> has some *_MIN/MAX constants whose types don't
+ *  match the corresponding types, as required by ISO C99.
+ */
+fix = {
+    hackname  = irix_stdint_c99_types;
+    files     = stdint.h;
+    mach      = "mips-sgi-irix6.5";
+    sed       = "s@^#define INT64_MIN.*(-0x7fffffffffffffff - 1)$@"
+                "#define INT64_MIN               (-0x7fffffffffffffffLL - 1)@";
+    sed       = "s@^#define INT64_MAX.*0x7fffffffffffffff$@"
+                "#define INT64_MAX               0x7fffffffffffffffLL@";
+    sed       = "s@^#define UINT32_MAX.*0xffffffff$@"
+                "#define UINT32_MAX              0xffffffffU@";
+    sed       = "s@^#define UINT64_MAX.*0xffffffffffffffff$@"
+                "#define UINT64_MAX              0xffffffffffffffffULL@";
+    sed       = "s@^#define INTPTR_MIN.*INT32_MIN$@"
+                "#define INTPTR_MIN              (-0x7fffffffL - 1)@";
+    sed       = "s@^#define INTPTR_MAX.*INT32_MAX$@"
+                "#define INTPTR_MAX              0x7fffffffL@";
+    sed       = "s@^#define UINTPTR_MAX.*UINT32_MAX$@"
+                "#define UINTPTR_MAX             0xffffffffUL@";
+    sed       = "s@^#define INTPTR_MIN.*INT64_MIN@"
+                "#define INTPTR_MIN              (-0x7fffffffffffffffL - 1)@";
+    sed       = "s@^#define INTPTR_MAX.*INT64_MAX$@"
+                "#define INTPTR_MAX              0x7fffffffffffffffL@";
+    sed       = "s@^#define UINTPTR_MAX.*UINT64_MAX$@"
+                "#define UINTPTR_MAX             0xffffffffffffffffUL@";
+    sed       = "s@^#define PTRDIFF_MIN.*INT64_MIN$@"
+                "#define PTRDIFF_MIN             (-0x7fffffffffffffffL - 1)@";
+    sed       = "s@^#define PTRDIFF_MAX.*INT64_MAX$@"
+                "#define PTRDIFF_MAX             0x7fffffffffffffffL@";
+    sed       = "s@^#define SIZE_MAX.*UINT64_MAX$@"
+                "#define SIZE_MAX                0xffffffffffffffffUL@";
+    test_text = "#define INT64_MIN               (-0x7fffffffffffffff - 1)\n"
+                "#define INT64_MAX               0x7fffffffffffffff\n"
+                "#define UINT32_MAX              0xffffffff\n"
+                "#define UINT64_MAX              0xffffffffffffffff\n"
+                "#define INTPTR_MIN              INT32_MIN\n"
+                "#define INTPTR_MAX              INT32_MAX\n"
+                "#define UINTPTR_MAX             UINT32_MAX\n"
+                "#define INTPTR_MIN              INT64_MIN\n"
+                "#define INTPTR_MAX              INT64_MAX\n"
+                "#define UINTPTR_MAX             UINT64_MAX\n"
+                "#define PTRDIFF_MIN             INT64_MIN\n"
+                "#define PTRDIFF_MAX             INT64_MAX\n"
+                "#define SIZE_MAX                UINT64_MAX";
+};
+
+
+/*
+ *  IRIX 6.5 <stdint.h> uses casts in some macros which cannot thus be used
+ *  in preprocessor tests, although ISO C99 requires this.
+ */
+fix = {
+    hackname  = irix_stdint_c99_macros;
+    files     = stdint.h;
+    mach      = "mips-sgi-irix6.5";
+    sed       = "s@^#define INT8_C(x).*int.*_t.*$@#define INT8_C(x)               (x)@";
+    sed       = "s@^#define INT16_C(x).*int.*_t.*$@#define INT16_C(x)              (x)@";
+    sed       = "s@^#define INT32_C(x).*int.*_t.*$@#define INT32_C(x)              (x)@";
+    sed       = "s@^#define INT64_C(x).*int.*_t.*$@#define INT64_C(x)              (x ## LL)@";
+    sed       = "s@^#define UINT8_C(x).*int.*_t.*$@#define UINT8_C(x)              (x)@";
+    sed       = "s@^#define UINT16_C(x).*int.*_t.*$@#define UINT16_C(x)             (x)@";
+    sed       = "s@^#define UINT32_C(x).*int.*_t.*$@#define UINT32_C(x)             (x ## U)@";
+    sed       = "s@^#define UINT64_C(x).*int.*_t.*$@#define UINT64_C(x)             (x ## ULL)@";
+    sed       = "s@^#define INTMAX_C(x).*int.*_t.*$@#define INTMAX_C(x)             (x ## LL)@";
+    sed       = "s@^#define UINTMAX_C(x).*int.*_t.*$@#define UINTMAX_C(x)            (x ## ULL)@";
+    test_text = "#define INT8_C(x)               (int_least8_t)(x)\n"
+                "#define INT16_C(x)              (int_least16_t)(x)\n"
+                "#define INT32_C(x)              (int_least32_t)(x)\n"
+                "#define INT64_C(x)              (int_least64_t)(x)\n"
+                "#define UINT8_C(x)              (uint_least8_t)(x)\n"
+                "#define UINT16_C(x)             (uint_least16_t)(x)\n"
+                "#define UINT32_C(x)             (uint_least32_t)(x)\n"
+                "#define UINT64_C(x)             (uint_least64_t)(x)\n"
+                "#define INTMAX_C(x)             (intmax_t)(x)\n"
+                "#define UINTMAX_C(x)            (uintmax_t)(x)";
+};
+
+
+/*
  *  IRIX 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
  *  some functions that take a va_list as
  *  taking char *.  However, GCC uses void * for va_list, so
@@ -2817,18 +2898,18 @@
     select    = "@todo - Add support for wint_t types";
     sed       = "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
     sed       = "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
-    sed       = "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
+    sed       = "s@#define UINT32_MAX.*4294967295U.*@#define UINT32_MAX __UINT32_MAX__@";
     sed       = "s@#define INT_LEAST32_MIN.*@#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
     sed       = "s@#define INT_LEAST32_MAX.*@#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
     sed       = "s@#define UINT_LEAST32_MAX.*@#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
     sed       = 's@#define INT_FAST\([0-9]*\)_MIN.*@#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
     sed       = 's@#define INT_FAST\([0-9]*\)_MAX.*@#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
     sed       = 's@#define UINT_FAST\([0-9]*\)_MAX.*@#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
-    sed       = "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
-    sed       = "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
-    sed       = "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
-    sed       = "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
-    sed       = "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
+    sed       = "s@#define SIZE_MAX.*__STDINT_EXP.*@#define SIZE_MAX __SIZE_MAX__@";
+    sed       = "s@#define PTRDIFF_MIN.*__STDINT_EXP.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
+    sed       = "s@#define PTRDIFF_MAX.*__STDINT_EXP.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
+    sed       = "s@#define UINT8_C.*##U.*@#define UINT8_C(c) __UINT8_C(c)@";
+    sed       = "s@#define UINT16_C.*##U.*@#define UINT16_C(c) __UINT16_C(c)@";
     test_text = "/* @todo - Add support for wint_t types. */\n"
                 "#define INT32_MIN (-2147483647-1)\n"
                 "#define INT32_MAX 2147483647\n"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: Provide stdint.h for IRIX 5/6
  2009-11-17 19:58   ` Rainer Orth
@ 2009-11-18  2:17     ` Bruce Korb
  2009-11-18 14:15       ` Rainer Orth
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Korb @ 2009-11-18  2:17 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Joseph S. Myers, gcc-patches, Steve Ellcey

Rainer Orth wrote:
> Thanks, I should have seen this in inclhack.def myself.  Anyway, I've
> managed to remove all the testsuite failures, but it turned out to be a
> terrible mess:

Sorry about that.  It's too easy to write fixes that interfere with
each other, so the "make check" tries to guard against that, even
if "in real life" the two fixes never apply on the same system.

> * All the fixes in newlib_stdint_1 were far too unspecific.
>   Unfortunately, the baseline in tests/base/stdint.h used them for the
>   AIX, Darwin, and HP-UX tests as well.  I've tightened them all and
>   restored the other tests to their `native' fixes to match.

Thank you.  After you've made changes to inclhack.def, you're guaranteed
(almost) to need changes to "base" headers.  You are supposed to ensure
that your changes only apply to your own test text.  If it proves to
be too difficult to disentangle the fixes and if you cannot make a common
fix for AIX, Darwin, HP-UX and newlib (good luck), then you've done well.
Thank you.

> * The fixes in hpux_c99_intptr originally matched the IRIX testcases as
>   well.  It turned out that the only difference between the HP-UX and
>   IRIX 6 is whitespace: while HP-UX only uses tabs between definition
>   and value, IRIX 6 uses blanks.  I've changed the hpux_c99_intptr fix
>   to be somewhat less generic, although I realize this is fragile.  The
>   proper fix for the testsuite (bootstrap should be unaffected since the
>   different mach clauses prevent application of the other fix) would be
>   to support select clauses in check.tpl, too, and add a discriminating
>   string to the HP-UX testcase.  Unfortunately, I've no idea how to do
>   this (I don't speak autogen.  Bruce?) and don't have access to a HP-UX
>   system to check what regex could be used as a discriminator.

You can specify a bogus file name as the first file that gets the fix.
e.g.  files = hpux11-3-stdint.h, stdint.h;
The result will be that the test header will be "hpux11-3-stdint.h"
instead of "stdint.h".  As for a discriminator, usually the headers
have some sort of source control marker in them.  Require that marker
for your fix to fire:
   select = 'some sort of hpux11 stdint.h header marker';
then add that marker to your "test-text".  This technique is used for
a number of the Solaris headers.  These two changes should effectively
isolate your fix.  The AIX, Darwin and newlib fixes should have similar
discriminators.

It's tempting to figure out how to just write some code that strips
out all possible conflicting definitions and inserts working ones
for all platforms, period.  :)  Not today tho...

> I'm including the revised fixincludes part of the patch (which needs
> approval) below.  It now passes make check; a fresh bootstrap on
> mips-sgi-irix6.5 is in progress.
> 
> Ok if it passes?

If it passes and if no base results for other fixes need twiddling
to get it to pass. :)  Thanks - Bruce

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: Provide stdint.h for IRIX 5/6
  2009-11-18  2:17     ` Bruce Korb
@ 2009-11-18 14:15       ` Rainer Orth
  2009-11-18 22:56         ` Bruce Korb
  0 siblings, 1 reply; 9+ messages in thread
From: Rainer Orth @ 2009-11-18 14:15 UTC (permalink / raw)
  To: bkorb; +Cc: Joseph S. Myers, gcc-patches, Steve Ellcey, David Edelsohn

Bruce,

>> * The fixes in hpux_c99_intptr originally matched the IRIX testcases as
>>   well.  It turned out that the only difference between the HP-UX and
>>   IRIX 6 is whitespace: while HP-UX only uses tabs between definition
>>   and value, IRIX 6 uses blanks.  I've changed the hpux_c99_intptr fix
>>   to be somewhat less generic, although I realize this is fragile.  The
>>   proper fix for the testsuite (bootstrap should be unaffected since the
>>   different mach clauses prevent application of the other fix) would be
>>   to support select clauses in check.tpl, too, and add a discriminating
>>   string to the HP-UX testcase.  Unfortunately, I've no idea how to do
>>   this (I don't speak autogen.  Bruce?) and don't have access to a HP-UX
>>   system to check what regex could be used as a discriminator.
>
> You can specify a bogus file name as the first file that gets the fix.
> e.g.  files = hpux11-3-stdint.h, stdint.h;
> The result will be that the test header will be "hpux11-3-stdint.h"
> instead of "stdint.h".  As for a discriminator, usually the headers
> have some sort of source control marker in them.  Require that marker
> for your fix to fire:
>    select = 'some sort of hpux11 stdint.h header marker';
> then add that marker to your "test-text".  This technique is used for
> a number of the Solaris headers.  These two changes should effectively
> isolate your fix.  The AIX, Darwin and newlib fixes should have similar
> discriminators.

Unfortunately, using select with check.tpl doesn't work:
e.g. newlib_stdint_1 has

    select    = "@todo - Add support for wint_t types";

which doesn't occur in the irix_stdint_c99_{types, mode} test_text, yet
the fix is still applied.  That's what I think should be fixed, but it
will probably be much easier for you who breathes autogen than me.  If
this were fixed, using e.g. source control markers can be a good
approach, although they break Solaris 11 fixes at the moment:
Sun/OpenSolaris moved from TeamWare/SCCS to Mercurial as their VCS, so
SCCS markers arent' expanded any longer, although the fixes are still
needed ;-(  I'll fix this separately, though.  It's probably safer to
use a problematic part of the header as discriminator directly.

On HP-UX vs. IRIX, there's only a whitespace (TAB vs. SPC) difference in
the test_text, which I've used for the moment to key off the fixes, but
that seems fragile.  Not having access to any HP-UX system or even a
copy of their stdint.h, I cannot fix this properly myself, so I've used
the whitespace difference for now.  Maybe Steve (Cc:ed) can speak up and
suggest something more appropriate.

>> I'm including the revised fixincludes part of the patch (which needs
>> approval) below.  It now passes make check; a fresh bootstrap on
>> mips-sgi-irix6.5 is in progress.
>> 
>> Ok if it passes?
>
> If it passes and if no base results for other fixes need twiddling
> to get it to pass. :)  Thanks - Bruce

I only needed to twiddle the base results for fixes that incorrectly
used the newlib_stdint_1 fix instead of their own to properly match
their native fixes instead.  Perhaps the platform maintainers can
double-check this?  I've Cc:ed David for AIX, but MAINTAINERS only lists
Apple folks for Darwin (which probably won't/mustn't respond anymore)
and no one for newlib.

	Rainer


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: Provide stdint.h for IRIX 5/6
  2009-11-18 14:15       ` Rainer Orth
@ 2009-11-18 22:56         ` Bruce Korb
  2010-01-26 15:21           ` Rainer Orth
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Korb @ 2009-11-18 22:56 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Joseph S. Myers, gcc-patches, Steve Ellcey, David Edelsohn

Rainer Orth wrote:
> Unfortunately, using select with check.tpl doesn't work:
> e.g. newlib_stdint_1 has
> 
>     select    = "@todo - Add support for wint_t types";

Hi Rainer,

That would be a bug.  The "@todo" shows up in the code:
> $ strings fixincl|fgrep '@todo'
> @todo - Add support for wint_t types
> @todo - Add support for wint_t types

The issue is that the "stdint.h" header _has_ this string:
> $ fgrep '@todo' tests/res/stdint.h
> /* @todo - Add support for wint_t types. */
> /* @todo - Add support for wint_t types. */

so the selection test passes for the newlib discriminator (for example).
Once the fix fires on a file, then the "sed" program takes over and
it does its thing.

I strongly suspect that the best solution would be to write some code
that strips out problematical #defines and replaces them with text that
works for all platforms.  e.g. remove all lines
matching: $'^[ \t]*#[ \t]*define[ \t]+INT32_MAX[ \t]'
then always adds: #define INT32_MAX __INT32_MAX__
period.  If some platform has problems, then just run that fix.
But I'm also shooting in the dark because I do not have all versions
of stdint.h, either.

> which doesn't occur in the irix_stdint_c99_{types, mode} test_text, yet
> the fix is still applied.  That's what I think should be fixed, but it
> will probably be much easier for you who breathes autogen than me.

We're talking fixincludes more than autogen.  I suppose another approach
might be to list two files for fixes that are platform specific:
   files = hpux11-3_stdint.h, stdint.h;
The make checker will put the sample code into the first-named file,
not "stdint.h".  Do that for aix, hpux, darwin and newlib and you'll
separate the testing.  That will fix the problem, but a unified
approach to stdint.h still seems reasonable to me.  (A few extra
nanoseconds get spent checking for file names matching "hpux11-3_stdint.h"
when that should never happen in the wild....)

Thanks - Bruce

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: Provide stdint.h for IRIX 5/6
  2009-11-18 22:56         ` Bruce Korb
@ 2010-01-26 15:21           ` Rainer Orth
  2010-01-26 19:27             ` Bruce Korb
  0 siblings, 1 reply; 9+ messages in thread
From: Rainer Orth @ 2010-01-26 15:21 UTC (permalink / raw)
  To: bkorb; +Cc: Joseph S. Myers, gcc-patches, Steve Ellcey, David Edelsohn

Bruce Korb <bkorb@gnu.org> writes:

[Sorry for the terribly late reply: many other issues had to be dealt
with before returning to this one.]

> Rainer Orth wrote:
>> Unfortunately, using select with check.tpl doesn't work:
>> e.g. newlib_stdint_1 has
>> 
>>     select    = "@todo - Add support for wint_t types";
>
> Hi Rainer,
>
> That would be a bug.  The "@todo" shows up in the code:
>> $ strings fixincl|fgrep '@todo'
>> @todo - Add support for wint_t types
>> @todo - Add support for wint_t types
>
> The issue is that the "stdint.h" header _has_ this string:
>> $ fgrep '@todo' tests/res/stdint.h
>> /* @todo - Add support for wint_t types. */
>> /* @todo - Add support for wint_t types. */
>
> so the selection test passes for the newlib discriminator (for example).
> Once the fix fires on a file, then the "sed" program takes over and
> it does its thing.

This was a misunderstanding on my part: I supposed the selection would
only match the trigger text, not the file.

> I strongly suspect that the best solution would be to write some code
> that strips out problematical #defines and replaces them with text that
> works for all platforms.  e.g. remove all lines
> matching: $'^[ \t]*#[ \t]*define[ \t]+INT32_MAX[ \t]'
> then always adds: #define INT32_MAX __INT32_MAX__
> period.  If some platform has problems, then just run that fix.
> But I'm also shooting in the dark because I do not have all versions
> of stdint.h, either.

That might work, but unless we go that route (certainly not that late in
the GCC 4.5 release cycle), I'd prefer to fix up the few definitions
that are broken in a style matching the rest of the vendor headers.

>> which doesn't occur in the irix_stdint_c99_{types, mode} test_text, yet
>> the fix is still applied.  That's what I think should be fixed, but it
>> will probably be much easier for you who breathes autogen than me.
>
> We're talking fixincludes more than autogen.  I suppose another approach
> might be to list two files for fixes that are platform specific:
>    files = hpux11-3_stdint.h, stdint.h;
> The make checker will put the sample code into the first-named file,
> not "stdint.h".  Do that for aix, hpux, darwin and newlib and you'll
> separate the testing.  That will fix the problem, but a unified
> approach to stdint.h still seems reasonable to me.  (A few extra
> nanoseconds get spent checking for file names matching "hpux11-3_stdint.h"
> when that should never happen in the wild....)

I'm going that route for now.  I've used the stdint-<platform>.h names
so the files sort around the stdint.h testcase. The patch below passes
make check and produces the same fixed stdint.h on IRIX 6.5 as it did
before.  As mentioned before, some of the tests had to be updated to
match their `real' fixes: before, the result of the far too unspecific
newlib fixes had been used.

Ok for mainline?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2010-01-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* inclhack.def (aix_stdint_1): Add stdint-aix.h to files.
	(aix_stdint_2): Likewise.
	(aix_stdint_3): Likewise.
	(aix_stdint_4): Likewise.
	(aix_stdint_5): Likewise.
	(darwin_stdint_1): Add stdint-darwin.h to files.
	(darwin_stdint_2): Likewise.
	(darwin_stdint_3): Likewise.
	(darwin_stdint_4): Likewise.
	(darwin_stdint_5): Likewise.
	(darwin_stdint_6): Likewise.
	(darwin_stdint_7): Likewise.
	(hpux_c99_intptr): Add stdint-hpux11.h to files.
	(hpux_c99_inttypes): Likewise.
	(hpux_c99_inttypes2): Likewise.
	(hpux_stdint_least_fast): Likewise.
	(irix_stdint_c99): Renamed to irix_stdint_c99_mode.
	(irix_stdint_c99_types): New fix.
	(irix_stdint_c99_macros): New fix.
	(newlib_stdint_1): Add stdint-newlib.h to files.
	(newlib_stdint_2): Likewise.
	fixincl.x: Regenerate.
	tests/base/stdint-aix.h: New file.
	tests/base/stdint.h [AIX_STDINT_1_CHECK, AIX_STDINT_2_CHECK,
	AIX_STDINT_3_CHECK, AIX_STDINT_4_CHECK, AIX_STDINT_5_CHECK]: Moved ...
	tests/base/stdint-aix.h: ... here.
	[AIX_STDINT_3_CHECK]: Updated to match aix_stdint_3 fix.
	[AIX_STDINT_4_CHECK]: Updated to match aix_stdint_4 fix.
	[AIX_STDINT_5_CHECK]: Updated to match aix_stdint_5 fix.
	tests/base/stdint-darwin.h: New file.
	tests/base/stdint.h [DARWIN_STDINT_1_CHECK, DARWIN_STDINT_2_CHECK,
	DARWIN_STDINT_3_CHECK, DARWIN_STDINT_4_CHECK,
	DARWIN_STDINT_5_CHECK, DARWIN_STDINT_6_CHECK]: Moved ...
	tests/base/stdint-darwin.h: ... here.
	[DARWIN_STDINT_1_CHECK]: Updated to match darwin_stdint_1 fix.
	[DARWIN_STDINT_4_CHECK]: Updated to match darwin_stdint_4 fix.
	[DARWIN_STDINT_6_CHECK]: Updated to match darwin_stdint_6 fix.
	tests/base/stdint-hpux11.h: New file.
	tests/base/stdint.h [HPUX_C99_INTPTR_CHECK,
	HPUX_C99_INTTYPES2_CHECK, HPUX_STDINT_LEAST_FAST_CHECK]: Moved ...
	tests/base/stdint-hpux11.h: ... here.
	[HPUX_C99_INTPTR_CHECK]: Updated to match hpux_c99_intptr fix.
	[HPUX_C99_INTTYPES2_CHECK]: Updated to match hpux_c99_inttypes2 fix.
	tests/base/stdint.h [IRIX_STDINT_C99_CHECK]: Renamed guard to
	IRIX_STDINT_C99_MODE_CHECK.
	tests/base/stdint-irix65.h: New file.
	tests/base/stdint-newlib.h: New file.
	tests/base/stdint.h [NEWLIB_STDINT_1_CHECK,
	NEWLIB_STDINT_2_CHECK]: Moved ...
	tests/base/stdint-newlib.h: ... here.

diff -r 639f1353c2b9 fixincludes/inclhack.def
--- a/fixincludes/inclhack.def	Mon Jan 25 10:22:04 2010 +0000
+++ b/fixincludes/inclhack.def	Tue Jan 26 15:46:45 2010 +0100
@@ -391,7 +391,7 @@
 fix = {
     hackname  = aix_stdint_1;
     mach      = "*-*-aix*";
-    files     = stdint.h;
+    files     = stdint-aix.h, stdint.h;
     select    = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
 		"#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
     c_fix     = format;
@@ -405,7 +405,7 @@
 fix = {
     hackname  = aix_stdint_2;
     mach      = "*-*-aix*";
-    files     = stdint.h;
+    files     = stdint-aix.h, stdint.h;
     select    = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
 		"#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
 		"#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
@@ -434,7 +434,7 @@
 fix = {
     hackname  = aix_stdint_3;
     mach      = "*-*-aix*";
-    files     = stdint.h;
+    files     = stdint-aix.h, stdint.h;
     select    = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
 		"#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
 		"#else\n"
@@ -457,7 +457,7 @@
 fix = {
     hackname  = aix_stdint_4;
     mach      = "*-*-aix*";
-    files     = stdint.h;
+    files     = stdint-aix.h, stdint.h;
     select    = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
 		"#else\n"
 		"#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
@@ -474,7 +474,7 @@
 fix = {
     hackname  = aix_stdint_5;
     mach      = "*-*-aix*";
-    files     = stdint.h;
+    files     = stdint-aix.h, stdint.h;
     select    = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
 		"#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
     c_fix     = format;
@@ -1144,7 +1144,7 @@
 fix = {
     hackname  = darwin_stdint_1;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
     select    = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
@@ -1161,7 +1161,7 @@
 fix = {
     hackname  = darwin_stdint_2;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define INTPTR_MAX 9223372036854775807L\n"
@@ -1193,7 +1193,7 @@
 fix = {
     hackname  = darwin_stdint_3;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define UINTPTR_MAX 18446744073709551615UL\n"
@@ -1219,7 +1219,7 @@
 fix = {
     hackname  = darwin_stdint_4;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define SIZE_MAX 18446744073709551615UL\n"
@@ -1246,7 +1246,7 @@
 fix = {
     hackname  = darwin_stdint_5;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define INTMAX_MIN   (-9223372036854775807L - 1)\n"
@@ -1275,7 +1275,7 @@
 fix = {
     hackname  = darwin_stdint_6;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
@@ -1308,7 +1308,7 @@
 fix = {
     hackname  = darwin_stdint_7;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define INTMAX_C(v)  (v ## L)\n"
@@ -2158,7 +2158,7 @@
 fix = {
     hackname  = hpux_c99_intptr;
     mach      = "*-hp-hpux11.3*";
-    files     = stdint.h;
+    files     = stdint-hpux11.h, stdint.h;
     sed       = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@";
     sed       = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
     sed       = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@";
@@ -2181,7 +2181,7 @@
     hackname  = hpux_c99_inttypes;
     mach      = "*-hp-hpux11.[23]*";
     files     = inttypes.h;
-    files     = stdint.h;
+    files     = stdint-hpux11.h, stdint.h;
     sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT8_C(__c) (__c)@";
     sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT16_C(__c) (__c)@";
     sed       = "s@^[ \t]*#[ \t]*define[ \t]*INT32_C(__c)[ \t]*__CONCAT__(__c,l)[ \t]*$@#define INT32_C(__c) (__c)@";
@@ -2195,7 +2195,7 @@
 fix = {
     hackname  = hpux_c99_inttypes2;
     mach      = "*-hp-hpux11.2*";
-    files     = stdint.h;
+    files     = stdint-hpux11.h, stdint.h;
     sed       = "s@^[ \t]*#[ \t]*define[ \t]*INT8_C(__c)[ \t]*((signed char)(__c))[ \t]*$@#define INT8_C(__c) (__c)@";
     sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*((unsigned char)(__c))[ \t]*$@#define UINT8_C(__c) (__c)@";
     sed       = "s@^[ \t]*#[ \t]*define[ \t]*INT16_C(__c)[ \t]*((short)(__c))[ \t]*$@#define INT16_C(__c) (__c)@";
@@ -2209,7 +2209,7 @@
 fix = {
     hackname  = hpux_stdint_least_fast;
     mach      = "*-hp-hpux11.2*";
-    files     = stdint.h;
+    files     = stdint-hpux11.h, stdint.h;
     select    =
         "^[ \t]*#[ \t]*define[ \t]+UINT_(LEAST|FAST)64_MAX[ \t]+ULLONG_MAX";
     c_fix     = format;
@@ -2511,7 +2511,7 @@
  *  otherwise.
  */
 fix = {
-    hackname  = irix_stdint_c99;
+    hackname  = irix_stdint_c99_mode;
     files     = stdint.h;
     select = "(#ifndef __c99\n)(#error This header file is to be used only for c99 mode compilations)";
 
@@ -2525,6 +2525,87 @@
 
 
 /*
+ *  IRIX 6.5 <stdint.h> has some *_MIN/MAX constants whose types don't
+ *  match the corresponding types, as required by ISO C99.
+ */
+fix = {
+    hackname  = irix_stdint_c99_types;
+    files     = stdint-irix65.h, stdint.h;
+    mach      = "mips-sgi-irix6.5";
+    sed       = "s@^#define INT64_MIN.*(-0x7fffffffffffffff - 1)$@"
+                "#define INT64_MIN               (-0x7fffffffffffffffLL - 1)@";
+    sed       = "s@^#define INT64_MAX.*0x7fffffffffffffff$@"
+                "#define INT64_MAX               0x7fffffffffffffffLL@";
+    sed       = "s@^#define UINT32_MAX.*0xffffffff$@"
+                "#define UINT32_MAX              0xffffffffU@";
+    sed       = "s@^#define UINT64_MAX.*0xffffffffffffffff$@"
+                "#define UINT64_MAX              0xffffffffffffffffULL@";
+    sed       = "s@^#define INTPTR_MIN.*INT32_MIN$@"
+                "#define INTPTR_MIN              (-0x7fffffffL - 1)@";
+    sed       = "s@^#define INTPTR_MAX.*INT32_MAX$@"
+                "#define INTPTR_MAX              0x7fffffffL@";
+    sed       = "s@^#define UINTPTR_MAX.*UINT32_MAX$@"
+                "#define UINTPTR_MAX             0xffffffffUL@";
+    sed       = "s@^#define INTPTR_MIN.*INT64_MIN@"
+                "#define INTPTR_MIN              (-0x7fffffffffffffffL - 1)@";
+    sed       = "s@^#define INTPTR_MAX.*INT64_MAX$@"
+                "#define INTPTR_MAX              0x7fffffffffffffffL@";
+    sed       = "s@^#define UINTPTR_MAX.*UINT64_MAX$@"
+                "#define UINTPTR_MAX             0xffffffffffffffffUL@";
+    sed       = "s@^#define PTRDIFF_MIN.*INT64_MIN$@"
+                "#define PTRDIFF_MIN             (-0x7fffffffffffffffL - 1)@";
+    sed       = "s@^#define PTRDIFF_MAX.*INT64_MAX$@"
+                "#define PTRDIFF_MAX             0x7fffffffffffffffL@";
+    sed       = "s@^#define SIZE_MAX.*UINT64_MAX$@"
+                "#define SIZE_MAX                0xffffffffffffffffUL@";
+    test_text = "#define INT64_MIN               (-0x7fffffffffffffff - 1)\n"
+                "#define INT64_MAX               0x7fffffffffffffff\n"
+                "#define UINT32_MAX              0xffffffff\n"
+                "#define UINT64_MAX              0xffffffffffffffff\n"
+                "#define INTPTR_MIN              INT32_MIN\n"
+                "#define INTPTR_MAX              INT32_MAX\n"
+                "#define UINTPTR_MAX             UINT32_MAX\n"
+                "#define INTPTR_MIN              INT64_MIN\n"
+                "#define INTPTR_MAX              INT64_MAX\n"
+                "#define UINTPTR_MAX             UINT64_MAX\n"
+                "#define PTRDIFF_MIN             INT64_MIN\n"
+                "#define PTRDIFF_MAX             INT64_MAX\n"
+                "#define SIZE_MAX                UINT64_MAX";
+};
+
+
+/*
+ *  IRIX 6.5 <stdint.h> uses casts in some macros which cannot thus be used
+ *  in preprocessor tests, although ISO C99 requires this.
+ */
+fix = {
+    hackname  = irix_stdint_c99_macros;
+    files     = stdint-irix65.h, stdint.h;
+    mach      = "mips-sgi-irix6.5";
+    sed       = "s@^#define INT8_C(x).*int.*_t.*$@#define INT8_C(x)               (x)@";
+    sed       = "s@^#define INT16_C(x).*int.*_t.*$@#define INT16_C(x)              (x)@";
+    sed       = "s@^#define INT32_C(x).*int.*_t.*$@#define INT32_C(x)              (x)@";
+    sed       = "s@^#define INT64_C(x).*int.*_t.*$@#define INT64_C(x)              (x ## LL)@";
+    sed       = "s@^#define UINT8_C(x).*int.*_t.*$@#define UINT8_C(x)              (x)@";
+    sed       = "s@^#define UINT16_C(x).*int.*_t.*$@#define UINT16_C(x)             (x)@";
+    sed       = "s@^#define UINT32_C(x).*int.*_t.*$@#define UINT32_C(x)             (x ## U)@";
+    sed       = "s@^#define UINT64_C(x).*int.*_t.*$@#define UINT64_C(x)             (x ## ULL)@";
+    sed       = "s@^#define INTMAX_C(x).*int.*_t.*$@#define INTMAX_C(x)             (x ## LL)@";
+    sed       = "s@^#define UINTMAX_C(x).*int.*_t.*$@#define UINTMAX_C(x)            (x ## ULL)@";
+    test_text = "#define INT8_C(x)               (int_least8_t)(x)\n"
+                "#define INT16_C(x)              (int_least16_t)(x)\n"
+                "#define INT32_C(x)              (int_least32_t)(x)\n"
+                "#define INT64_C(x)              (int_least64_t)(x)\n"
+                "#define UINT8_C(x)              (uint_least8_t)(x)\n"
+                "#define UINT16_C(x)             (uint_least16_t)(x)\n"
+                "#define UINT32_C(x)             (uint_least32_t)(x)\n"
+                "#define UINT64_C(x)             (uint_least64_t)(x)\n"
+                "#define INTMAX_C(x)             (intmax_t)(x)\n"
+                "#define UINTMAX_C(x)            (uintmax_t)(x)";
+};
+
+
+/*
  *  IRIX 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
  *  some functions that take a va_list as
  *  taking char *.  However, GCC uses void * for va_list, so
@@ -2813,7 +2894,7 @@
    versions.  */
 fix = {
     hackname  = newlib_stdint_1;
-    files     = stdint.h;
+    files     = stdint-newlib.h, stdint.h;
     select    = "@todo - Add support for wint_t types";
     sed       = "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
     sed       = "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
@@ -2849,7 +2930,7 @@
 
 fix = {
     hackname  = newlib_stdint_2;
-    files     = stdint.h;
+    files     = stdint-newlib.h, stdint.h;
     select    = "@todo - Add support for wint_t types";
     c_fix     = format;
     c_fix_arg = "#define INTMAX_MAX __INTMAX_MAX__\n"
diff -r 639f1353c2b9 fixincludes/tests/base/stdint-aix.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fixincludes/tests/base/stdint-aix.h	Tue Jan 26 15:46:45 2010 +0100
@@ -0,0 +1,48 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/stdint-aix.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( AIX_STDINT_1_CHECK )
+#define UINT8_MAX	(255)
+#define UINT16_MAX	(65535)
+#endif  /* AIX_STDINT_1_CHECK */
+
+
+#if defined( AIX_STDINT_2_CHECK )
+#define INTPTR_MIN	(-INTPTR_MAX-1)
+#define INTPTR_MAX	9223372036854775807L
+#define UINTPTR_MAX	18446744073709551615UL
+#else
+#define INTPTR_MIN	(-INTPTR_MAX-1)
+#define INTPTR_MAX	2147483647L
+#define UINTPTR_MAX	4294967295UL
+#endif  /* AIX_STDINT_2_CHECK */
+
+
+#if defined( AIX_STDINT_3_CHECK )
+#define PTRDIFF_MIN	(-9223372036854775807L - 1)
+#define PTRDIFF_MAX	9223372036854775807L
+#else
+#define PTRDIFF_MIN	(-2147483647L - 1)
+#define PTRDIFF_MAX	2147483647L
+#endif  /* AIX_STDINT_3_CHECK */
+
+
+#if defined( AIX_STDINT_4_CHECK )
+#define SIZE_MAX	18446744073709551615UL
+#else
+#define SIZE_MAX	4294967295UL
+#endif  /* AIX_STDINT_4_CHECK */
+
+
+#if defined( AIX_STDINT_5_CHECK )
+#define UINT8_C(c)	c
+#define UINT16_C(c)	c
+#endif  /* AIX_STDINT_5_CHECK */
diff -r 639f1353c2b9 fixincludes/tests/base/stdint-darwin.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fixincludes/tests/base/stdint-darwin.h	Tue Jan 26 15:46:45 2010 +0100
@@ -0,0 +1,79 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/stdint-darwin.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( DARWIN_STDINT_1_CHECK )
+#define UINT8_C(v)	v
+#define UINT16_C(v)	v
+#endif  /* DARWIN_STDINT_1_CHECK */
+
+
+#if defined( DARWIN_STDINT_2_CHECK )
+#if __WORDSIZE == 64
+#define INTPTR_MAX 9223372036854775807L
+#define INTPTR_MIN (-INTPTR_MAX-1)
+#else
+#define INTPTR_MAX 2147483647L
+#define INTPTR_MIN (-INTPTR_MAX-1)
+#endif
+#endif  /* DARWIN_STDINT_2_CHECK */
+
+
+#if defined( DARWIN_STDINT_3_CHECK )
+#if __WORDSIZE == 64
+#define UINTPTR_MAX 18446744073709551615UL
+#else
+#define UINTPTR_MAX 4294967295UL
+#endif
+#endif  /* DARWIN_STDINT_3_CHECK */
+
+
+#if defined( DARWIN_STDINT_4_CHECK )
+#if __WORDSIZE == 64
+#define SIZE_MAX 18446744073709551615UL
+#else
+#define SIZE_MAX 4294967295UL
+#endif
+#endif  /* DARWIN_STDINT_4_CHECK */
+
+
+#if defined( DARWIN_STDINT_5_CHECK )
+#if __WORDSIZE == 64
+#define INTMAX_MIN   (-9223372036854775807L - 1)
+#define INTMAX_MAX   9223372036854775807L
+#define UINTMAX_MAX  18446744073709551615UL
+#else
+#define INTMAX_MIN   (-9223372036854775807LL - 1)
+#define INTMAX_MAX   9223372036854775807LL
+#define UINTMAX_MAX  18446744073709551615ULL
+#endif
+#endif  /* DARWIN_STDINT_5_CHECK */
+
+
+#if defined( DARWIN_STDINT_6_CHECK )
+#if __WORDSIZE == 64
+#define PTRDIFF_MIN (-9223372036854775807L - 1)
+#define PTRDIFF_MAX 9223372036854775807L
+#else
+#define PTRDIFF_MIN (-2147483647 - 1)
+#define PTRDIFF_MAX 2147483647
+#endif
+#endif  /* DARWIN_STDINT_6_CHECK */
+
+
+#if defined( DARWIN_STDINT_7_CHECK )
+#if __WORDSIZE == 64
+#define INTMAX_C(v)  (v ## L)
+#define UINTMAX_C(v) (v ## UL)
+#else
+#define INTMAX_C(v)  (v ## LL)
+#define UINTMAX_C(v) (v ## ULL)
+#endif
+#endif  /* DARWIN_STDINT_7_CHECK */
diff -r 639f1353c2b9 fixincludes/tests/base/stdint-hpux11.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fixincludes/tests/base/stdint-hpux11.h	Tue Jan 26 15:46:45 2010 +0100
@@ -0,0 +1,36 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/stdint-hpux11.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( HPUX_C99_INTPTR_CHECK )
+#define PTRDIFF_MAX (2147483647l)
+#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
+#define INTPTR_MAX (2147483647l)
+#define INTPTR_MIN (-INTPTR_MAX - 1)
+#define UINTPTR_MAX (4294967295ul)
+#define SIZE_MAX (4294967295ul)
+
+#endif  /* HPUX_C99_INTPTR_CHECK */
+
+
+#if defined( HPUX_C99_INTTYPES2_CHECK )
+#define INT8_C(__c) (__c)
+#define UINT8_C(__c) (__c)
+#define INT16_C(__c) (__c)
+#define UINT16_C(__c) (__c)
+
+#endif  /* HPUX_C99_INTTYPES2_CHECK */
+
+
+#if defined( HPUX_STDINT_LEAST_FAST_CHECK )
+#  define	UINT_FAST64_MAX	__UINT64_MAX__
+#  define	UINT_LEAST64_MAX	__UINT64_MAX__
+
+#endif  /* HPUX_STDINT_LEAST_FAST_CHECK */
diff -r 639f1353c2b9 fixincludes/tests/base/stdint-irix65.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fixincludes/tests/base/stdint-irix65.h	Tue Jan 26 15:46:45 2010 +0100
@@ -0,0 +1,40 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/stdint-irix65.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( IRIX_STDINT_C99_TYPES_CHECK )
+#define INT64_MIN               (-0x7fffffffffffffffLL - 1)
+#define INT64_MAX               0x7fffffffffffffffLL
+#define UINT32_MAX              0xffffffffU
+#define UINT64_MAX              0xffffffffffffffffULL
+#define INTPTR_MIN              (-0x7fffffffL - 1)
+#define INTPTR_MAX              0x7fffffffL
+#define UINTPTR_MAX             0xffffffffUL
+#define INTPTR_MIN              (-0x7fffffffffffffffL - 1)
+#define INTPTR_MAX              0x7fffffffffffffffL
+#define UINTPTR_MAX             0xffffffffffffffffUL
+#define PTRDIFF_MIN             (-0x7fffffffffffffffL - 1)
+#define PTRDIFF_MAX             0x7fffffffffffffffL
+#define SIZE_MAX                0xffffffffffffffffUL
+#endif  /* IRIX_STDINT_C99_TYPES_CHECK */
+
+
+#if defined( IRIX_STDINT_C99_MACROS_CHECK )
+#define INT8_C(x)               (x)
+#define INT16_C(x)              (x)
+#define INT32_C(x)              (x)
+#define INT64_C(x)              (x ## LL)
+#define UINT8_C(x)              (x)
+#define UINT16_C(x)             (x)
+#define UINT32_C(x)             (x ## U)
+#define UINT64_C(x)             (x ## ULL)
+#define INTMAX_C(x)             (x ## LL)
+#define UINTMAX_C(x)            (x ## ULL)
+#endif  /* IRIX_STDINT_C99_MACROS_CHECK */
diff -r 639f1353c2b9 fixincludes/tests/base/stdint-newlib.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fixincludes/tests/base/stdint-newlib.h	Tue Jan 26 15:46:45 2010 +0100
@@ -0,0 +1,42 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/stdint-newlib.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( NEWLIB_STDINT_1_CHECK )
+/* @todo - Add support for wint_t types. */
+#define INT32_MIN (-INT32_MAX - 1)
+#define INT32_MAX __INT32_MAX__
+#define UINT32_MAX __UINT32_MAX__
+#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
+#define INT_LEAST32_MAX __INT_LEAST32_MAX__
+#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
+#define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
+#define INT_FAST8_MAX __INT_FAST8_MAX__
+#define UINT_FAST8_MAX __UINT_FAST8_MAX__
+#define SIZE_MAX __SIZE_MAX__
+#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
+#define PTRDIFF_MAX __PTRDIFF_MAX__
+#define UINT8_C(c) __UINT8_C(c)
+#define UINT16_C(c) __UINT16_C(c)
+#endif  /* NEWLIB_STDINT_1_CHECK */
+
+
+#if defined( NEWLIB_STDINT_2_CHECK )
+/* @todo - Add support for wint_t types. */
+#define INTMAX_MAX __INTMAX_MAX__
+#define INTMAX_MIN (-INTMAX_MAX - 1)
+#define UINTMAX_MAX __UINTMAX_MAX__
+#define WCHAR_MAX __WCHAR_MAX__
+#define WCHAR_MIN __WCHAR_MIN__
+#define WINT_MAX __WINT_MAX__
+#define WINT_MIN __WINT_MIN__
+
+/** Macros for minimum-width integer constant expressions */
+#endif  /* NEWLIB_STDINT_2_CHECK */
diff -r 639f1353c2b9 fixincludes/tests/base/stdint.h
--- a/fixincludes/tests/base/stdint.h	Mon Jan 25 10:22:04 2010 +0000
+++ b/fixincludes/tests/base/stdint.h	Tue Jan 26 15:46:45 2010 +0100
@@ -9,115 +9,6 @@
 
 
 
-#if defined( AIX_STDINT_1_CHECK )
-#define UINT8_MAX	(255)
-#define UINT16_MAX	(65535)
-#endif  /* AIX_STDINT_1_CHECK */
-
-
-#if defined( AIX_STDINT_2_CHECK )
-#define INTPTR_MIN	(-INTPTR_MAX-1)
-#define INTPTR_MAX	9223372036854775807L
-#define UINTPTR_MAX	18446744073709551615UL
-#else
-#define INTPTR_MIN	(-INTPTR_MAX-1)
-#define INTPTR_MAX	2147483647L
-#define UINTPTR_MAX	4294967295UL
-#endif  /* AIX_STDINT_2_CHECK */
-
-
-#if defined( AIX_STDINT_3_CHECK )
-#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
-#define PTRDIFF_MAX __PTRDIFF_MAX__
-#else
-#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
-#define PTRDIFF_MAX __PTRDIFF_MAX__
-#endif  /* AIX_STDINT_3_CHECK */
-
-
-#if defined( AIX_STDINT_4_CHECK )
-#define SIZE_MAX __SIZE_MAX__
-#else
-#define SIZE_MAX __SIZE_MAX__
-#endif  /* AIX_STDINT_4_CHECK */
-
-
-#if defined( AIX_STDINT_5_CHECK )
-#define UINT8_C(c) __UINT8_C(c)
-#define UINT16_C(c) __UINT16_C(c)
-#endif  /* AIX_STDINT_5_CHECK */
-
-
-#if defined( DARWIN_STDINT_1_CHECK )
-#define UINT8_C(c) __UINT8_C(c)
-#define UINT16_C(c) __UINT16_C(c)
-#endif  /* DARWIN_STDINT_1_CHECK */
-
-
-#if defined( DARWIN_STDINT_2_CHECK )
-#if __WORDSIZE == 64
-#define INTPTR_MAX 9223372036854775807L
-#define INTPTR_MIN (-INTPTR_MAX-1)
-#else
-#define INTPTR_MAX 2147483647L
-#define INTPTR_MIN (-INTPTR_MAX-1)
-#endif
-#endif  /* DARWIN_STDINT_2_CHECK */
-
-
-#if defined( DARWIN_STDINT_3_CHECK )
-#if __WORDSIZE == 64
-#define UINTPTR_MAX 18446744073709551615UL
-#else
-#define UINTPTR_MAX 4294967295UL
-#endif
-#endif  /* DARWIN_STDINT_3_CHECK */
-
-
-#if defined( DARWIN_STDINT_4_CHECK )
-#if __WORDSIZE == 64
-#define SIZE_MAX __SIZE_MAX__
-#else
-#define SIZE_MAX __SIZE_MAX__
-#endif
-#endif  /* DARWIN_STDINT_4_CHECK */
-
-
-#if defined( DARWIN_STDINT_5_CHECK )
-#if __WORDSIZE == 64
-#define INTMAX_MIN   (-9223372036854775807L - 1)
-#define INTMAX_MAX   9223372036854775807L
-#define UINTMAX_MAX  18446744073709551615UL
-#else
-#define INTMAX_MIN   (-9223372036854775807LL - 1)
-#define INTMAX_MAX   9223372036854775807LL
-#define UINTMAX_MAX  18446744073709551615ULL
-#endif
-#endif  /* DARWIN_STDINT_5_CHECK */
-
-
-#if defined( DARWIN_STDINT_6_CHECK )
-#if __WORDSIZE == 64
-#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
-#define PTRDIFF_MAX __PTRDIFF_MAX__
-#else
-#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
-#define PTRDIFF_MAX __PTRDIFF_MAX__
-#endif
-#endif  /* DARWIN_STDINT_6_CHECK */
-
-
-#if defined( DARWIN_STDINT_7_CHECK )
-#if __WORDSIZE == 64
-#define INTMAX_C(v)  (v ## L)
-#define UINTMAX_C(v) (v ## UL)
-#else
-#define INTMAX_C(v)  (v ## LL)
-#define UINTMAX_C(v) (v ## ULL)
-#endif
-#endif  /* DARWIN_STDINT_7_CHECK */
-
-
 #if defined( GLIBC_STDINT_CHECK )
 /* This file is part of the GNU C Library.  */
 # define UINT8_C(c)	c
@@ -125,68 +16,8 @@
 #endif  /* GLIBC_STDINT_CHECK */
 
 
-#if defined( HPUX_C99_INTPTR_CHECK )
-#define PTRDIFF_MAX __PTRDIFF_MAX__
-#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
-#define INTPTR_MAX (2147483647l)
-#define INTPTR_MIN (-INTPTR_MAX - 1)
-#define UINTPTR_MAX (4294967295ul)
-#define SIZE_MAX __SIZE_MAX__
-
-#endif  /* HPUX_C99_INTPTR_CHECK */
-
-
-#if defined( HPUX_C99_INTTYPES2_CHECK )
-#define INT8_C(__c) (__c)
-#define UINT8_C(c) __UINT8_C(c)
-#define INT16_C(__c) (__c)
-#define UINT16_C(c) __UINT16_C(c)
-
-#endif  /* HPUX_C99_INTTYPES2_CHECK */
-
-
-#if defined( HPUX_STDINT_LEAST_FAST_CHECK )
-#  define	UINT_FAST64_MAX	__UINT64_MAX__
-#  define	UINT_LEAST64_MAX	__UINT64_MAX__
-
-#endif  /* HPUX_STDINT_LEAST_FAST_CHECK */
-
-
-#if defined( IRIX_STDINT_C99_CHECK )
+#if defined( IRIX_STDINT_C99_MODE_CHECK )
 #if 0
 #error This header file is to be used only for c99 mode compilations
 #else
-#endif  /* IRIX_STDINT_C99_CHECK */
-
-
-#if defined( NEWLIB_STDINT_1_CHECK )
-/* @todo - Add support for wint_t types. */
-#define INT32_MIN (-INT32_MAX - 1)
-#define INT32_MAX __INT32_MAX__
-#define UINT32_MAX __UINT32_MAX__
-#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
-#define INT_LEAST32_MAX __INT_LEAST32_MAX__
-#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
-#define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
-#define INT_FAST8_MAX __INT_FAST8_MAX__
-#define UINT_FAST8_MAX __UINT_FAST8_MAX__
-#define SIZE_MAX __SIZE_MAX__
-#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
-#define PTRDIFF_MAX __PTRDIFF_MAX__
-#define UINT8_C(c) __UINT8_C(c)
-#define UINT16_C(c) __UINT16_C(c)
-#endif  /* NEWLIB_STDINT_1_CHECK */
-
-
-#if defined( NEWLIB_STDINT_2_CHECK )
-/* @todo - Add support for wint_t types. */
-#define INTMAX_MAX __INTMAX_MAX__
-#define INTMAX_MIN (-INTMAX_MAX - 1)
-#define UINTMAX_MAX __UINTMAX_MAX__
-#define WCHAR_MAX __WCHAR_MAX__
-#define WCHAR_MIN __WCHAR_MIN__
-#define WINT_MAX __WINT_MAX__
-#define WINT_MIN __WINT_MIN__
-
-/** Macros for minimum-width integer constant expressions */
-#endif  /* NEWLIB_STDINT_2_CHECK */
+#endif  /* IRIX_STDINT_C99_MODE_CHECK */

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: Provide stdint.h for IRIX 5/6
  2010-01-26 15:21           ` Rainer Orth
@ 2010-01-26 19:27             ` Bruce Korb
  2010-01-26 19:45               ` Rainer Orth
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Korb @ 2010-01-26 19:27 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Joseph S. Myers, gcc-patches, Steve Ellcey, David Edelsohn

On Tue, Jan 26, 2010 at 7:11 AM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> Bruce Korb <bkorb@gnu.org> writes:
>
> [Sorry for the terribly late reply: many other issues had to be dealt
> with before returning to this one.]

No problem.  I overlooked one issue for 5 *years* 8-O
I can't complain anymore...

Looks fine to me.  You might want to consider:
   stdint-checker-aix.h
to make clear it is for "make check" purposes,
but don't bother unless you agree it's worthwhile.
Thanks for your efforts!  Regards, Bruce

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: Provide stdint.h for IRIX 5/6
  2010-01-26 19:27             ` Bruce Korb
@ 2010-01-26 19:45               ` Rainer Orth
  0 siblings, 0 replies; 9+ messages in thread
From: Rainer Orth @ 2010-01-26 19:45 UTC (permalink / raw)
  To: Bruce Korb; +Cc: Joseph S. Myers, gcc-patches, Steve Ellcey, David Edelsohn

Bruce Korb <bkorb@gnu.org> writes:

> Looks fine to me.  You might want to consider:
>    stdint-checker-aix.h
> to make clear it is for "make check" purposes,
> but don't bother unless you agree it's worthwhile.

I think that's a bit too verbose, and would like to get the patch out of
the way since more fixincludes changes are coming for Solaris 2.  Installed.

> Thanks for your efforts!  Regards, Bruce

Thanks for the super-speedy review.

       Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-01-26 19:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-17 13:36 PATCH: Provide stdint.h for IRIX 5/6 Rainer Orth
2009-11-17 13:38 ` Joseph S. Myers
2009-11-17 19:58   ` Rainer Orth
2009-11-18  2:17     ` Bruce Korb
2009-11-18 14:15       ` Rainer Orth
2009-11-18 22:56         ` Bruce Korb
2010-01-26 15:21           ` Rainer Orth
2010-01-26 19:27             ` Bruce Korb
2010-01-26 19:45               ` Rainer Orth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).