[Bug target/20366] AIX g++ -D_LARGE_FILES fails to compile #include <iostream>
haubi at gentoo dot org
gcc-bugzilla@gcc.gnu.org
Sat Dec 1 22:04:00 GMT 2007
------- Comment #4 from haubi at gentoo dot org 2007-12-01 22:04 -------
Same here with gcc-4.2.2 and powerpc-ibm-aix5.3.0.0.
Some diagnostics what happens when _LARGE_FILES (and _LARGE_FILE_API) is
defined:
<sys/types.h>
/* would both be 'long' without _LARGE_FILES: */
typedef long long fpos_t;
typedef long long off_t;
/* because of _LARGE_FILE_API: */
typedef long long off64_t;
<stdio.h>
/* because of _LARGE_FILES (the 'problematic' ones): */
#define fseeko fseeko64
#define ftello ftello64
#define fgetpos fgetpos64
#define fsetpos fsetpos64
#define fopen fopen64
#define freopen freopen64
/* these actually are declared as f*64() because of defines above: */
extern FILE *fopen(const char *, const char *);
extern FILE *freopen(const char *, const char *, FILE *);
extern int fgetpos(FILE *, fpos_t *);
extern int fsetpos(FILE *, const fpos_t *);
extern int fseeko(FILE *, off_t, int);
extern off_t ftello(FILE *);
/* because of _LARGE_FILE_API: */
extern int fgetpos64(FILE *, fpos64_t *);
extern FILE *fopen64(const char *, const char *);
extern FILE *freopen64(const char *, const char *, FILE *);
extern int fseeko64(FILE *, off64_t, int);
extern int fsetpos64(FILE *, const fpos64_t *);
extern off64_t ftello64(FILE *);
<cstdio>
/* remember: these actually are declared as f*64(),
* while the original ones are undeclared.
*/
#undef fgetpos
#undef fopen
#undef freopen
#undef fsetpos
namespace std {
using ::fpos_t;
using ::fgetpos;
using ::fopen;
using ::freopen;
using ::fsetpos;
}
I'm unsure how to 'fix' that 'correctly' - one suggestion is to 'fixincludes':
Add this just _before_ those '#define fopen fopen64' lines in <stdio.h>
static FILE *fopen(const char *a, const char *b) { return fopen64(a,b); }
Eventually there is a better way to redirect from 'fopen' to 'fopen64' on aix
also for the compiler - not just the preprocessor.
--
haubi at gentoo dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |haubi at gentoo dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20366
More information about the Gcc-bugs
mailing list