[Mingw-users] stdio.h cannot be compiled with -std= compiler option

Back to archive index
Keith Marshall keith****@users*****
Sat Jan 12 05:55:31 JST 2019


On 11/01/19 09:03, Eli Zaretskii wrote:
> With the latest MinGW runtime 5.2, this one-line program:
> 
>   #include <stdio.h>
> 
> doesn't compile if GCC is invoked with a -std= option:
> 
>   D:\usr\eli\data>gcc -std=c9x -c stdio.c
>   In file included from stdio.c:1:0:
>   d:\usr\include\stdio.h:790:34: error: unknown type name '__off64_t'
>    typedef union { __int64 __value; __off64_t __offset; } fpos_t;
> 				    ^~~~~~~~~
> 
> AFAICT, this happens because stdio.h does this:
> 
>   #if !(defined __STRICT_ANSI__ || defined (__NO_MINGW_LFS)) \
>    && defined (__MSVCRT__)
>   # define __need___off64_t
>   #endif

So, for any -std= option which implies __STRICT_ANSI__, the request to
typedef __off64_t isn't specified, but it is now unconditionally
required by the somewhat more opaque typedef for ANSI standard type fpos_t.

Thanks.  The attached patch should fix this.

-- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stdio-bugfix.patch
Type: text/x-patch
Size: 2557 bytes
Desc: not available
URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20190111/cf40781f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20190111/cf40781f/attachment.sig>


More information about the MinGW-Users mailing list
Back to archive index