From a6fe949d570f1957aa1caba572e20f2c0760f89a Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Mon, 30 Aug 2021 19:31:40 +0000 Subject: [PATCH] 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 fixincludes/ChangeLog: * inclhack.def (hpux_c99_inttypes5): New hack to define PRIdPTR, etc. * fixincl.x: Regenerate. * tests/base/inttypes.h: Update. --- fixincludes/fixincl.x | 68 ++++++++++++++++++++++++++++--- fixincludes/inclhack.def | 28 +++++++++++++ fixincludes/tests/base/inttypes.h | 22 ++++++++++ 3 files changed, 113 insertions(+), 5 deletions(-) diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 6c50e972165..bc2fcd22482 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed July 1, 2021 at 03:44:46 PM by AutoGen 5.18.7 + * It has been AutoGen-ed August 30, 2021 at 07:31:11 PM by AutoGen 5.18.16 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Jul 1 15:44:46 CEST 2021 +/* DO NOT SVN-MERGE THIS FILE, EITHER Mon Aug 30 19:31:11 UTC 2021 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 260 fixup descriptions. + * This file contains 261 fixup descriptions. * * See README for more information. * @@ -5311,6 +5311,58 @@ static const char* apzHpux_C99_Inttypes4Patch[] = { sed_cmd_z, #define SCNuMAX \t SCNu32\n", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Hpux_C99_Inttypes5 fix + */ +tSCC zHpux_C99_Inttypes5Name[] = + "hpux_c99_inttypes5"; + +/* + * File name selection pattern + */ +tSCC zHpux_C99_Inttypes5List[] = + "inttypes.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzHpux_C99_Inttypes5Machs[] = { + "hppa*-hp-hpux11.[01]*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zHpux_C99_Inttypes5Select0[] = + "#ifndef[ \t]_KERNEL[ \t]*\n"; + +#define HPUX_C99_INTTYPES5_TEST_CT 1 +static tTestDesc aHpux_C99_Inttypes5Tests[] = { + { TT_EGREP, zHpux_C99_Inttypes5Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Hpux_C99_Inttypes5 + */ +static const char* apzHpux_C99_Inttypes5Patch[] = { + "format", + "#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", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Hpux_Ctype_Macros fix @@ -10560,9 +10612,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 298 +#define REGEX_COUNT 299 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 260 +#define FIX_COUNT 261 /* * Enumerate the fixes @@ -10695,6 +10747,7 @@ typedef enum { HPUX_C99_INTTYPES2_FIXIDX, HPUX_C99_INTTYPES3_FIXIDX, HPUX_C99_INTTYPES4_FIXIDX, + HPUX_C99_INTTYPES5_FIXIDX, HPUX_CTYPE_MACROS_FIXIDX, HPUX_EXTERN_ERRNO_FIXIDX, HPUX_HTONL_FIXIDX, @@ -11466,6 +11519,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { HPUX_C99_INTTYPES4_TEST_CT, FD_MACH_ONLY, aHpux_C99_Inttypes4Tests, apzHpux_C99_Inttypes4Patch, 0 }, + { zHpux_C99_Inttypes5Name, zHpux_C99_Inttypes5List, + apzHpux_C99_Inttypes5Machs, + HPUX_C99_INTTYPES5_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aHpux_C99_Inttypes5Tests, apzHpux_C99_Inttypes5Patch, 0 }, + { zHpux_Ctype_MacrosName, zHpux_Ctype_MacrosList, apzHpux_Ctype_MacrosMachs, HPUX_CTYPE_MACROS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, 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 */