* [PATCH,AIX] Fixincludes for vec_malloc, vec_calloc
@ 2018-02-22 16:09 David Edelsohn
0 siblings, 0 replies; only message in thread
From: David Edelsohn @ 2018-02-22 16:09 UTC (permalink / raw)
To: GCC Patches
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 */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-02-22 16:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 16:09 [PATCH,AIX] Fixincludes for vec_malloc, vec_calloc David Edelsohn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).