OSDN Git Service

Make resetting of __need_typedef requests more robust.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Sun, 10 Apr 2016 21:54:10 +0000 (22:54 +0100)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Sun, 10 Apr 2016 21:54:10 +0000 (22:54 +0100)
mingwrt/ChangeLog
mingwrt/include/sys/types.h
mingwrt/include/time.h

index 2ed400f..6e28427 100644 (file)
@@ -1,5 +1,18 @@
 2016-04-10  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
+       Make resetting of __need_typedef requests more robust.
+
+       * include/sys/types.h [__need_off_t, __need___off64_t]
+       [__need_ssize_t, __need_time_t]: Move corresponding #undef out of, and
+       after the respective conditional blocks, which provide each associated
+       typedef, so ensuring that any repeat request is properly reset.
+       
+       * include/time.h [__need_time_t]: Always delegate to <sys/types.h> for
+       typedef, and reset of request, even in cases where...
+       [_TIME_H]: ...this is already defined.
+
+2016-04-10  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
        Add a missing comment terminator.
 
        * include/io.h [!(defined _IO_H && defined _WCHAR_H)]: Properly
index 82cb4f3..1dbf59d 100644 (file)
@@ -78,8 +78,8 @@
    */
 #  define __have_typedef_off_t
 # endif
-# undef __need_off_t
 #endif
+#undef __need_off_t
 
 #if ! defined __have_typedef___off64_t \
  && ( defined _SYS_TYPES_H || defined __need___off64_t )
    */
 #  define __have_typedef___off64_t
 # endif
-# undef __need___off64_t
 #endif
+#undef __need___off64_t
 
 #if ! defined __have_typedef_ssize_t \
  && ( defined _SYS_TYPES_H || defined __need_ssize_t )
    */
 #  define __have_typedef_ssize_t
 # endif
-# undef __need_ssize_t
 #endif
+#undef __need_ssize_t
 
 #if ! defined __have_typedef_time_t \
  && ( defined _SYS_TYPES_H || defined __need_time_t )
    */
 #  define __have_typedef_time_t  1
 # endif
-# undef __need_time_t
 #endif
+#undef __need_time_t
 
 #ifdef _SYS_TYPES_H
 /* This is normal <sys/types.h> inclusion, i.e. for its own sake.
index edefff4..aba0a13 100644 (file)
  * DEALINGS IN THE SOFTWARE.
  *
  */
-#ifndef _TIME_H
+#if ! defined _TIME_H || defined __need_time_t
 #pragma GCC system_header
 
+/* Irrespective of whether this is normal or selective inclusion of
+ * <time.h>, we ALWAYS require the definition for time_t; get it by
+ * selective inclusion from its primary source, in <sys/types.h>;
+ * note that we must ALWAYS delegate this, when __need_time_t is
+ * defined, even when _TIME_H had been defined previously, to ensure
+ * that __need_time_t is properly reset, and thus cannot compromise
+ * a later inclusion of <sys/types.h>
+ */
+#undef __need_time_h
+#define __need_time_t  1
+#include <sys/types.h>
+
+#ifndef _TIME_H
 /* To support selective partial inclusion, we do not immediately define
  * the normal _TIME_H guard macro; initially, we also clear all of those
  * declaraction subset selection macros which are applicable herein.
  */
-#undef __need_time_t
 #undef __need_struct_timespec
 #undef __need_wchar_decls
 
@@ -74,13 +86,6 @@ struct tm;
 #endif
 
 #ifndef RC_INVOKED
-/* Irrespective of whether this is normal or selective inclusion of
- * <time.h>, we ALWAYS require the definition for time_t; get it by
- * selective inclusion from its primary source, in <sys/types.h>
- */
-#define __need_time_t  1
-#include <sys/types.h>
-
 #if defined __need_struct_timespec && ! __struct_timespec_defined
 /* Structure timespec is mandated by POSIX, for specification of
  * intervals with the greatest precision supported by the OS kernel.
@@ -488,4 +493,5 @@ _END_C_DECLS
 #undef __need_wchar_decls
 
 #endif /* ! RC_INVOKED */
-#endif /* ! _TIME_H: $RCSfile$: end of file */
+#endif /* !_TIME_H after __need_time_t processing */
+#endif /* !_TIME_H: $RCSfile$: end of file */