When compiling with `NO_OLDNAMES`, `off_t` is a POSIX name and is not declared, which caused errors like
crt/stdio.h:586:35: error: unknown type name 'off_t'; did you mean '_off_t'?
586 | int __cdecl fseeko(FILE *_File, off_t _Offset, int _Origin)
| ^~~~~
| _off_t
A new type alias `__mingw_off_t` is now always declared for stdio.h. When
old names are wanted, `off_t` is defined as an alias for `__mingw_off_t`
instead.
Signed-off-by: LIU Hao <[email protected]>
---
mingw-w64-headers/crt/_mingw_off_t.h | 9 +++++----
mingw-w64-headers/crt/stdio.h | 4 ++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/mingw-w64-headers/crt/_mingw_off_t.h
b/mingw-w64-headers/crt/_mingw_off_t.h
index 3a3e5a2c0..715863062 100644
--- a/mingw-w64-headers/crt/_mingw_off_t.h
+++ b/mingw-w64-headers/crt/_mingw_off_t.h
@@ -19,13 +19,14 @@
#ifndef _FILE_OFFSET_BITS_SET_OFFT
#define _FILE_OFFSET_BITS_SET_OFFT
-#if !defined(NO_OLDNAMES) || defined(_POSIX)
#if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
-typedef off64_t off_t;
+typedef _off64_t __mingw_off_t;
#else
-typedef off32_t off_t;
-#endif /* #if !defined(NO_OLDNAMES) || defined(_POSIX) */
+typedef _off_t __mingw_off_t;
#endif /* (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */
+#if !defined(NO_OLDNAMES) || defined(_POSIX)
+typedef __mingw_off_t off_t;
+#endif
#endif /* _FILE_OFFSET_BITS_SET_OFFT */
diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index d8eedacaa..fd7e22746 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -583,13 +583,13 @@ int vsnprintf (char *__stream, size_t __n, const char
*__format, __builtin_va_li
_CRTIMP int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin);
_CRTIMP __int64 __cdecl _ftelli64(FILE *_File);
- int __cdecl fseeko(FILE *_File, off_t _Offset, int _Origin)
+ int __cdecl fseeko(FILE *_File, __mingw_off_t _Offset, int _Origin)
#if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
__MINGW_ASM_CALL(fseeko64)
#endif
;
_CRTIMP int __cdecl fseeko64(FILE *_File, _off64_t _Offset, int _Origin);
- off_t __cdecl ftello(FILE *_File)
+ __mingw_off_t __cdecl ftello(FILE *_File)
#if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
__MINGW_ASM_CALL(ftello64)
#endif
--
2.52.0
From 4423e8506e913c6154d01a7f1af7bdd5680fd8f2 Mon Sep 17 00:00:00 2001 From: LIU Hao <[email protected]> Date: Wed, 10 Dec 2025 20:05:38 +0800 Subject: [PATCH] headers/stdio: Declare `__mingw_off_t` and use it in place of `off_t` When compiling with `NO_OLDNAMES`, `off_t` is a POSIX name and is not declared, which caused errors like crt/stdio.h:586:35: error: unknown type name 'off_t'; did you mean '_off_t'? 586 | int __cdecl fseeko(FILE *_File, off_t _Offset, int _Origin) | ^~~~~ | _off_t A new type alias `__mingw_off_t` is now always declared for stdio.h. When old names are wanted, `off_t` is defined as an alias for `__mingw_off_t` instead. Signed-off-by: LIU Hao <[email protected]> --- mingw-w64-headers/crt/_mingw_off_t.h | 9 +++++---- mingw-w64-headers/crt/stdio.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mingw-w64-headers/crt/_mingw_off_t.h b/mingw-w64-headers/crt/_mingw_off_t.h index 3a3e5a2c0..715863062 100644 --- a/mingw-w64-headers/crt/_mingw_off_t.h +++ b/mingw-w64-headers/crt/_mingw_off_t.h @@ -19,13 +19,14 @@ #ifndef _FILE_OFFSET_BITS_SET_OFFT #define _FILE_OFFSET_BITS_SET_OFFT -#if !defined(NO_OLDNAMES) || defined(_POSIX) #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) -typedef off64_t off_t; +typedef _off64_t __mingw_off_t; #else -typedef off32_t off_t; -#endif /* #if !defined(NO_OLDNAMES) || defined(_POSIX) */ +typedef _off_t __mingw_off_t; #endif /* (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ +#if !defined(NO_OLDNAMES) || defined(_POSIX) +typedef __mingw_off_t off_t; +#endif #endif /* _FILE_OFFSET_BITS_SET_OFFT */ diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index d8eedacaa..fd7e22746 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -583,13 +583,13 @@ int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_li _CRTIMP int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin); _CRTIMP __int64 __cdecl _ftelli64(FILE *_File); - int __cdecl fseeko(FILE *_File, off_t _Offset, int _Origin) + int __cdecl fseeko(FILE *_File, __mingw_off_t _Offset, int _Origin) #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) __MINGW_ASM_CALL(fseeko64) #endif ; _CRTIMP int __cdecl fseeko64(FILE *_File, _off64_t _Offset, int _Origin); - off_t __cdecl ftello(FILE *_File) + __mingw_off_t __cdecl ftello(FILE *_File) #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) __MINGW_ASM_CALL(ftello64) #endif -- 2.52.0
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
