| 1 |
// Test fix for PR20366 |
| 2 |
// |
| 3 |
// { dg-do compile { target *-*-aix* } } |
| 4 |
// { dg-options "-D_LARGE_FILES" } |
| 5 |
// |
| 6 |
// cstdio includes stdio.h and undefs most of the functions declared |
| 7 |
// therein, unfortunately this means that #define fopen fopen64 goes |
| 8 |
// away. This tests the fix, and ensures that with -D_LARGE_FILES |
| 9 |
// fopen et. al. are indeed aliased to the large file equivalents. |
| 10 |
// |
| 11 |
// There are many other #define foo foo64 in the AIX headers, but |
| 12 |
// these all work out fine as they are not undefined in libstdc++. |
| 13 |
// This list is probably incomplete: |
| 14 |
// |
| 15 |
// Symbol Return type Large file declaration. |
| 16 |
// |
| 17 |
// aio.h (different for different AIX versions) |
| 18 |
// ===== |
| 19 |
// aio_read int aio_read64(int, struct aiocb64 *); |
| 20 |
// aio_write int aio_write64(int, struct aiocb64 *); |
| 21 |
// lio_listio int lio_listio64(int, struct liocb64 *[], int, void *); |
| 22 |
// aio_cancel int aio_cancel64(int, struct aiocb64 *); |
| 23 |
// aio_suspend int aio_suspend64(int, struct aiocb64 *[]); |
| 24 |
// |
| 25 |
// stdio.h |
| 26 |
// ======= |
| 27 |
// fgetpos int fgetpos64(FILE *, fpos64_t *); |
| 28 |
// fopen FILE *fopen64(const char *, const char *); |
| 29 |
// freopen FILE *freopen64(const char *, const char *, FILE *); |
| 30 |
// fseeko int fseeko64(FILE *, off64_t, int); |
| 31 |
// fsetpos int fsetpos64(FILE *, const fpos64_t *); |
| 32 |
// ftello off64_t ftello64(FILE *); |
| 33 |
// |
| 34 |
// unistd.h |
| 35 |
// ======== |
| 36 |
// fclear off64_t fclear64(int, off64_t); |
| 37 |
// fsync_range int fsync_range64(int, int, off64_t, off64_t); |
| 38 |
// ftruncate int ftruncate64(int, off64_t); |
| 39 |
// truncate int truncate64(const char *, off64_t); |
| 40 |
// lseek off64_t lseek64(int, off64_t, int); |
| 41 |
// pread ssize_t pread64(int, void *, size_t, off64_t); |
| 42 |
// pwrite ssize_t pwrite64(int, const void *, size_t, off64_t); |
| 43 |
// |
| 44 |
// fcntl.h |
| 45 |
// ======= |
| 46 |
// open int open64(const char *, int, ...); |
| 47 |
// creat int creat64(const char *, mode_t); |
| 48 |
// |
| 49 |
// sys/stat.h |
| 50 |
// ========== |
| 51 |
// stat int stat64(const char *, struct stat64 *); |
| 52 |
// fstat int fstat64(int, struct stat64 *); |
| 53 |
// lstat int lstat64(const char *, struct stat64 *); |
| 54 |
// |
| 55 |
// stdlib.h |
| 56 |
// ======== |
| 57 |
// mkstemp int mkstemp64(char *); |
| 58 |
// |
| 59 |
// ftw.h |
| 60 |
// ===== |
| 61 |
// ftw int ftw64(const char *, int (*)(const char *,const struct stat64 *, int), int); |
| 62 |
// nftw int nftw64(const char *, int (*)(const char *, const struct stat64 *, int, struct FTW*), int, int); |
| 63 |
// |
| 64 |
// It seems unlikely that any of these will be used (and #undef'ed) by |
| 65 |
// libstdc++ in the future, if they are then this test and its |
| 66 |
// associated patch to fixincludes will have to be revisited. |
| 67 |
|
| 68 |
#include <cstdio> |
| 69 |
|
| 70 |
extern "C" { |
| 71 |
int fgetpos(FILE *, fpos64_t *); |
| 72 |
FILE *fopen(const char *, const char *); |
| 73 |
FILE *freopen(const char *, const char *, FILE *); |
| 74 |
int fseeko(FILE *, off64_t, int); |
| 75 |
int fsetpos(FILE *, const fpos64_t *); |
| 76 |
off64_t ftello(FILE *); |
| 77 |
} |
| 78 |
int main() { |
| 79 |
return 0; |
| 80 |
} |