AIX stdlib.h header decides to redefine malloc and calloc when __VEC__ is defined. Hilarity ensues, such as when GCC uses __attribute__(("malloc")).
Fixed with the appended fixincludes patch. Thanks, David * inclhack.def (aix_stdlib_vec_malloc): New. (aix_stdlib_vec_calloc): New. * fixincl.x: Regenerate. * tests/base/stdlib.h [AIX_STDLIB_VEC_MALLOC]: New test. [AIX_STDLIB_VEC_CALLOC]: New test. Index: inclhack.def =================================================================== --- inclhack.def (revision 257901) +++ inclhack.def (working copy) @@ -838,6 +838,26 @@ test_text = "#define valloc __linux_valloc"; }; +fix = { + hackname = aix_stdlib_vec_malloc; + mach = "*-*-aix*"; + files = stdlib.h; + select = "#define[ \t]+malloc[ \t]+vec_malloc"; + c_fix = format; + c_fix_arg = "extern void *malloc(size_t) __asm__(\"vec_malloc\");"; + test_text = "#define malloc vec_malloc"; +}; + +fix = { + hackname = aix_stdlib_vec_calloc; + mach = "*-*-aix*"; + files = stdlib.h; + select = "#define[ \t]+calloc[ \t]+vec_calloc"; + c_fix = format; + c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"vec_calloc\");"; + test_text = "#define calloc vec_calloc"; +}; + /* * stdlib.h on AIX 4.3 declares strtof() with a non-const first argument. */ Index: tests/base/stdlib.h =================================================================== --- tests/base/stdlib.h (revision 257901) +++ tests/base/stdlib.h (working copy) @@ -29,6 +29,16 @@ #endif /* AIX_STDLIB_VALLOC_CHECK */ +#if defined( AIX_STDLIB_VEC_MALLOC_CHECK ) +extern void *malloc(size_t) __asm__("vec_malloc"); +#endif /* AIX_STDLIB_VEC_MALLOC_CHECK */ + + +#if defined( AIX_STDLIB_VEC_CALLOC_CHECK ) +extern void *calloc(size_t, size_t) __asm__("vec_calloc"); +#endif /* AIX_STDLIB_VEC_CALLOC_CHECK */ + + #if defined( AIX_STRTOF_CONST_CHECK ) extern float strtof(const char *, char **); #endif /* AIX_STRTOF_CONST_CHECK */