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
NO_IMPLICIT_EXTERN_C defined.

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
enable NO_IMPLICIT_EXTERN_C on AIX.

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.

Attachment: ZZ
Description: Binary data

Reply via email to