Patchwork AIX malloc.h fixincludes

login
register
mail settings
Submitter David Edelsohn
Date March 23, 2012, 6:47 p.m.
Message ID <CAGWvnymfOJ2VB9OW6wZEpZ0y7wo0_t-_TL1g5pUbGpPCvyucEA@mail.gmail.com>
Download mbox | patch
Permalink /patch/148481/
State New
Headers show

Comments

David Edelsohn - March 23, 2012, 6:47 p.m.
Some early releases of AIX 6 include a malloc.h header with an
incorrect use of "builtin" keyword:

#ifdef __cplusplus
extern "C" {
   extern "builtin" char *__alloca (size_t);
#  define alloca __alloca
}
#endif /* def __cplusplus */

GCC is not too happy about this.  Now that GCC mainline and 4.7 use
C++ for bootstrap, this breaks bootstrap on a narrow range of AIX 6
systems.  The following patch applies the same fix to the header file
that IBM applied in its own update.

Okay for trunk, 4.7 and 4.6?

Thanks, David


        * inclhack.def (aix_malloc): New.
        * fixincl.x: Regenerate.
        * tests/base/malloc.h [AIX_MALLOC_CHECK]: New.
Bruce Korb - March 23, 2012, 7:13 p.m.
On Fri, Mar 23, 2012 at 11:47 AM, David Edelsohn <dje.gcc@gmail.com> wrote:
> Some early releases of AIX 6 include a malloc.h header with an
> incorrect use of "builtin" keyword:
>
> #ifdef __cplusplus
> extern "C" {
>   extern "builtin" char *__alloca (size_t);
> #  define alloca __alloca
> }
> #endif /* def __cplusplus */
>
> GCC is not too happy about this.

clearly.

> Okay for trunk, 4.7 and 4.6?
OK for any open branch you care to apply it to.

Patch

Index: inclhack.def
===================================================================
--- inclhack.def	(revision 185739)
+++ inclhack.def	(working copy)
@@ -370,6 +370,19 @@ 
 };

 /*
+ *  malloc.h on AIX6 uses XLC++ specific builtin syntax
+ */
+fix = {
+    hackname  = aix_malloc;
+    mach      = "*-*-aix*";
+    files     = "malloc.h";
+    select    = "#ifdef __cplusplus";
+    c_fix     = format;
+    c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))";
+    test_text = "#ifdef __cplusplus";
+};
+
+/*
  * net/if_arp.h defines a variable fc_softc instead of adding a
  * typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1
  */