[committed] Fix compilation of libgomp/target.c on hppa*-*-hpux11.*

Message ID 2a6fdc1b-96ae-6baa-4e49-f3c3373e59e5@bell.net
State New
Headers show
Series
  • [committed] Fix compilation of libgomp/target.c on hppa*-*-hpux11.*
Related show

Commit Message

John David Anglin Dec. 30, 2019, 8:51 p.m.
A recent change to target.c introduced the UINTPTR_MAX define.  This exposed the fact that
defines for INTPTR_MAX and UINTPTR_MAX are incomplete, and the define for SIZE_MAX is missing
on hpux11.11.

See:
https://community.hpe.com/t5/Languages-and-Scripting/SIZE-MAX-undefined/td-p/4798688#

The attached change fixes the INTPTR_MAX and UINTPTR_MAX defines, and adds the SIZE_MAX define.

The defines are taken from gcc's stdint.h header file.

Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.

Committed to trunk.

Dave

2019-12-30  John David Anglin  <danglin@gcc.gnu.org>

	PR libgomp/93066
	* inclhack.def (hpux_c99_inttypes3): Fix defines for INTPTR_MAX
	and UINTPTR_MAX, and missing define for SIZE_MAX.
	* fixincl.x: Regenerate.
	* tests/base/inttypes.h: Update for above fix.

Patch

Index: inclhack.def
===================================================================
--- inclhack.def	(revision 279736)
+++ inclhack.def	(working copy)
@@ -2588,6 +2588,32 @@ 
 };

 /*
+ * Fix broken and missing defines in inttypes.h
+ */
+fix = {
+    hackname  = hpux_c99_inttypes3;
+    mach      = "hppa*-hp-hpux11*";
+    files     = inttypes.h;
+    select    = "#define[ \t]INTPTR_MAX[ \t]*\n"
+		"#define[ \t]UINTPTR_MAX[ \t]*\n";
+    c_fix     = format;
+    c_fix_arg = "#undef SIZE_MAX\n"
+		"#define SIZE_MAX __SIZE_MAX__\n"
+		"#ifdef __INTPTR_MAX__\n"
+		"# undef INTPTR_MAX\n"
+		"# define INTPTR_MAX __INTPTR_MAX__\n"
+		"# undef INTPTR_MIN\n"
+		"# define INTPTR_MIN (-INTPTR_MAX - 1)\n"
+		"#endif\n"
+		"#ifdef __UINTPTR_MAX__\n"
+		"# undef UINTPTR_MAX\n"
+		"# define UINTPTR_MAX __UINTPTR_MAX__\n"
+		"#endif\n";
+    test_text = "#define INTPTR_MAX\n"
+		"#define UINTPTR_MAX\n";
+};
+
+/*
  *  Fix hpux broken ctype macros
  */
 fix = {
Index: tests/base/inttypes.h
===================================================================
--- tests/base/inttypes.h	(revision 279736)
+++ tests/base/inttypes.h	(working copy)
@@ -16,3 +16,20 @@ 
 #define UINT32_C(__c) __CONCAT__(__c,u)

 #endif  /* HPUX_C99_INTTYPES_CHECK */
+
+
+#if defined( HPUX_C99_INTTYPES3_CHECK )
+#undef SIZE_MAX
+#define SIZE_MAX __SIZE_MAX__
+#ifdef __INTPTR_MAX__
+# undef INTPTR_MAX
+# define INTPTR_MAX __INTPTR_MAX__
+# undef INTPTR_MIN
+# define INTPTR_MIN (-INTPTR_MAX - 1)
+#endif
+#ifdef __UINTPTR_MAX__
+# undef UINTPTR_MAX
+# define UINTPTR_MAX __UINTPTR_MAX__
+#endif
+
+#endif  /* HPUX_C99_INTTYPES3_CHECK */