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 stdio inclhack - fixes PR20366


Hi,

On AIX systems, if _LARGE_FILES is defined then 64 bit file operations
are the default. This is, unfortunately, accomplished by #defines in
stdio.h.

Autoconf has a macro AC_SYS_LARGEFILE,
(http://www.gnu.org/software/autoconf/manual/autoconf.html#System-Services)
which is meant to enable support for large files. On AIX systems it
defines _LARGE_FILES.

It works well for xlc and for gcc, again, unfortunately, g++ fails to
compile even a very simple test case with -D_LARGE_FILES because
cstdio has #undefs for most of the functions declared in stdio.h. This
means that after preprocessing the compiler sees a declaration for,
e.g. fopen64, but not fopen, and then it sees 'using ::fopen;' and
rightly errors out.

This patch uses the fixincludes machinery to modify stdio.h so that,
if __GNUG__, _LARGE_FILES, and __cplusplus are defined it undefs the
fopen etc and uses __asm__ to alias the symbols instead.

The test case simply tests that the  prototypes from including
<cstdio> with -D_LARGE_FILES match what we would get with the #define
in the original headers.

Note that although the generated fixincl.x is included in this patch,
the committer may want/need to use a later version of autogen to get
the gplv3 version.

We do not have write access to the gcc repository, so would be
grateful if someone could apply this for us if approved.

Thank you,
Peter

Attachment: gcc_aix_stdio_inclhack.patch
Description: Patch for PR20366


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