This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]