[PATCH, fixincludes] AIX headers and extern "C"

Bruce Korb bruce.korb@gmail.com
Thu May 21 14:49:00 GMT 2015

OK.  You might consider updating autogen.  It seems 5.18 doesn't
handle the version test quite right.  Any 5.18.n should do fine.  I
guess I didn't test the version test with older versions. :)

On Thu, May 21, 2015 at 6:58 AM, David Edelsohn <dje.gcc@gmail.com> wrote:
> The AIX port of GCC is one of the few ports that does not define
> NO_IMPLICIT_EXTERN_C.  A user reported a problem that we tracked to an
> AIX header that explicitly used C++ features (bracketed by #ifdef
> __cplusplus).
> AIX headers have included some C++ features, mostly protected by
> #if defined (__cplusplus) && defined (__IBMCPP__)
> but a few only by __cplusplus.  Because of the way the particular
> header is structured, adding a test for __IBMCPP__ causes other
> problems.
> At the encouragement of Jonathan (implicit extern "C" is an
> abomination) Wakely, I tried to bootstrap GCC with
> NO_IMPLICIT_EXTERN_C defined on AIX.  That failed horribly.  Some AIX
> headers use C++ features while others are not C++ safe.  Sigh.
> This patch adds a new fix to wrap the failing AIX headers necessary
> for GCC bootstrap in extern "C". I can bootstrap with
> I don't see clear way to discover which of the headers are C++ safe
> and which are not if there is no clear intention from IBM AIX Brand to
> make the headers C++ safe.  I don't see a robust and low-risk way to
> So, this patch also adds an extern "C++" block around the C++ code in
> sys/socket.h that caused the initial failure.  I could not find other
> headers that used C++ features without __IBMCPP__.
> Bootstrapped on powerpc-ibm-aix7.1.0.0.
> Okay?
> Thanks, David
>     * inclhack.def (aix_externc): New fix.
>     (aix_externcpp[12]): New fix.
>     * fixincl.x: Regenerate.
>     * test/base/ctype.h [AIX_EXTERNC_CHECK]: New test.
>     * test/base/sys/socket.h [AIX_EXTERNCPP[12]_CHECK]: New test.
>     * test/base/fcntl.h: New file.

More information about the Gcc-patches mailing list