From 8f3e997526003e41ff5e38447785c4d4ebd66664 Mon Sep 17 00:00:00 2001 From: Keith Marshall Date: Thu, 13 Oct 2016 21:03:56 +0100 Subject: [PATCH] Resolve some non-ANSI typedef omissions. --- mingwrt/ChangeLog | 11 +++++++++++ mingwrt/include/io.h | 4 ++-- mingwrt/include/sys/types.h | 18 +++++++++++------- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog index 4d2c639..5739a02 100644 --- a/mingwrt/ChangeLog +++ b/mingwrt/ChangeLog @@ -1,3 +1,14 @@ +2016-10-13 Keith Marshall + + Resolve some non-ANSI typedef omissions. + + * include/sys/types.h (off_t, ssize_t): Always typedef them when... + [_POSIX_C_SOURCE || !_NO_OLDNAMES]: ...either of these prevails. + + * include/io.h (_fsize_t): Do not suppress its typedef when... + [__STRICT_ANSI__]: ...this compiler option applies, irrespective of... + [!(_IO_H && _WCHAR_H)]: ...this, which otherwise causes supression. + 2016-09-20 Keith Marshall Prepare and tag mingwrt-3.22.2 patch release. diff --git a/mingwrt/include/io.h b/mingwrt/include/io.h index 70c1044..505b674 100644 --- a/mingwrt/include/io.h +++ b/mingwrt/include/io.h @@ -96,10 +96,10 @@ /* We must define _fsize_t, but some compilers (including GCC prior to * version 4.0), may choke if we try to do so more than once... */ -#if ! (defined _IO_H && defined _WCHAR_H) +#if ! (defined _IO_H && defined _WCHAR_H) || defined __STRICT_ANSI__ /* ...so DO NOT define it during direct inclusion, (i.e. _IO_H * is defined), if has already caused it to be defined, (i.e. - * _WCHAR_H is ALSO defined). + * _WCHAR_H is ALSO defined, but __STRICT_ANSI__ is NOT). */ typedef unsigned long _fsize_t; #endif /* ! (_IO_H && _WCHAR_H) */ diff --git a/mingwrt/include/sys/types.h b/mingwrt/include/sys/types.h index 3a00343..7a5cf3d 100644 --- a/mingwrt/include/sys/types.h +++ b/mingwrt/include/sys/types.h @@ -66,15 +66,17 @@ */ typedef __off32_t _off_t; -# if _POSIX_C_SOURCE +# if _POSIX_C_SOURCE || ! defined _NO_OLDNAMES /* ...but note that this form should ALWAYS be preferred when - * compiling POSIX compatible source code. + * compiling POSIX compatible source code, and should also be + * made generally available unless Microsoft's old names have + * been suppressed, (by defining _NO_OLDNAMES). */ typedef _off_t off_t; # endif # if __GNUC__ < 4 /* Some compilers, including GCC prior to v4, may get upset - * if we try to specifiy these typedefs more than once. + * if we try to specify these typedefs more than once. */ # define __have_typedef_off_t # endif @@ -98,7 +100,7 @@ # if __GNUC__ < 4 /* Some compilers, including GCC prior to v4, may get upset - * if we try to specifiy these typedefs more than once. + * if we try to specify these typedefs more than once. */ # define __have_typedef___off64_t # endif @@ -112,15 +114,17 @@ */ typedef int _ssize_t; -# if _POSIX_C_SOURCE +# if _POSIX_C_SOURCE || ! defined _NO_OLDNAMES /* ...but note that this form should ALWAYS be preferred when - * compiling POSIX compatible source code. + * compiling POSIX compatible source code, and should also be + * made generally available unless Microsoft's old names have + * been suppressed, (by defining _NO_OLDNAMES). */ typedef _ssize_t ssize_t; # endif # if __GNUC__ < 4 /* Some compilers, including GCC prior to v4, may get upset - * if we try to specifiy these typedefs more than once. + * if we try to specify these typedefs more than once. */ # define __have_typedef_ssize_t # endif -- 2.11.0