diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index 71342bebc..6d8b005b2 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -144,6 +144,11 @@ struct __sbuf { #define _REENT_SMALL_CHECK_INIT(ptr) /* nothing */ +/* Cygwin must use __sFILE64 for backward compatibility, even though + it's not defining __LARGE64_FILES anymore. To make sure that __sFILE + is never defined, disable it here explicitely. */ +#ifndef __CYGWIN__ + struct __sFILE { unsigned char *_p; /* current position in (some) buffer */ int _r; /* read space left for getc() */ @@ -195,13 +200,24 @@ struct __sFILE { int _flags2; /* for future use */ }; +#endif /* !__CYGWIN__ */ + #ifdef __CUSTOM_FILE_IO__ /* Get custom _FILE definition. */ #include #else /* !__CUSTOM_FILE_IO__ */ -#ifdef __LARGE64_FILES +/* Cygwin must use __sFILE64 for backward compatibility, even though + it's not defining __LARGE64_FILES anymore. It also has to make + sure the name is the same to satisfy C++ name mangling. Overloading + _fpos64_t just fixes a build problem. The _seek64 function is + actually never used without __LARGE64_FILES being defined. */ +#if defined (__LARGE64_FILES) || defined (__CYGWIN__) +#ifdef __CYGWIN__ +#define _fpos64_t _fpos_t +#endif + struct __sFILE64 { unsigned char *_p; /* current position in (some) buffer */ int _r; /* read space left for getc() */ diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h index c9c3565c6..2a7083278 100644 --- a/winsup/cygwin/include/cygwin/config.h +++ b/winsup/cygwin/include/cygwin/config.h @@ -49,12 +49,6 @@ extern inline struct _reent *__getreent (void) #define __FILENAME_MAX__ 4096 /* Keep in sync with PATH_MAX in limits.h. */ -/* Unfortunately we defined __LARGE64_FILES until Cygwin 3.3.6, so - FILE was based on `struct __sFILE64'. The name is exposed into - userspace and consequentially used in C++ name mangling. We must - redefine __sFILE as __sFILE64 to stay backward compatible. */ -#define __sFILE __sFILE64 - /* The following block of macros is required to build newlib correctly for Cygwin. Changing them in applications has no or not the desired effect. Just leave them alone. */