From d4f076c9b8f4288d748c871b5849146a518dee7b Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Mon, 13 Jun 2016 18:59:43 +0000 Subject: inclhack.def (aix_stdlib_malloc): New fix. * inclhack.def (aix_stdlib_malloc): New fix. (aix_stdlib_realloc): New fix. (aix_stdlib_calloc): New fix. (aix_stdlib_valloc): New fix. * fixincl.x: Regenerate. * test/base/stdlib.h [AIX_STDLIB_MALLOC]: New test. [AIX_STDLIB_REALLOC]: New test. [AIX_STDLIB_CALLOC]: New test. [AIX_STDLIB_VALLOC]: New test. From-SVN: r237394 --- fixincludes/ChangeLog | 12 +++ fixincludes/fixincl.x | 182 ++++++++++++++++++++++++++++++++++++++-- fixincludes/inclhack.def | 42 ++++++++++ fixincludes/tests/base/stdlib.h | 20 +++++ 4 files changed, 251 insertions(+), 5 deletions(-) (limited to 'fixincludes') diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index da21dbcd9ad..60b46882db8 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,15 @@ +2016-06-13 David Edelsohn + + * inclhack.def (aix_stdlib_malloc): New fix. + (aix_stdlib_realloc): New fix. + (aix_stdlib_calloc): New fix. + (aix_stdlib_valloc): New fix. + * fixincl.x: Regenerate. + * tests/base/stdlib.h [AIX_STDLIB_MALLOC]: New test. + [AIX_STDLIB_REALLOC]: New test. + [AIX_STDLIB_CALLOC]: New test. + [AIX_STDLIB_VALLOC]: New test. + 2016-01-31 John David Anglin PR target/68741 diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 38338117690..c79a6e4fb2c 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 Sunday January 31, 2016 at 07:52:05 PM EST + * It has been AutoGen-ed June 10, 2016 at 12:56:52 PM by AutoGen 5.18.3 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sun 31 Jan 2016 19:52:05 EST +/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Jun 10 12:56:52 UTC 2016 * * 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 231 fixup descriptions. + * This file contains 235 fixup descriptions. * * See README for more information. * @@ -1545,6 +1545,154 @@ static const char* apzAix_Stdio_InlinePatch[] = { #ifdef ferror\n", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Stdlib_Malloc fix + */ +tSCC zAix_Stdlib_MallocName[] = + "aix_stdlib_malloc"; + +/* + * File name selection pattern + */ +tSCC zAix_Stdlib_MallocList[] = + "stdlib.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Stdlib_MallocMachs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Stdlib_MallocSelect0[] = + "#define[ \t]+malloc[ \t]+__linux_malloc"; + +#define AIX_STDLIB_MALLOC_TEST_CT 1 +static tTestDesc aAix_Stdlib_MallocTests[] = { + { TT_EGREP, zAix_Stdlib_MallocSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Stdlib_Malloc + */ +static const char* apzAix_Stdlib_MallocPatch[] = { + "format", + "extern void *malloc(size_t) __asm__(\"__linux_malloc\");", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Stdlib_Realloc fix + */ +tSCC zAix_Stdlib_ReallocName[] = + "aix_stdlib_realloc"; + +/* + * File name selection pattern + */ +tSCC zAix_Stdlib_ReallocList[] = + "stdlib.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Stdlib_ReallocMachs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Stdlib_ReallocSelect0[] = + "#define[ \t]+realloc[ \t]+__linux_realloc"; + +#define AIX_STDLIB_REALLOC_TEST_CT 1 +static tTestDesc aAix_Stdlib_ReallocTests[] = { + { TT_EGREP, zAix_Stdlib_ReallocSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Stdlib_Realloc + */ +static const char* apzAix_Stdlib_ReallocPatch[] = { + "format", + "extern void *realloc(void *, size_t) __asm__(\"__linux_realloc\");", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Stdlib_Calloc fix + */ +tSCC zAix_Stdlib_CallocName[] = + "aix_stdlib_calloc"; + +/* + * File name selection pattern + */ +tSCC zAix_Stdlib_CallocList[] = + "stdlib.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Stdlib_CallocMachs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Stdlib_CallocSelect0[] = + "#define[ \t]+calloc[ \t]+__linux_calloc"; + +#define AIX_STDLIB_CALLOC_TEST_CT 1 +static tTestDesc aAix_Stdlib_CallocTests[] = { + { TT_EGREP, zAix_Stdlib_CallocSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Stdlib_Calloc + */ +static const char* apzAix_Stdlib_CallocPatch[] = { + "format", + "extern void *calloc(size_t, size_t) __asm__(\"__linux_calloc\");", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Stdlib_Valloc fix + */ +tSCC zAix_Stdlib_VallocName[] = + "aix_stdlib_valloc"; + +/* + * File name selection pattern + */ +tSCC zAix_Stdlib_VallocList[] = + "stdlib.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Stdlib_VallocMachs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Stdlib_VallocSelect0[] = + "#define[ \t]+valloc[ \t]+__linux_valloc"; + +#define AIX_STDLIB_VALLOC_TEST_CT 1 +static tTestDesc aAix_Stdlib_VallocTests[] = { + { TT_EGREP, zAix_Stdlib_VallocSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Stdlib_Valloc + */ +static const char* apzAix_Stdlib_VallocPatch[] = { + "format", + "extern void *valloc(size_t) __asm__(\"__linux_valloc\");", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aix_Strtof_Const fix @@ -9485,9 +9633,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 268 +#define REGEX_COUNT 272 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 231 +#define FIX_COUNT 235 /* * Enumerate the fixes @@ -9525,6 +9673,10 @@ typedef enum { AIX_STDINT_4_FIXIDX, AIX_STDINT_5_FIXIDX, AIX_STDIO_INLINE_FIXIDX, + AIX_STDLIB_MALLOC_FIXIDX, + AIX_STDLIB_REALLOC_FIXIDX, + AIX_STDLIB_CALLOC_FIXIDX, + AIX_STDLIB_VALLOC_FIXIDX, AIX_STRTOF_CONST_FIXIDX, AIX_SYSMACHINE_FIXIDX, AIX_SYSWAIT_2_FIXIDX, @@ -9887,6 +10039,26 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AIX_STDIO_INLINE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aAix_Stdio_InlineTests, apzAix_Stdio_InlinePatch, 0 }, + { zAix_Stdlib_MallocName, zAix_Stdlib_MallocList, + apzAix_Stdlib_MallocMachs, + AIX_STDLIB_MALLOC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Stdlib_MallocTests, apzAix_Stdlib_MallocPatch, 0 }, + + { zAix_Stdlib_ReallocName, zAix_Stdlib_ReallocList, + apzAix_Stdlib_ReallocMachs, + AIX_STDLIB_REALLOC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Stdlib_ReallocTests, apzAix_Stdlib_ReallocPatch, 0 }, + + { zAix_Stdlib_CallocName, zAix_Stdlib_CallocList, + apzAix_Stdlib_CallocMachs, + AIX_STDLIB_CALLOC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Stdlib_CallocTests, apzAix_Stdlib_CallocPatch, 0 }, + + { zAix_Stdlib_VallocName, zAix_Stdlib_VallocList, + apzAix_Stdlib_VallocMachs, + AIX_STDLIB_VALLOC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Stdlib_VallocTests, apzAix_Stdlib_VallocPatch, 0 }, + { zAix_Strtof_ConstName, zAix_Strtof_ConstList, apzAix_Strtof_ConstMachs, AIX_STRTOF_CONST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 8b6d1fe3a13..8adb07678bc 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -911,6 +911,48 @@ fix = { test_text = "#ifdef __cplusplus\n}\n\n#ifdef ferror"; }; +/* + * stdlib.h on AIX uses #define on malloc and friends. + */ +fix = { + hackname = aix_stdlib_malloc; + mach = "*-*-aix*"; + files = stdlib.h; + select = "#define[ \t]+malloc[ \t]+__linux_malloc"; + c_fix = format; + c_fix_arg = "extern void *malloc(size_t) __asm__(\"__linux_malloc\");"; + test_text = "#define malloc __linux_malloc"; +}; + +fix = { + hackname = aix_stdlib_realloc; + mach = "*-*-aix*"; + files = stdlib.h; + select = "#define[ \t]+realloc[ \t]+__linux_realloc"; + c_fix = format; + c_fix_arg = "extern void *realloc(void *, size_t) __asm__(\"__linux_realloc\");"; + test_text = "#define realloc __linux_realloc"; +}; + +fix = { + hackname = aix_stdlib_calloc; + mach = "*-*-aix*"; + files = stdlib.h; + select = "#define[ \t]+calloc[ \t]+__linux_calloc"; + c_fix = format; + c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"__linux_calloc\");"; + test_text = "#define calloc __linux_calloc"; +}; + +fix = { + hackname = aix_stdlib_valloc; + mach = "*-*-aix*"; + files = stdlib.h; + select = "#define[ \t]+valloc[ \t]+__linux_valloc"; + c_fix = format; + c_fix_arg = "extern void *valloc(size_t) __asm__(\"__linux_valloc\");"; + test_text = "#define valloc __linux_valloc"; +}; /* * stdlib.h on AIX 4.3 declares strtof() with a non-const first argument. diff --git a/fixincludes/tests/base/stdlib.h b/fixincludes/tests/base/stdlib.h index 2f91e07636a..cee7e5db413 100644 --- a/fixincludes/tests/base/stdlib.h +++ b/fixincludes/tests/base/stdlib.h @@ -9,6 +9,26 @@ +#if defined( AIX_STDLIB_MALLOC_CHECK ) +extern void *malloc(size_t) __asm__("__linux_malloc"); +#endif /* AIX_STDLIB_MALLOC_CHECK */ + + +#if defined( AIX_STDLIB_REALLOC_CHECK ) +extern void *realloc(void *, size_t) __asm__("__linux_realloc"); +#endif /* AIX_STDLIB_REALLOC_CHECK */ + + +#if defined( AIX_STDLIB_CALLOC_CHECK ) +extern void *calloc(size_t, size_t) __asm__("__linux_calloc"); +#endif /* AIX_STDLIB_CALLOC_CHECK */ + + +#if defined( AIX_STDLIB_VALLOC_CHECK ) +extern void *valloc(size_t) __asm__("__linux_valloc"); +#endif /* AIX_STDLIB_VALLOC_CHECK */ + + #if defined( AIX_STRTOF_CONST_CHECK ) extern float strtof(const char *, char **); #endif /* AIX_STRTOF_CONST_CHECK */ -- cgit v1.2.3