From: David Edelsohn Date: Thu, 17 Sep 2020 15:18:48 +0000 (+0000) Subject: aix: Fix _STDC_FORMAT_MACROS in inttypes.h [PR97044] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=081b3517b4df826ac917147eb906bbb8fc6528b1;p=gcc.git aix: Fix _STDC_FORMAT_MACROS in inttypes.h [PR97044] AIX protects the STDC Format Macros in a manner that can prevent the definition of the macros depending on the order of header inclusion. The protection of the macros was referenced in C99, removed in C11, and never specified in any C++ standard. Also, the macros are in the namespace reserved to the implementation (compiler) so the compiler is permitted to choose to inject those names. fixincludes/ChangeLog: 2020-09-17 David Edelsohn PR target/97044 * inclhack.def (aix_inttypes): New fix. * fixincl.x: Regenerate. * tests/base/sys/inttypes.h: New file. --- diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index bf54305b9c0..cb966829ba3 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 September 16, 2020 at 06:34:57 PM by AutoGen 5.18 + * It has been AutoGen-ed September 17, 2020 at 03:10:47 PM by AutoGen 5.18 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Sep 16 18:34:57 UTC 2020 +/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Sep 17 15:10:47 UTC 2020 * * 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 258 fixup descriptions. + * This file contains 259 fixup descriptions. * * See README for more information. * @@ -883,6 +883,43 @@ static const char* apzAix_Externcpp2Patch[] = { #else /* __cplusplus */", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Inttypes fix + */ +tSCC zAix_InttypesName[] = + "aix_inttypes"; + +/* + * File name selection pattern + */ +tSCC zAix_InttypesList[] = + "sys/inttypes.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_InttypesMachs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_InttypesSelect0[] = + "#if !defined\\(__cplusplus\\) \\|\\| defined\\(__STDC_FORMAT_MACROS\\)"; + +#define AIX_INTTYPES_TEST_CT 1 +static tTestDesc aAix_InttypesTests[] = { + { TT_EGREP, zAix_InttypesSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Inttypes + */ +static const char* apzAix_InttypesPatch[] = { + "format", + "#if 1", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aix_Malloc fix @@ -10480,9 +10517,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 296 +#define REGEX_COUNT 297 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 258 +#define FIX_COUNT 259 /* * Enumerate the fixes @@ -10505,6 +10542,7 @@ typedef enum { AIX_EXTERNC_FIXIDX, AIX_EXTERNCPP1_FIXIDX, AIX_EXTERNCPP2_FIXIDX, + AIX_INTTYPES_FIXIDX, AIX_MALLOC_FIXIDX, AIX_NET_IF_ARP_FIXIDX, AIX_NULL_FIXIDX, @@ -10834,6 +10872,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AIX_EXTERNCPP2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aAix_Externcpp2Tests, apzAix_Externcpp2Patch, 0 }, + { zAix_InttypesName, zAix_InttypesList, + apzAix_InttypesMachs, + AIX_INTTYPES_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_InttypesTests, apzAix_InttypesPatch, 0 }, + { zAix_MallocName, zAix_MallocList, apzAix_MallocMachs, AIX_MALLOC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 3b397422bc1..6e59be981d6 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -577,6 +577,19 @@ fix = { "#else /* __cplusplus */"; }; +/* + * inttypes.h STDC_FORMAT_MACROS + */ +fix = { + hackname = aix_inttypes; + mach = "*-*-aix*"; + files = "sys/inttypes.h"; + select = "#if !defined\\(__cplusplus\\) \\|\\| defined\\(__STDC_FORMAT_MACROS\\)"; + c_fix = format; + c_fix_arg = "#if 1"; + test_text = "#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)"; +}; + /* * malloc.h on AIX6 uses XLC++ specific builtin syntax */ diff --git a/fixincludes/tests/base/sys/inttypes.h b/fixincludes/tests/base/sys/inttypes.h new file mode 100644 index 00000000000..f349bdacdbf --- /dev/null +++ b/fixincludes/tests/base/sys/inttypes.h @@ -0,0 +1,14 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/sys/inttypes.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( AIX_INTTYPES_CHECK ) +#if 1 +#endif /* AIX_INTTYPES_CHECK */