diff mbox series

[committed] hppa: Fix libgfortran build on hppa*-hp-hpux[01]*

Message ID c716fc8b-cd38-caad-daa5-f3b57820983a@bell.net
State New
Headers show
Series [committed] hppa: Fix libgfortran build on hppa*-hp-hpux[01]* | expand

Commit Message

John David Anglin Aug. 30, 2021, 7:39 p.m. UTC
The following change fixes the build of libgfortran on hppa*-hp-hpux[01]*.

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

Dave
---

Fix libgfortran build on hppa*-hp-hpux[01]*

Add include hack to define PRIdPTR, PRIiPTR, PRIoPTR, PRIuPTR, PRIxPTR
and PRIXPTR in inttypes.h.

2021-08-30  John David Anglin  <danglin@gcc.gnu.org>

fixincludes/ChangeLog:
	* inclhack.def (hpux_c99_inttypes5): New hack to define PRIdPTR, etc.
	* fixincl.x: Regenerate.
	* tests/base/inttypes.h: Update.
diff mbox series

Patch

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index b7ad6982e96..46e3b8c993a 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -2668,6 +2668,34 @@  fix = {
 		"#define SCNxMAX SCNx32\n";
 };

+/*
+ * Fix missing PRIdPTR defines in inttypes.h
+ */
+fix = {
+    hackname  = hpux_c99_inttypes5;
+    mach      = "hppa*-hp-hpux11.[01]*";
+    files     = inttypes.h;
+    select    = "#ifndef[ \t]_KERNEL[ \t]*\n";
+    c_fix     = format;
+    c_fix_arg = "#ifndef __LP64__\n"
+		"#define PRIdPTR\t\tPRId32\n"
+		"#define PRIiPTR\t\tPRIi32\n"
+		"#define PRIoPTR\t\tPRIo32\n"
+		"#define PRIuPTR\t\tPRIu32\n"
+		"#define PRIxPTR\t\tPRIx32\n"
+		"#define PRIXPTR\t\tPRIX32\n"
+		"#else\n"
+		"#define PRIdPTR\t\tPRId64\n"
+		"#define PRIiPTR\t\tPRIi64\n"
+		"#define PRIoPTR\t\tPRIo64\n"
+		"#define PRIuPTR\t\tPRIu64\n"
+		"#define PRIxPTR\t\tPRIx64\n"
+		"#define PRIXPTR\t\tPRIX64\n"
+		"#endif\n\n"
+		"#ifndef _KERNEL\n";
+    test_text = "#ifndef _KERNEL\n";
+};
+
 /*
  *  Fix hpux broken ctype macros
  */
diff --git a/fixincludes/tests/base/inttypes.h b/fixincludes/tests/base/inttypes.h
index 144ea6596e8..9c1f93eb736 100644
--- a/fixincludes/tests/base/inttypes.h
+++ b/fixincludes/tests/base/inttypes.h
@@ -42,3 +42,25 @@ 
 #define SCNuMAX 	 SCNu32

 #endif  /* HPUX_C99_INTTYPES4_CHECK */
+
+
+#if defined( HPUX_C99_INTTYPES5_CHECK )
+#ifndef __LP64__
+#define PRIdPTR		PRId32
+#define PRIiPTR		PRIi32
+#define PRIoPTR		PRIo32
+#define PRIuPTR		PRIu32
+#define PRIxPTR		PRIx32
+#define PRIXPTR		PRIX32
+#else
+#define PRIdPTR		PRId64
+#define PRIiPTR		PRIi64
+#define PRIoPTR		PRIo64
+#define PRIuPTR		PRIu64
+#define PRIxPTR		PRIx64
+#define PRIXPTR		PRIX64
+#endif
+
+#ifndef _KERNEL
+
+#endif  /* HPUX_C99_INTTYPES5_CHECK */