From 92648faa1cb2b28685f3b3dccfdfc4b1ed2c5a7b Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Wed, 18 Nov 2020 10:33:30 -0800 Subject: [PATCH] aix: Fixinclude This fixes an ODR violation in the AIX headers that is detected by C++ modules. While unnamed structs with typedef names for linkage purposes are accepted, this case is an anonymous struct without such a typedef name -- the typedef is attached to the pointer-to-struct type. Fixed by naming the struct. fixincludes/ * inclhack.def (aix_physaddr_t): New. * fixincl.x: Regenerated. --- fixincludes/fixincl.x | 53 ++++++++++++++++++++++++++++++++++++---- fixincludes/inclhack.def | 14 +++++++++++ 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 758d5620641..21439652bce 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 October 3, 2020 at 11:40:52 PM by AutoGen 5.18 + * It has been AutoGen-ed October 21, 2020 at 10:43:22 AM by AutoGen 5.18.16 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Oct 3 23:40:52 UTC 2020 +/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Oct 21 10:43:22 EDT 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 259 fixup descriptions. + * This file contains 260 fixup descriptions. * * See README for more information. * @@ -1247,6 +1247,43 @@ static const char* apzAix_Rwlock_Initializer_1Patch[] = { {{ \\\n", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Physadr_T fix + */ +tSCC zAix_Physadr_TName[] = + "aix_physadr_t"; + +/* + * File name selection pattern + */ +tSCC zAix_Physadr_TList[] = + "sys/types.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Physadr_TMachs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Physadr_TSelect0[] = + "typedef[ \t]*struct[ \t]*([{][^}]*[}][ \t]*\\*[ \t]*physadr_t;)"; + +#define AIX_PHYSADR_T_TEST_CT 1 +static tTestDesc aAix_Physadr_TTests[] = { + { TT_EGREP, zAix_Physadr_TSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Physadr_T + */ +static const char* apzAix_Physadr_TPatch[] = { + "format", + "typedef struct __physadr_s %1", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aix_Pthread fix @@ -10521,9 +10558,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 297 +#define REGEX_COUNT 298 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 259 +#define FIX_COUNT 260 /* * Enumerate the fixes @@ -10555,6 +10592,7 @@ typedef enum { AIX_MUTEX_INITIALIZER_1_FIXIDX, AIX_COND_INITIALIZER_1_FIXIDX, AIX_RWLOCK_INITIALIZER_1_FIXIDX, + AIX_PHYSADR_T_FIXIDX, AIX_PTHREAD_FIXIDX, AIX_STDINT_1_FIXIDX, AIX_STDINT_2_FIXIDX, @@ -10921,6 +10959,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AIX_RWLOCK_INITIALIZER_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aAix_Rwlock_Initializer_1Tests, apzAix_Rwlock_Initializer_1Patch, 0 }, + { zAix_Physadr_TName, zAix_Physadr_TList, + apzAix_Physadr_TMachs, + AIX_PHYSADR_T_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Physadr_TTests, apzAix_Physadr_TPatch, 0 }, + { zAix_PthreadName, zAix_PthreadList, apzAix_PthreadMachs, AIX_PTHREAD_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 47eb236586c..80c9adfb07c 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -720,6 +720,20 @@ fix = { "{ \\\\\n"; }; + +/* On AIX 'typedef struct {} * physadr_t;' needs to give the struct a + name for linkage purposes. Fortunately it is on exactly one + line. */ +fix = { + hackname = aix_physadr_t; + mach = "*-*-aix*"; + files = sys/types.h; + select = "typedef[ \t]*struct[ \t]*([{][^}]*[}][ \t]*\\*[ \t]*physadr_t;)"; + c_fix = format; + c_fix_arg = "typedef struct __physadr_s %1"; + test_text = "typedef struct __physadr_s {"; +}; + /* * pthread.h on AIX 4.3.3 tries to define a macro without whitspace * which violates a requirement of ISO C.