[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mingw-cvs
Subject:    MinGW-cvs Digest, Vol 81, Issue 2
From:       mingw-cvs-request () lists ! sourceforge ! net
Date:       2016-01-29 19:00:39
Message-ID: mailman.19174.1454094039.3397.mingw-cvs () lists ! sourceforge ! net
[Download RAW message or body]

Send MinGW-cvs mailing list submissions to
	mingw-cvs@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.sourceforge.net/lists/listinfo/mingw-cvs
or, via email, send a message with subject or body 'help' to
	mingw-cvs-request@lists.sourceforge.net

You can reach the person managing the list at
	mingw-cvs-owner@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of MinGW-cvs digest..."


This list will notify you of updates to the code stored in CVS.  Typically only \
developers with access to update the CVS are interested in this list.  However, this \
list can be beneficial to see what is happening with your changes.  If you wish to \
unsubscribe please do so at https://lists.sourceforge.net/lists/listinfo/mingw-cvs.

Today's Topics:

   1. [git push mingw-dist]Repository: mingw-dist branch,	master,
      updated. c827eb49a4f37c99bdb85e97a98aa7315b317217 (Keith Marshall)
   2. [git push mingw-org-wsl]Repository: mingw-org-wsl	branch,
      legacy, updated. 2f4e7fcf2bcc380300c17406694f2c28d50abdc7
      (Keith Marshall)
   3. [git push mingw-org-wsl]Repository: mingw-org-wsl	branch,
      legacy, updated. 1ffb1c758c694c1dae28780c7b54b8214e168740
      (Keith Marshall)


----------------------------------------------------------------------

Message: 1
Date: Wed, 20 Jan 2016 16:18:10 +0000
From: "Keith Marshall" <noreply@sourceforge.net>
Subject: [MinGW-cvs] [git push mingw-dist]Repository: mingw-dist
	branch,	master, updated. c827eb49a4f37c99bdb85e97a98aa7315b317217
To: mingw-cvs@lists.sourceforge.net
Message-ID:
	<mailman.19175.1454094039.3397.mingw-cvs@lists.sourceforge.net>

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-dist".

The branch, master has been updated
       via  c827eb49a4f37c99bdb85e97a98aa7315b317217 (commit)
      from  2bb4bc19ac31c656bf4fcc91ee501be3f2852311 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-dist/ci/c827eb49a4f37c99bdb85e97a98aa7315b317217/

commit c827eb49a4f37c99bdb85e97a98aa7315b317217
Author: Keith Marshall <keithmarshall@users.sourceforge.net>
Date:   Wed Jan 20 14:15:03 2016 +0000

    Upgrade mingwrt to version 3.21.1

diff --git a/ChangeLog b/ChangeLog
index 2b68f48..271072b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-01-20  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+	Upgrade mingwrt to version 3.21.1
+
+	* mingw32/mingw32-runtime.xml (mingwrt): Add new version references.
+	* common/issue.log mingw32/issue.log: Update accordingly.
+
 2016-01-08  Erwin Waterlander  <waterlan@xs4all.nl>
 
 	Upgraded package mingw32-ncurses to version 6.0-2.
diff --git a/common/issue.log b/common/issue.log
index 147ff7b..082e299 100644
--- a/common/issue.log
+++ b/common/issue.log
@@ -23,6 +23,6 @@
 # MinGW Project, accept liability for any damages, however caused,
 # arising from the use of this software.
 #
-  c6a9068e183254c0b930ac6e1a70fd81743dc212 2016010800 package-list.xml
+  c6a9068e183254c0b930ac6e1a70fd81743dc212 2016012000 package-list.xml
 #
 # $RCSfile$: end of file
diff --git a/mingw32/issue.log b/mingw32/issue.log
index 6d352aa..12cb343 100644
--- a/mingw32/issue.log
+++ b/mingw32/issue.log
@@ -50,11 +50,11 @@
   cd33ad74b608bce33ea297801253e6efbafce27c 2012073100 mingw32-mingw-utils.xml
   8d3a7125499a85916b53efb4c897ac907e2490ab 2015082000 mingw32-mpc.xml
   8a11de23e7a89fd11436bdf162ef90712f30101b 2013102300 mingw32-mpfr.xml
-  56f4032058328cacfabe64fa46706d72c2fa931e 2016010700 mingw32-package-list.xml
+  56f4032058328cacfabe64fa46706d72c2fa931e 2016012000 mingw32-package-list.xml
   1f15439ee5f66ec22321c7aa853559b6f8f7172f 2015090800 mingw32-pexports.xml
   cdb2a4dbedfc9f2cdfc92340f6f9b12da061c0d9 2012073100 mingw32-popt.xml
   0a5d210a13d073104fb74b4f9c081674c9745cd1 2013090900 mingw32-pthreads-w32.xml
-  68b3d00fc0dd2e7ae7ea22cbbc154a34c7618614 2014122800 mingw32-runtime.xml
+  eb06e2c5405277455a42d3cadc6184811ad38034 2016012000 mingw32-runtime.xml
   12acb32f80e49c893167cfae82e448dd766d49bb 2013070100 mingw32-wsl-candidate.xml
   247a02890f109a5fe4996fde4af9d576dca3cd1e 2012073100 mingw32-xz.xml
   c223ecd7389eb02948b54f8959d595cf608306a7 2013101200 mingw32-zlib.xml
diff --git a/mingw32/mingw32-runtime.xml b/mingw32/mingw32-runtime.xml
index 70dc46e..88e1161 100644
--- a/mingw32/mingw32-runtime.xml
+++ b/mingw32/mingw32-runtime.xml
@@ -30,6 +30,7 @@
       <component class="dev">
         <requires eq="mingwrt-%-mingw32-dll.tar" />
         <release tarname="mingwrt-3.21-mingw32-dev.tar.xz" />
+        <release tarname="mingwrt-3.21.1-mingw32-dev.tar.xz" />
         <release tarname="mingwrt-3.20-2-mingw32-dev.tar.lzma">
           <requires eq="mingwrt-%-mingw32-lic.tar" />
           <requires eq="mingwrt-%-mingw32-man.tar" />
@@ -50,6 +51,7 @@
 
       <component class="dll">
         <release tarname="mingwrt-3.21-mingw32-dll.tar.xz" />
+        <release tarname="mingwrt-3.21.1-mingw32-dll.tar.xz" />
         <release tarname="mingwrt-3.20-2-mingw32-dll.tar.lzma" />
         <release tarname="mingwrt-3.20-mingw32-dll.tar.gz" />
         <release tarname="mingwrt-3.19-mingw32-dll.tar.gz" />
@@ -58,6 +60,7 @@
 
       <component class="lic">
         <release tarname="mingwrt-3.21-mingw32-lic.tar.xz" />
+        <release tarname="mingwrt-3.21.1-mingw32-lic.tar.xz" />
         <release tarname="mingwrt-3.20-2-mingw32-lic.tar.lzma">
           <requires eq="mingwrt-%-mingw32-dev.tar" />
           <download tarname="none" />
@@ -78,6 +81,7 @@
 
       <component class="man">
         <release tarname="mingwrt-3.21-mingw32-man.tar.xz" />
+        <release tarname="mingwrt-3.21.1-mingw32-man.tar.xz" />
         <release tarname="mingwrt-3.20-2-mingw32-man.tar.lzma">
           <requires eq="mingwrt-%-mingw32-dev.tar" />
           <download tarname="none" />

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                   |    7 +++++++
 common/issue.log            |    2 +-
 mingw32/issue.log           |    4 ++--
 mingw32/mingw32-runtime.xml |    4 ++++
 4 files changed, 14 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Repository: mingw-dist



------------------------------

Message: 2
Date: Fri, 29 Jan 2016 09:45:34 +0000
From: "Keith Marshall" <noreply@sourceforge.net>
Subject: [MinGW-cvs] [git push mingw-org-wsl]Repository: mingw-org-wsl
	branch, legacy, updated. 2f4e7fcf2bcc380300c17406694f2c28d50abdc7
To: mingw-cvs@lists.sourceforge.net
Message-ID:
	<mailman.19176.1454094039.3397.mingw-cvs@lists.sourceforge.net>

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".

The branch, legacy has been updated
       via  2f4e7fcf2bcc380300c17406694f2c28d50abdc7 (commit)
      from  43446e97d80b003730ed434e57669909e651b2a8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-org-wsl/ci/2f4e7fcf2bcc380300c17406694f2c28d50abdc7/

commit 2f4e7fcf2bcc380300c17406694f2c28d50abdc7
Author: Keith Marshall <keithmarshall@users.sourceforge.net>
Date:   Fri Jan 29 09:37:52 2016 +0000

    Enable selective definition of POSIX system types.

diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index 88ae58a..34493d9 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,31 @@
+2016-01-29  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+	Enable selective definition of POSIX system types.
+
+	* include/sys/types.h (_SYS_TYPES_H): Do NOT define, if including with
+	any specific __need_TYPE selector having been set prior to inclusion;
+	DO define it when no such selector is present, and undefine all such
+	selectors as may have been set, after evaluation of their effects.
+	(_DEV_T_, _FPOS64_T_, _INO_T_, _MODE_T_, _OFF_T_, _OFF64_T_, _PID_T_)
+	(_SIGSET_T_, _SSIZE_T_): Unnecessary guard macros; delete them; this
+	accommodates reorganization of the file, to achieve a tidier layout.
+	(__have_typedef_off_t): New repeat definition guard; define it for
+	compilers which may choke on any repeated typedef for either of...
+	(off_t, _off_t): ...these; make them selectively defineable for...
+	[_SYS_TYPES_H && !__have_typedef_off_t]: ...non-selective inclusion...
+	[__need_off_t && !__have_typedef_off_t]: ...this specific selection;
+	in either case, redefine them in terms of...
+	(__off32_t): ...this new internal type, for consistency with...
+	(__off64_t): ...this previously defined non-standard type; also make
+	it selectively defineable, either by...
+	[_SYS_TYPES_H && !__have_typedef___off64_t]: ...non-selective, or...
+	[__need_off_t && !__have_typedef___off64_t]: ...selective inclusion.
+	(__have_typedef___off64_t): New repeat definition guard; define it.
+	(ssize_t, _ssize_t): Also make them selectively defineable, on...
+	[_SYS_TYPES_H && !__have_typedef_ssize_t]: ...non-selective, or...
+	[__need_off_t && !__have_typedef_ssize_t]: ...selective inclusion.
+	(__have_typedef_ssize_t): New repeat definition guard; define it.
+
 2015-12-30  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
 	Avoid user namespace pollution by non-standard type 'off64_t'.
diff --git a/mingwrt/include/sys/types.h b/mingwrt/include/sys/types.h
index 007b6b4..1d60619 100644
--- a/mingwrt/include/sys/types.h
+++ b/mingwrt/include/sys/types.h
@@ -6,7 +6,7 @@
  * $Id$
  *
  * Written by Rob Savoye <rob@cygnus.com>
- * Copyright (C) 1997-1999, 2001, 2003, 2004, 2008, 2011, 2014-2015,
+ * Copyright (C) 1997-1999, 2001, 2003, 2004, 2008, 2011, 2014-2016,
  *   MinGW.org Project.
  *
  *
@@ -31,105 +31,153 @@
  *
  */
 #ifndef _SYS_TYPES_H
-#define _SYS_TYPES_H
 #pragma GCC system_header
 
-/* All the headers include this file. */
+/* All the headers include this file.
+ */
 #include <_mingw.h>
 
+/* Duplicates of some type definitions from here are also to be
+ * provided by other system headers; use __need_TYPENAME selector
+ * macros to make them selectively visible...
+ */
+#if ! defined __need_off_t && ! defined __need___off64_t \
+ && ! defined __need_ssize_t
+ /*
+  * ...and define the multiple inclusion guard macro for this
+  * header, ONLY IF no such selector macro is defined.
+  */
+#define _SYS_TYPES_H
+#endif
+
 #ifndef RC_INVOKED
+/* First handle those typedefs which POSIX requires us to be able
+ * to expose selectively, via other system headers.
+ */
+#if ! defined __have_typedef_off_t \
+ && ( defined _SYS_TYPES_H || defined __need_off_t )
+ /*
+  * We base this on an implementation specific private typedef,
+  * analogous to our __off64_t (defined below)...
+  */
+  typedef __int32  __off32_t;
+
+ /* The POSIX off_t typedef is uglified, by Microsoft, as _off_t;
+  * ensure that we provide support for the Microsoft form...
+  */
+  typedef __off32_t  _off_t;
+
+# if _POSIX_C_SOURCE
+  /* ...but note that this form should ALWAYS be preferred when
+   * compiling POSIX compatible source code.
+   */
+  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.
+   */
+#  define __have_typedef_off_t
+# endif
+# undef __need_off_t
+#endif
+
+#if ! defined __have_typedef___off64_t \
+ && ( defined _SYS_TYPES_H || defined __need___off64_t )
+ /*
+  * This is neither an ISO-C standard type, nor even a POSIX
+  * standard type; keep it runtime implementation specific.
+  */
+  typedef __int64  __off64_t;
+
+# if __GNUC__ < 4
+  /* Some compilers, including GCC prior to v4, may get upset
+   * if we try to specifiy these typedefs more than once.
+   */
+#  define __have_typedef___off64_t
+# endif
+# undef __need___off64_t
+#endif
+
+#if ! defined __have_typedef_ssize_t \
+ && ( defined _SYS_TYPES_H || defined __need_ssize_t )
+ /*
+  * POSIX ssize_t typedef, uglified by Microsoft as _ssize_t; ensure
+  * that we support the Microsoft form...
+  */
+  typedef int  _ssize_t;
+
+# if _POSIX_C_SOURCE
+  /* ...but note that this form should ALWAYS be preferred when
+   * compiling POSIX compatible source code.
+   */
+  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.
+   */
+#  define __have_typedef_ssize_t
+# endif
+# undef __need_ssize_t
+#endif
 
+#ifdef _SYS_TYPES_H
+/* This is normal <sys/types.h> inclusion, i.e. for its own sake.
+ *
+ * A small subset of the required type definitions are actually
+ * furnished by <stddef.h>; get them by selective inclusion...
+ */
 #define __need_size_t
 #define __need_ptrdiff_t
 #define __need_wchar_t
 #include <stddef.h>
 
+/* Similarly, from this <time.h> subsidiary component...
+ */
 #define __need_time_t
 #define _FAKE_TIME_H_SOURCED 1
 #include <parts/time.h>
 
-
-#ifndef	_OFF_T_
-#define	_OFF_T_
-typedef long _off_t;
-
-#ifndef	_NO_OLDNAMES
-typedef _off_t	off_t;
-#endif
-#endif	/* Not _OFF_T_ */
-
-
-#ifndef _DEV_T_
-#define	_DEV_T_
+/* Today, Microsoft generally prefers to prefix POSIX type names
+ * with an ugly initial underscore; ensure that we provide support
+ * for this ungainly practice.
+ */
 #ifdef __MSVCRT__
-typedef unsigned int _dev_t;
-#else
-typedef short _dev_t;
-#endif
+ /* Additionally, note that _dev_t is a special case, requiring
+  * this definition when linking with MSVCRT.DLL...
+  */
+typedef unsigned int	_dev_t;
 
-#ifndef	_NO_OLDNAMES
-typedef _dev_t	dev_t;
-#endif
-#endif	/* Not _DEV_T_ */
-
-
-#ifndef _INO_T_
-#define	_INO_T_
-typedef short _ino_t;
-
-#ifndef	_NO_OLDNAMES
-typedef _ino_t	ino_t;
-#endif
-#endif	/* Not _INO_T_ */
-
-
-#ifndef _PID_T_
-#define	_PID_T_
-typedef int	_pid_t;
-
-#ifndef	_NO_OLDNAMES
-typedef _pid_t	pid_t;
-#endif
-#endif	/* Not _PID_T_ */
-
-
-#ifndef _MODE_T_
-#define	_MODE_T_
-typedef unsigned short _mode_t;
-
-#ifndef	_NO_OLDNAMES
-typedef _mode_t	mode_t;
-#endif
-#endif	/* Not _MODE_T_ */
-
-
-#ifndef _SIGSET_T_
-#define	_SIGSET_T_
-typedef int	_sigset_t;
-
-#ifndef	_NO_OLDNAMES
-typedef _sigset_t	sigset_t;
-#endif
-#endif	/* Not _SIGSET_T_ */
-
-#ifndef _SSIZE_T_
-#define _SSIZE_T_
-typedef int _ssize_t;
+#else
+ /* ...but this alternative, when linking with CRTDLL.DLL
+  */
+typedef short		_dev_t;
 
-#ifndef	_NO_OLDNAMES
-typedef _ssize_t ssize_t;
 #endif
-#endif /* Not _SSIZE_T_ */
-
-#ifndef _FPOS64_T_
-#define _FPOS64_T_
-typedef long long fpos64_t;
+ /* ...while the remaining type names have consistent definitions,
+  * regardless of any particular DLL association.
+  */
+typedef short		_ino_t;
+typedef unsigned short	_mode_t;
+typedef int		_pid_t;
+typedef int		_sigset_t;
+
+/* Users who value portability should prefer...
+ */
+#if _POSIX_C_SOURCE || ! defined _NO_OLDNAMES
+ /* ...the standard POSIX type names, (which are consistent with
+  * earlier Microsoft naming practice, and are also historically
+  * exposed by MinGW, except when _NO_OLDNAMES is defined).
+  */
+typedef _dev_t		 dev_t;
+typedef _ino_t		 ino_t;
+typedef _mode_t 	 mode_t;
+typedef _pid_t		 pid_t;
+typedef _sigset_t	 sigset_t;
 #endif
 
-#ifndef _OFF64_T_
-#define _OFF64_T_
-typedef __int64 __off64_t;
-#endif
+typedef __int64 	 fpos64_t;
 
 #if _POSIX_C_SOURCE
 /* useconds_t is an obsolete POSIX data type; we continue to define
@@ -138,6 +186,7 @@ typedef __int64 __off64_t;
  */
 typedef unsigned long useconds_t __MINGW_ATTRIB_DEPRECATED;
 #endif
+#endif  /* _SYS_TYPES_H normal inclusion */
 
 #endif	/* ! RC_INVOKED */
-#endif	/* ! _SYS_TYPES_H: $RCSfile$: end of file */
+#endif	/* !_SYS_TYPES_H: $RCSfile$: end of file */

-----------------------------------------------------------------------

Summary of changes:
 mingwrt/ChangeLog           |   28 ++++++
 mingwrt/include/sys/types.h |  209 ++++++++++++++++++++++++++----------------
 2 files changed, 157 insertions(+), 80 deletions(-)


hooks/post-receive
-- 
Repository: mingw-org-wsl



------------------------------

Message: 3
Date: Fri, 29 Jan 2016 19:00:36 +0000
From: "Keith Marshall" <noreply@sourceforge.net>
Subject: [MinGW-cvs] [git push mingw-org-wsl]Repository: mingw-org-wsl
	branch, legacy, updated. 1ffb1c758c694c1dae28780c7b54b8214e168740
To: mingw-cvs@lists.sourceforge.net
Message-ID:
	<mailman.19177.1454094039.3397.mingw-cvs@lists.sourceforge.net>

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".

The branch, legacy has been updated
       via  1ffb1c758c694c1dae28780c7b54b8214e168740 (commit)
      from  2f4e7fcf2bcc380300c17406694f2c28d50abdc7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-org-wsl/ci/1ffb1c758c694c1dae28780c7b54b8214e168740/

commit 1ffb1c758c694c1dae28780c7b54b8214e168740
Author: Keith Marshall <keithmarshall@users.sourceforge.net>
Date:   Fri Jan 29 17:39:38 2016 +0000

    Refactor <stdio.h> vs. <wchar.h> to avoid duplication.

diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index 34493d9..d596292 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,5 +1,37 @@
 2016-01-29  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
+	Refactor <stdio.h> vs. <wchar.h> to avoid duplication.
+
+	* include/wchar.h: Some minor layout adjustments.
+	(__WCHAR_H_SOURCED__): New macro; define it temporarily, only while
+	within the scope of reading <wchar.h>; undefine it at end of file.
+	(struct tm): Do not define; it is sufficient to keep it opaque.
+	(FILE, FILENAME_MAX, NULL, __VALIST, off_t, __off64_t, size_t)
+	(ssize_t, va_list, wchar_t, wint_t): Do not require or define them
+	directly; delegate to indirect definition by including <stdio.h>.
+	(fgetwc, fputwc, fgetws, fputws, fwprintf, fwscanf, getwc, getwchar)
+	(_getws, putwc, putwchar, _putws, snwprintf, _snwprintf, swprintf)
+	(swscanf, ungetwc, vfwprintf, vfwscanf, _vscwprintf, vsnwprintf)
+	(_vsnwprintf, vswprintf, vwprintf, vswscanf, vwscanf, _wfdopen)
+	(_wfopen, _wfreopen, _wfsopen, _wperror, _wpopen, wprintf, _wrename)
+	(_wremove, wscanf, _wtmpnam, _wtempnam): Omit prototypes; acquire them
+	indirectly, by selective inclusion from <stdio.h>; hence include it.
+
+	* include/stdio.h: Assert copyright; tidy layout.
+	[__WCHAR_H_SOURCED__]: Selectively define and declare only those
+	entities which are required by <wchar.h>; do not define...
+	[__WCHAR_H_SOURCED__] (_STDIO_H): ...this; define it only if...
+	[!__WCHAR_H_SOURCED__]: ...this; define and declare ALL entities which
+	are normally specified within <stdio.h>, INCLUDING those specifically
+	itemised above, as selectively required by <wchar.h>.
+
+	* pseudo-reloc.c: Some minor layout adjustments.
+	(WIN32_LEAN_AND_MEAN): Define it; we don't need the windows baggage.
+	[typedef ptrdiff_t]: Do not assume this is gratuitously defined;
+	include <stdint.h> to guarantee it.
+
+2016-01-29  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
 	Enable selective definition of POSIX system types.
 
 	* include/sys/types.h (_SYS_TYPES_H): Do NOT define, if including with
diff --git a/mingwrt/include/stdio.h b/mingwrt/include/stdio.h
index 2fc3c47..3a86a87 100644
--- a/mingwrt/include/stdio.h
+++ b/mingwrt/include/stdio.h
@@ -1,71 +1,153 @@
 /*
  * stdio.h
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
  *
- * Definitions of types and prototypes of functions for standard input and
- * output.
+ * Definitions of types and prototypes of functions for operations on
+ * standard input and standard output streams.
+ *
+ * $Id$
+ *
+ * Written by Rob Savoye <rob@cygnus.com>
+ * Copyright (C) 1997-2005, 2007-2010, 2014-2016, MinGW.org Project.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice, this permission notice, and the following
+ * disclaimer shall be included in all copies or substantial portions of
+ * the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
+ * DEALINGS IN THE SOFTWARE.
  *
  * NOTE: The file manipulation functions provided by Microsoft seem to
- * work with either slash (/) or backslash (\) as the directory separator.
+ * work with either slash (/) or backslash (\) as the directory separator;
+ * (this is consistent with Microsoft's own documentation, on MSDN).
  *
- * TODO: File requires review; rationalization and refactoring recommended.
  */
+#ifndef _STDIO_H
+#pragma GCC system_header
+
+/* When including <wchar.h>, some of the definitions and declarations
+ * which are nominally provided in <stdio.h> must be duplicated.  Rather
+ * than require duplicated maintenance effort, we provide for partial
+ * inclusion of <stdio.h> by <wchar.h>; only when not included in
+ * this partial fashion...
+ */
+#ifndef __WCHAR_H_SOURCED__
+ /*
+  * ...which is exclusive to <wchar.h>, do we assert the multiple
+  * inclusion guard for <stdio.h> itself.
+  */
+#define _STDIO_H
+#endif
 
-#ifndef _STDIO_H_
-#define	_STDIO_H_
-
-/* All the headers include this file. */
+/* All the headers include this file.
+ */
 #include <_mingw.h>
 
 #ifndef RC_INVOKED
-#define __need_size_t
+/* POSIX stipulates that the following set of types, (as identified by
+ * __need_TYPENAME macros), shall be defined consistently with <stddef.h>;
+ * by defining the appropriate __need_TYPENAME macros, we may selectively
+ * obtain the required definitions by inclusion of <stddef.h>, WITHOUT
+ * automatic exposure of any of its additional content.
+ */
 #define __need_NULL
+#define __need_size_t
 #define __need_wchar_t
-#define	__need_wint_t
+#define __need_wint_t
 #include <stddef.h>
-#define __need___va_list
-#include <stdarg.h>
-#endif	/* Not RC_INVOKED */
 
+#if _POSIX_C_SOURCE >= 200809L
+ /* Similarly, for types defined in <sys/types.h>, (which are explicitly
+  * dependent on the POSIX.1-2008 feature test)...
+  */
+# define __need_off_t
+# define __need_ssize_t
+#endif
+#if !(defined __STRICT_ANSI__ || defined (__NO_MINGW_LFS)) \
+ && defined (__MSVCRT__)
+ /* ...while this is required to support our fseeko64() and ftello64()
+  * implementations, (neither of which is in any way standardized)...
+  */
+# define __need___off64_t
+#endif
+/* It is sufficient to test for just one define from each of the two
+ * preceding groups...
+ */
+#if defined __need_off_t || defined __need___off64_t
+ /* ...to identify a requirement for selective inclusion from...
+  */
+# include <sys/types.h>
+#endif
 
-/* Flags for the iobuf structure  */
-#define	_IOREAD	1 /* currently reading */
-#define	_IOWRT	2 /* currently writing */
-#define	_IORW	0x0080 /* opened as "r+w" */
+#ifndef __VALIST
+ /* Also similarly, for the va_list type, defined in <stdarg.h>
+  */
+# if defined __GNUC__ && __GNUC__ >= 3
+#  define __need___va_list
+#  include <stdarg.h>
+#  define __VALIST __builtin_va_list
+# else
+#  define __VALIST char *
+# endif
+#endif
+#endif	/* ! RC_INVOKED */
 
+#ifdef _STDIO_H
+/* Flags for the iobuf structure
+ */
+#define _IOREAD 	1	/* currently reading */
+#define _IOWRT		2	/* currently writing */
+#define _IORW	   0x0080	/* opened as "r+w" */
 
-/*
- * The three standard file pointers provided by the run time library.
+/* The three standard file pointers provided by the run time library.
  * NOTE: These will go to the bit-bucket silently in GUI applications!
  */
-#define	STDIN_FILENO	0
-#define	STDOUT_FILENO	1
-#define	STDERR_FILENO	2
+#define STDIN_FILENO	0
+#define STDOUT_FILENO	1
+#define STDERR_FILENO	2
 
-/* Returned by various functions on end of file condition or error. */
-#define	EOF	(-1)
+/* Returned by various functions on end of file condition or error.
+ */
+#define EOF	      (-1)
 
-/*
- * The maximum length of a file name. You should use GetVolumeInformation
- * instead of this constant. But hey, this works.
- * Also defined in io.h.
+#endif	/* _STDIO_H */
+
+/* The maximum length of a file name.  It may be better to use the Windows'
+ * GetVolumeInformation() function in preference to this constant, but hey,
+ * this works!  Note that <io.h> also defines it, but we don't guard it, so
+ * that the compiler has a chance to catch inconsistencies.
+ *
+ * FIXME: Right now, we define this unconditionally for both full <stdio.h>
+ * inclusion, and for partial inclusion on behalf of <wchar.h>, (which needs
+ * it for some non-ANSI structure declarations).  The conditions under which
+ * <wchar.h> needs this require review, because defining it as a consequence
+ * of including <wchar.h> alone may violate strict ANSI conformity.
  */
-#ifndef FILENAME_MAX
-#define	FILENAME_MAX	(260)
-#endif
+#define FILENAME_MAX  (260)
 
-/*
- * The maximum number of files that may be open at once. I have set this to
+#ifdef _STDIO_H
+/* The maximum number of files that may be open at once. I have set this to
  * a conservative number. The actual value may be higher.
  */
-#define FOPEN_MAX	(20)
+#define FOPEN_MAX      (20)
 
-/* After creating this many names, tmpnam and tmpfile return NULL */
-#define TMP_MAX	32767
-/*
- * Tmpnam, tmpfile and, sometimes, _tempnam try to create
+/* After creating this many names, tmpnam and tmpfile return NULL
+ */
+#define TMP_MAX      32767
+
+/* Tmpnam, tmpfile and, sometimes, _tempnam try to create
  * temp files in the root directory of the current drive
  * (not in pwd, as suggested by some older MS doc's).
  * Redefining these macros does not effect the CRT functions.
@@ -76,80 +158,75 @@
 #endif
 #define _wP_tmpdir  L"\\"
 
-/*
- * The maximum size of name (including NUL) that will be put in the user
+/* The maximum size of name (including NUL) that will be put in the user
  * supplied buffer caName for tmpnam.
  * Inferred from the size of the static buffer returned by tmpnam
  * when passed a NULL argument. May actually be smaller.
  */
 #define L_tmpnam (16)
 
-#define _IOFBF    0x0000  /* full buffered */
-#define _IOLBF    0x0040  /* line buffered */
-#define _IONBF    0x0004  /* not buffered */
+#define _IOFBF		0x0000	/* full buffered */
+#define _IOLBF		0x0040	/* line buffered */
+#define _IONBF		0x0004	/* not buffered */
 
-#define _IOMYBUF  0x0008  /* stdio malloc()'d buffer */
-#define _IOEOF    0x0010  /* EOF reached on read */
-#define _IOERR    0x0020  /* I/O error from system */
-#define _IOSTRG   0x0040  /* Strange or no file descriptor */
+#define _IOMYBUF	0x0008	/* stdio malloc()'d buffer */
+#define _IOEOF		0x0010	/* EOF reached on read */
+#define _IOERR		0x0020	/* I/O error from system */
+#define _IOSTRG 	0x0040	/* Strange or no file descriptor */
 #ifdef _POSIX_SOURCE
-# define _IOAPPEND 0x0200
+# define _IOAPPEND	0x0200
 #endif
-/*
- * The buffer size as used by setbuf such that it is equivalent to
+
+/* The buffer size as used by setbuf such that it is equivalent to
  * (void) setvbuf(fileSetBuffer, caBuffer, _IOFBF, BUFSIZ).
  */
-#define	BUFSIZ	512
+#define BUFSIZ		   512
 
 /* Constants for nOrigin indicating the position relative to which fseek
  * sets the file position.  Defined unconditionally since ISO and POSIX
  * say they are defined here.
  */
-#define SEEK_SET  0
-#define SEEK_CUR  1
-#define SEEK_END  2
-
-#ifndef	RC_INVOKED
+#define SEEK_SET	     0
+#define SEEK_CUR	     1
+#define SEEK_END	     2
 
-#ifndef __VALIST
-#ifdef __GNUC__
-#define __VALIST __gnuc_va_list
-#else
-#define __VALIST char*
-#endif
-#endif /* defined __VALIST  */
+#endif	/* _STDIO_H */
 
-/*
- * The structure underlying the FILE type.
+#ifndef RC_INVOKED
+#if ! (defined _STDIO_H && defined _WCHAR_H)
+/* The structure underlying the FILE type; this should be defined when
+ * including either <stdio.h> or <wchar.h>.  If both header include guards
+ * are now in place, then we must currently be including <stdio.h> in its
+ * own right, having already processed this block during a prior partial
+ * inclusion by <wchar.h>; there is no need to process it a second time.
  *
  * Some believe that nobody in their right mind should make use of the
  * internals of this structure. Provided by Pedro A. Aranda Gutiirrez
  * <paag@tid.es>.
  */
-#ifndef _FILE_DEFINED
-#define	_FILE_DEFINED
 typedef struct _iobuf
 {
-	char*	_ptr;
-	int	_cnt;
-	char*	_base;
-	int	_flag;
-	int	_file;
-	int	_charbuf;
-	int	_bufsiz;
-	char*	_tmpfname;
+  char	*_ptr;
+  int	 _cnt;
+  char	*_base;
+  int	 _flag;
+  int	 _file;
+  int	 _charbuf;
+  int	 _bufsiz;
+  char	*_tmpfname;
 } FILE;
-#endif	/* Not _FILE_DEFINED */
 
+#endif  /* ! (_STDIO_H && _WCHAR_H) */
 
-/*
- * The standard file handles
+#ifdef _STDIO_H
+
+/* The standard file handles
  */
 #ifndef __DECLSPEC_SUPPORTED
 
 extern FILE (*_imp___iob)[];	/* A pointer to an array of FILE */
 
-#define _iob	(*_imp___iob)	/* An array of FILE */
+#define _iob (*_imp___iob)	/* An array of FILE */
 
 #else /* __DECLSPEC_SUPPORTED */
 
@@ -163,33 +240,37 @@ __MINGW_IMPORT FILE _iob[];	/* An array of FILE imported from \
DLL. */  
 _BEGIN_C_DECLS
 
-/*
- * File Operations
- */
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	fopen (const char*, const char*);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	freopen (const char*, const char*, FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fflush (FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fclose (FILE*);
-/* MS puts remove & rename (but not wide versions) in io.h  also */
-_CRTIMP int __cdecl __MINGW_NOTHROW	remove (const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	rename (const char*, const char*);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	tmpfile (void);
-_CRTIMP char* __cdecl __MINGW_NOTHROW	tmpnam (char*);
+/* File Operations
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE * fopen (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE * freopen (const char *, const char *, FILE \
*); +_CRTIMP __cdecl __MINGW_NOTHROW  int    fflush (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    fclose (FILE *);
+
+/* Note: Microsoft also declares remove & rename (but not their wide char
+ * variants) in <io.h>; since duplicate prototypes are acceptable, provided
+ * they are consistent, we simply declare them here anyway, while allowing
+ * the compiler to check consistency as appropriate.
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW  int    remove (const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    rename (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE * tmpfile (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  char * tmpnam (char *);
 
 #ifndef __STRICT_ANSI__
-_CRTIMP char* __cdecl __MINGW_NOTHROW	_tempnam (const char*, const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_rmtmp(void);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_unlink (const char*);
-
-#ifndef	NO_OLDNAMES
-_CRTIMP char* __cdecl __MINGW_NOTHROW	tempnam (const char*, const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	rmtmp(void);
-_CRTIMP int __cdecl __MINGW_NOTHROW	unlink (const char*);
+_CRTIMP __cdecl __MINGW_NOTHROW  char *_tempnam (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int   _rmtmp (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  int   _unlink (const char *);
+
+#ifndef NO_OLDNAMES
+_CRTIMP __cdecl __MINGW_NOTHROW  char * tempnam (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    rmtmp (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    unlink (const char *);
 #endif
 #endif /* __STRICT_ANSI__ */
 
-_CRTIMP int __cdecl __MINGW_NOTHROW	setvbuf (FILE*, char*, int, size_t);
-_CRTIMP void __cdecl __MINGW_NOTHROW	setbuf (FILE*, char*);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    setvbuf (FILE *, char *, int, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW  void   setbuf (FILE *, char *);
 
 /* Formatted Output
  *
@@ -236,20 +317,17 @@ extern int __mingw_stdio_redirect__(vsnprintf)(char*, size_t, \
const char*, __VAL  extern unsigned int _mingw_output_format_control( unsigned int, \
unsigned int );  
 #if __USE_MINGW_ANSI_STDIO
-/*
- * User has expressed a preference for C99 conformance...
+/* User has expressed a preference for C99 conformance...
  */
 # undef __mingw_stdio_redirect__
 # ifdef __cplusplus
-/*
- * For C++ we use inline implementations, to avoid interference
+/* For C++ we use inline implementations, to avoid interference
  * with namespace qualification, which may result from using #defines.
  */
 #  define __mingw_stdio_redirect__  inline __cdecl __MINGW_NOTHROW
 
 # elif defined __GNUC__
-/*
- * FIXME: Is there any GCC version prerequisite here?
+/* FIXME: Is there any GCC version prerequisite here?
  *
  * We also prefer inline implementations for C, when we can be confident
  * that the GNU specific __inline__ mechanism is supported.
@@ -257,8 +335,7 @@ extern unsigned int _mingw_output_format_control( unsigned int, \
unsigned int );  #  define __mingw_stdio_redirect__  static __inline__ __cdecl \
__MINGW_NOTHROW  
 # else
-/*
- * Can't use inlines; fall back on module local static stubs.
+/* Can't use inlines; fall back on module local static stubs.
  */
 #  define __mingw_stdio_redirect__  static __cdecl __MINGW_NOTHROW
 # endif
@@ -312,38 +389,36 @@ int vsprintf (char *__stream, const char *__format, __VALIST \
__local_argv)  }
 
 #else
-/*
- * Default configuration: simply direct all calls to MSVCRT...
+/* Default configuration: simply direct all calls to MSVCRT...
  */
-_CRTIMP int __cdecl __MINGW_NOTHROW fprintf (FILE*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW printf (const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW sprintf (char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW vfprintf (FILE*, const char*, __VALIST);
-_CRTIMP int __cdecl __MINGW_NOTHROW vprintf (const char*, __VALIST);
-_CRTIMP int __cdecl __MINGW_NOTHROW vsprintf (char*, const char*, __VALIST);
+_CRTIMP __cdecl __MINGW_NOTHROW  int fprintf (FILE *, const char *, ...);
+_CRTIMP __cdecl __MINGW_NOTHROW  int printf (const char *, ...);
+_CRTIMP __cdecl __MINGW_NOTHROW  int sprintf (char *, const char *, ...);
+_CRTIMP __cdecl __MINGW_NOTHROW  int vfprintf (FILE *, const char *, __VALIST);
+_CRTIMP __cdecl __MINGW_NOTHROW  int vprintf (const char *, __VALIST);
+_CRTIMP __cdecl __MINGW_NOTHROW  int vsprintf (char *, const char *, __VALIST);
 
 #endif
-/*
- * Regardless of user preference, always offer these alternative
+/* Regardless of user preference, always offer these alternative
  * entry points, for direct access to the MSVCRT implementations.
  */
 #undef  __mingw_stdio_redirect__
 #define __mingw_stdio_redirect__(F) __cdecl __MINGW_NOTHROW __msvcrt_##F
 
-_CRTIMP int __mingw_stdio_redirect__(fprintf)(FILE*, const char*, ...);
-_CRTIMP int __mingw_stdio_redirect__(printf)(const char*, ...);
-_CRTIMP int __mingw_stdio_redirect__(sprintf)(char*, const char*, ...);
-_CRTIMP int __mingw_stdio_redirect__(vfprintf)(FILE*, const char*, __VALIST);
-_CRTIMP int __mingw_stdio_redirect__(vprintf)(const char*, __VALIST);
-_CRTIMP int __mingw_stdio_redirect__(vsprintf)(char*, const char*, __VALIST);
+_CRTIMP int __mingw_stdio_redirect__(fprintf)(FILE *, const char *, ...);
+_CRTIMP int __mingw_stdio_redirect__(printf)(const char *, ...);
+_CRTIMP int __mingw_stdio_redirect__(sprintf)(char *, const char *, ...);
+_CRTIMP int __mingw_stdio_redirect__(vfprintf)(FILE *, const char *, __VALIST);
+_CRTIMP int __mingw_stdio_redirect__(vprintf)(const char *, __VALIST);
+_CRTIMP int __mingw_stdio_redirect__(vsprintf)(char *, const char *, __VALIST);
 
 #undef  __mingw_stdio_redirect__
 
 /* The following three ALWAYS refer to the MSVCRT implementations...
  */
-_CRTIMP int __cdecl __MINGW_NOTHROW _snprintf (char*, size_t, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW _vsnprintf (char*, size_t, const char*, \
                __VALIST);
-_CRTIMP int __cdecl __MINGW_NOTHROW _vscprintf (const char*, __VALIST);
+_CRTIMP __cdecl __MINGW_NOTHROW  int _snprintf (char *, size_t, const char *, ...);
+_CRTIMP __cdecl __MINGW_NOTHROW  int _vsnprintf (char *, size_t, const char *, \
__VALIST); +_CRTIMP __cdecl __MINGW_NOTHROW  int _vscprintf (const char *, __VALIST);
 
 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
 /*
@@ -353,69 +428,67 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _vscprintf (const char*, \
                __VALIST);
  * compatible with C99, but the following are; if you want the MSVCRT
  * behaviour, you *must* use the Microsoft uglified names.
  */
-int __cdecl __MINGW_NOTHROW snprintf (char *, size_t, const char *, ...);
-int __cdecl __MINGW_NOTHROW vsnprintf (char *, size_t, const char *, __VALIST);
+__cdecl __MINGW_NOTHROW  int snprintf (char *, size_t, const char *, ...);
+__cdecl __MINGW_NOTHROW  int vsnprintf (char *, size_t, const char *, __VALIST);
 
-int __cdecl __MINGW_NOTHROW vscanf (const char * __restrict__, __VALIST);
-int __cdecl __MINGW_NOTHROW vfscanf (FILE * __restrict__, const char * __restrict__,
-		     __VALIST);
-int __cdecl __MINGW_NOTHROW vsscanf (const char * __restrict__,
-		     const char * __restrict__, __VALIST);
+__cdecl __MINGW_NOTHROW  int vscanf (const char * __restrict__, __VALIST);
+__cdecl __MINGW_NOTHROW
+int vfscanf (FILE * __restrict__, const char * __restrict__, __VALIST);
+__cdecl __MINGW_NOTHROW
+int vsscanf (const char * __restrict__, const char * __restrict__, __VALIST);
 
 #endif  /* !__NO_ISOCEXT */
 
-/*
- * Formatted Input
+/* Formatted Input
  */
+_CRTIMP __cdecl __MINGW_NOTHROW  int    fscanf (FILE *, const char *, ...);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    scanf (const char *, ...);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    sscanf (const char *, const char *, ...);
 
-_CRTIMP int __cdecl __MINGW_NOTHROW	fscanf (FILE*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	scanf (const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	sscanf (const char*, const char*, ...);
-/*
- * Character Input and Output Functions
+/* Character Input and Output Functions
  */
-
-_CRTIMP int __cdecl __MINGW_NOTHROW	fgetc (FILE*);
-_CRTIMP char* __cdecl __MINGW_NOTHROW	fgets (char*, int, FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fputc (int, FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fputs (const char*, FILE*);
-_CRTIMP char* __cdecl __MINGW_NOTHROW	gets (char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	puts (const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	ungetc (int, FILE*);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    fgetc (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  char * fgets (char *, int, FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    fputc (int, FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    fputs (const char *, FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  char * gets (char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    puts (const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    ungetc (int, FILE *);
 
 /* Traditionally, getc and putc are defined as macros. but the
-   standard doesn't say that they must be macros.
-   We use inline functions here to allow the fast versions
-   to be used in C++ with namespace qualification, eg., ::getc.
-
-   _filbuf and _flsbuf  are not thread-safe. */
-_CRTIMP int __cdecl __MINGW_NOTHROW	_filbuf (FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_flsbuf (int, FILE*);
+ * standard doesn't say that they must be macros.  We use inline
+ * functions here to allow the fast versions to be used in C++
+ * with namespace qualification, eg., ::getc.
+ *
+ * NOTE: _filbuf and _flsbuf  are not thread-safe.
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW  int   _filbuf (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int   _flsbuf (int, FILE *);
 
 #if !defined _MT
 
-__CRT_INLINE int __cdecl __MINGW_NOTHROW getc (FILE* __F)
+__CRT_INLINE __cdecl __MINGW_NOTHROW  int getc (FILE * __F)
 {
   return (--__F->_cnt >= 0)
     ?  (int) (unsigned char) *__F->_ptr++
     : _filbuf (__F);
 }
 
-__CRT_INLINE int __cdecl __MINGW_NOTHROW putc (int __c, FILE* __F)
+__CRT_INLINE __cdecl __MINGW_NOTHROW  int putc (int __c, FILE * __F)
 {
   return (--__F->_cnt >= 0)
     ?  (int) (unsigned char) (*__F->_ptr++ = (char)__c)
     :  _flsbuf (__c, __F);
 }
 
-__CRT_INLINE int __cdecl __MINGW_NOTHROW getchar (void)
+__CRT_INLINE __cdecl __MINGW_NOTHROW  int getchar (void)
 {
   return (--stdin->_cnt >= 0)
     ?  (int) (unsigned char) *stdin->_ptr++
     : _filbuf (stdin);
 }
 
-__CRT_INLINE int __cdecl __MINGW_NOTHROW putchar(int __c)
+__CRT_INLINE __cdecl __MINGW_NOTHROW  int putchar(int __c)
 {
   return (--stdout->_cnt >= 0)
     ?  (int) (unsigned char) (*stdout->_ptr++ = (char)__c)
@@ -423,52 +496,60 @@ __CRT_INLINE int __cdecl __MINGW_NOTHROW putchar(int __c)
 
 #else  /* Use library functions.  */
 
-_CRTIMP int __cdecl __MINGW_NOTHROW	getc (FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	putc (int, FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	getchar (void);
-_CRTIMP int __cdecl __MINGW_NOTHROW	putchar (int);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    getc (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    putc (int, FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    getchar (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    putchar (int);
 
 #endif
 
-/*
- * Direct Input and Output Functions
+/* Direct Input and Output Functions
  */
+_CRTIMP __cdecl __MINGW_NOTHROW  size_t fread (void *, size_t, size_t, FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  size_t fwrite (const void *, size_t, size_t, FILE \
*);  
-_CRTIMP size_t __cdecl __MINGW_NOTHROW	fread (void*, size_t, size_t, FILE*);
-_CRTIMP size_t __cdecl __MINGW_NOTHROW	fwrite (const void*, size_t, size_t, FILE*);
-
-/*
- * File Positioning Functions
+/* File Positioning Functions
  */
+_CRTIMP __cdecl __MINGW_NOTHROW  int    fseek (FILE *, long, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  long   ftell (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  void   rewind (FILE *);
 
-_CRTIMP int __cdecl __MINGW_NOTHROW	fseek (FILE*, long, int);
-_CRTIMP long __cdecl __MINGW_NOTHROW	ftell (FILE*);
-_CRTIMP void __cdecl __MINGW_NOTHROW	rewind (FILE*);
+#if _WIN32_WINNT >= _WIN32_WINNT_VISTA || __MSVCRT_VERSION__ >= __MSVCR80_DLL
+ /*
+  * Microsoft introduced a number of variations on fseek() and ftell(),
+  * beginning with MSVCR80.DLL; the bare _fseeki64() and _ftelli64() were
+  * subsequently integrated into MSVCRT.DLL, from Vista onward...
+  */
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _fseeki64 (FILE *, __int64, int);
+_CRTIMP __cdecl __MINGW_NOTHROW __int64 _ftelli64 (FILE *);
 
-#if __MSVCRT_VERSION__ >= 0x800
-_CRTIMP int __cdecl __MINGW_NOTHROW	_fseek_nolock (FILE*, long, int);
-_CRTIMP long __cdecl __MINGW_NOTHROW	_ftell_nolock (FILE*);
+#if __MSVCRT_VERSION__ >= __MSVCR80_DLL
+ /*
+  * ...while the "nolock" variants remain exclusive to MSVCR80.DLL, and
+  * its later MSVC specific derivatives.
+  */
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _fseek_nolock (FILE *, long, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  long   _ftell_nolock (FILE *);
 
-_CRTIMP int __cdecl __MINGW_NOTHROW	_fseeki64 (FILE*, __int64, int);
-_CRTIMP __int64 __cdecl __MINGW_NOTHROW	_ftelli64 (FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_fseeki64_nolock (FILE*, __int64, int);
-_CRTIMP __int64 __cdecl __MINGW_NOTHROW	_ftelli64_nolock (FILE*);
-#endif
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _fseeki64_nolock (FILE *, __int64, int);
+_CRTIMP __cdecl __MINGW_NOTHROW __int64 _ftelli64_nolock (FILE *);
 
-#ifdef __USE_MINGW_FSEEK  /* These are in libmingwex.a */
-/*
- * Workaround for limitations on win9x where a file contents are
- * not zero'd out if you seek past the end and then write.
+#endif  /* MSVCR80.DLL and later derivatives ONLY */
+#endif  /* MSVCR80.DLL and later or MSVCRT.DLL since Vista */
+
+#ifdef __USE_MINGW_FSEEK
+/* Workaround for a limitation on Win9x where a file is not zero padded
+ * on write, following a seek beyond the original end of file; these are
+ * implemented in libmingwex.a
  */
+__cdecl __MINGW_NOTHROW  int    __mingw_fseek (FILE *, long, int);
+__cdecl __MINGW_NOTHROW  size_t __mingw_fwrite (const void *, size_t, size_t, FILE \
*);  
-int __cdecl __MINGW_NOTHROW __mingw_fseek (FILE *, long, int);
-size_t __cdecl __MINGW_NOTHROW __mingw_fwrite (const void*, size_t, size_t, FILE*);
-#define fseek(fp, offset, whence)  __mingw_fseek(fp, offset, whence)
 #define fwrite(buffer, size, count, fp)  __mingw_fwrite(buffer, size, count, fp)
+#define fseek(fp, offset, whence)        __mingw_fseek(fp, offset, whence)
 #endif /* __USE_MINGW_FSEEK */
 
-/*
- * An opaque data type used for storing file positions... The contents of
+/* An opaque data type used for storing file positions... The contents of
  * this type are unknown, but we (the compiler) need to know the size
  * because the programmer using fgetpos and fsetpos will be setting aside
  * storage for fpos_t structres. Actually I tested using a byte array and
@@ -477,60 +558,55 @@ size_t __cdecl __MINGW_NOTHROW __mingw_fwrite (const void*, \
                size_t, size_t, FILE
  * MSVCRT however, and for now `long long' will do.
  */
 #ifdef __MSVCRT__
-typedef long long fpos_t;
+typedef long long  fpos_t;
 #else
-typedef long	fpos_t;
+typedef long       fpos_t;
 #endif
 
-_CRTIMP int __cdecl __MINGW_NOTHROW	fgetpos	(FILE*, fpos_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fsetpos (FILE*, const fpos_t*);
+_CRTIMP __cdecl __MINGW_NOTHROW  int fgetpos (FILE *, fpos_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int fsetpos (FILE *, const fpos_t *);
 
-/*
- * Error Functions
+/* Error Functions
  */
-
-_CRTIMP int __cdecl __MINGW_NOTHROW	feof (FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	ferror (FILE*);
+_CRTIMP __cdecl __MINGW_NOTHROW  int feof (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int ferror (FILE *);
 
 #ifdef __cplusplus
-inline int __cdecl __MINGW_NOTHROW feof (FILE* __F)
-  { return __F->_flag & _IOEOF; }
-inline int __cdecl __MINGW_NOTHROW ferror (FILE* __F)
-  { return __F->_flag & _IOERR; }
+inline __cdecl __MINGW_NOTHROW  int feof (FILE * __F){ return __F->_flag & _IOEOF; }
+inline __cdecl __MINGW_NOTHROW  int ferror (FILE * __F){ return __F->_flag & _IOERR; \
}  #else
 #define feof(__F)     ((__F)->_flag & _IOEOF)
 #define ferror(__F)   ((__F)->_flag & _IOERR)
 #endif
 
-_CRTIMP void __cdecl __MINGW_NOTHROW	clearerr (FILE*);
-_CRTIMP void __cdecl __MINGW_NOTHROW	perror (const char*);
+_CRTIMP __cdecl __MINGW_NOTHROW  void clearerr (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  void perror (const char *);
 
 
 #ifndef __STRICT_ANSI__
 /*
  * Pipes
  */
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_popen (const char*, const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_pclose (FILE*);
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE * _popen (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _pclose (FILE *);
 
 #ifndef NO_OLDNAMES
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	popen (const char*, const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	pclose (FILE*);
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE *  popen (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int     pclose (FILE *);
 #endif
 
-/*
- * Other Non ANSI functions
- */
-_CRTIMP int __cdecl __MINGW_NOTHROW	_flushall (void);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_fgetchar (void);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_fputchar (int);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_fdopen (int, const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_fileno (FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_fcloseall (void);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_fsopen (const char*, const char*, int);
+/* Other Non ANSI functions
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _flushall (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _fgetchar (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _fputchar (int);
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE * _fdopen (int, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _fileno (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _fcloseall (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE * _fsopen (const char *, const char *, int);
 #ifdef __MSVCRT__
-_CRTIMP int __cdecl __MINGW_NOTHROW	_getmaxstdio (void);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_setmaxstdio (int);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _getmaxstdio (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _setmaxstdio (int);
 #endif
 
 /* Microsoft introduced a capability in MSVCR80.DLL and later, to
@@ -566,16 +642,15 @@ unsigned int __cdecl __mingw_set_output_format (unsigned int);
 int __cdecl __mingw_get_printf_count_output (void);
 int __cdecl __mingw_set_printf_count_output (int);
 
-#if __MSVCRT_VERSION__ >= 0x800
-/*
- * When the user declares that MSVCR80.DLL features are supported,
+#if __MSVCRT_VERSION__ >= __MSVCR80_DLL
+/* When the user declares that MSVCR80.DLL features are supported,
  * we simply expose the corresponding APIs...
  */
 _CRTIMP unsigned int __cdecl __MINGW_NOTHROW _get_output_format (void);
 _CRTIMP unsigned int __cdecl __MINGW_NOTHROW _set_output_format (unsigned int);
 
-_CRTIMP int __cdecl __MINGW_NOTHROW _get_printf_count_output (void);
-_CRTIMP int __cdecl __MINGW_NOTHROW _set_printf_count_output (int);
+_CRTIMP __cdecl __MINGW_NOTHROW  int _get_printf_count_output (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  int _set_printf_count_output (int);
 
 #else
 /* ...otherwise, we emulate the APIs, in a DLL version agnostic
@@ -595,8 +670,7 @@ __CRT_ALIAS unsigned int __cdecl _set_output_format (unsigned int \
                __style)
  * the state of "%n" formatting as DISABLED if they are not.
  */
 #if __USE_MINGW_ANSI_STDIO
-/*
- * Note that __USE_MINGW_ANSI_STDIO is not guaranteed to resolve to any
+/* Note that __USE_MINGW_ANSI_STDIO is not guaranteed to resolve to any
  * symbol which will represent a compilable logic state; map it to this
  * alternative which will, for the true state...
  */
@@ -615,11 +689,11 @@ __CRT_ALIAS int __cdecl _set_printf_count_output (int __mode)
 #endif
 
 #ifndef _NO_OLDNAMES
-_CRTIMP int __cdecl __MINGW_NOTHROW	fgetchar (void);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fputchar (int);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	fdopen (int, const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fileno (FILE*);
-#endif	/* Not _NO_OLDNAMES */
+_CRTIMP __cdecl __MINGW_NOTHROW  int    fgetchar (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    fputchar (int);
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE * fdopen (int, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    fileno (FILE *);
+#endif	/* !_NO_OLDNAMES */
 
 #define _fileno(__F) ((__F)->_file)
 #ifndef _NO_OLDNAMES
@@ -627,12 +701,11 @@ _CRTIMP int __cdecl __MINGW_NOTHROW	fileno (FILE*);
 #endif
 
 #if defined (__MSVCRT__) && ! defined (__NO_MINGW_LFS)
-#include <sys/types.h>
 __CRT_INLINE __JMPSTUB__(( FUNCTION = fopen64, REMAPPED = fopen ))
-FILE* __cdecl __MINGW_NOTHROW fopen64 (const char* filename, const char* mode)
+FILE * __cdecl __MINGW_NOTHROW  fopen64 (const char * filename, const char * mode)
 { return fopen (filename, mode); }
 
-int __cdecl __MINGW_NOTHROW fseeko64 (FILE*, __off64_t, int);
+int __cdecl __MINGW_NOTHROW  fseeko64 (FILE *, __off64_t, int);
 
 #ifdef __USE_MINGW_FSEEK
 int __cdecl __MINGW_NOTHROW __mingw_fseeko64 (FILE *, __off64_t, int);
@@ -643,96 +716,107 @@ __CRT_INLINE __LIBIMPL__(( FUNCTION = ftello64 ))
 __off64_t __cdecl __MINGW_NOTHROW ftello64 (FILE * stream)
 { fpos_t __pos; return (fgetpos(stream, &__pos)) ? -1LL : (__off64_t)(__pos); }
 
-#endif /* __MSVCRT__ && !__NO_MINGW_LFS */
+#endif	/* __MSVCRT__ && !__NO_MINGW_LFS */
 #endif	/* !__STRICT_ANSI__ */
+#endif	/* _STDIO_H */
+
+#if ! (defined _STDIO_H && defined _WCHAR_H)
+/* The following are declared when including either <stdio.h> or <wchar.h>.
+ * If both header include guards are now in place, then we must currently be
+ * including <stdio.h> in its own right, having already processed this block
+ * during prior partial inclusion by <wchar.h>; there is no need to process
+ * it a second time.
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW  int     fwprintf (FILE *, const wchar_t *, ...);
+_CRTIMP __cdecl __MINGW_NOTHROW  int     wprintf (const wchar_t *, ...);
+_CRTIMP __cdecl __MINGW_NOTHROW  int     vfwprintf (FILE *, const wchar_t *, \
__VALIST); +_CRTIMP __cdecl __MINGW_NOTHROW  int     vwprintf (const wchar_t *, \
__VALIST); +_CRTIMP __cdecl __MINGW_NOTHROW  int    _snwprintf (wchar_t *, size_t, \
const wchar_t *, ...); +_CRTIMP __cdecl __MINGW_NOTHROW  int    _vscwprintf (const \
wchar_t *, __VALIST); +_CRTIMP __cdecl __MINGW_NOTHROW  int    _vsnwprintf (wchar_t \
*, size_t, const wchar_t *, __VALIST); +_CRTIMP __cdecl __MINGW_NOTHROW  int     \
fwscanf (FILE *, const wchar_t *, ...); +_CRTIMP __cdecl __MINGW_NOTHROW  int     \
wscanf (const wchar_t *, ...); +_CRTIMP __cdecl __MINGW_NOTHROW  int     swscanf \
(const wchar_t *, const wchar_t *, ...); +_CRTIMP __cdecl __MINGW_NOTHROW  wint_t  \
fgetwc (FILE *); +_CRTIMP __cdecl __MINGW_NOTHROW  wint_t  fputwc (wchar_t, FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  wint_t  ungetwc (wchar_t, FILE *);
 
-/* Wide  versions */
-#ifndef _WSTDIO_DEFINED
-/*  also in wchar.h - keep in sync */
-_CRTIMP int __cdecl __MINGW_NOTHROW	fwprintf (FILE*, const wchar_t*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	wprintf (const wchar_t*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_snwprintf (wchar_t*, size_t, const wchar_t*, \
                ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	vfwprintf (FILE*, const wchar_t*, __VALIST);
-_CRTIMP int __cdecl __MINGW_NOTHROW	vwprintf (const wchar_t*, __VALIST);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_vsnwprintf (wchar_t*, size_t, const wchar_t*, \
                __VALIST);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_vscwprintf (const wchar_t*, __VALIST);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fwscanf (FILE*, const wchar_t*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	wscanf (const wchar_t*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	swscanf (const wchar_t*, const wchar_t*, ...);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	fgetwc (FILE*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	fputwc (wchar_t, FILE*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	ungetwc (wchar_t, FILE*);
-
-/* These differ from the ISO C prototypes, which have a maxlen parameter (like \
snprintf).  */  #ifndef __STRICT_ANSI__
-_CRTIMP int __cdecl __MINGW_NOTHROW	swprintf (wchar_t*, const wchar_t*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	vswprintf (wchar_t*, const wchar_t*, __VALIST);
+/* These differ from the ISO C prototypes, which have a maxlen parameter (like \
snprintf). + */
+_CRTIMP __cdecl __MINGW_NOTHROW  int  swprintf (wchar_t *, const wchar_t *, ...);
+_CRTIMP __cdecl __MINGW_NOTHROW  int  vswprintf (wchar_t *, const wchar_t *, \
__VALIST);  #endif
 
 #ifdef __MSVCRT__
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW fgetws (wchar_t*, int, FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fputws (const wchar_t*, FILE*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	getwc (FILE*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	getwchar (void);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _getws (wchar_t*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	putwc (wint_t, FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_putws (const wchar_t*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	putwchar (wint_t);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_wfdopen(int, const wchar_t *);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_wfopen (const wchar_t*, const wchar_t*);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_wfreopen (const wchar_t*, const wchar_t*, \
                FILE*);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_wfsopen (const wchar_t*, const wchar_t*, \
                int);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtmpnam (wchar_t*);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtempnam (const wchar_t*, const wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_wrename (const wchar_t*, const wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_wremove (const wchar_t*);
-_CRTIMP void __cdecl __MINGW_NOTHROW	_wperror (const wchar_t*);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_wpopen (const wchar_t*, const wchar_t*);
+_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t * fgetws (wchar_t *, int, FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int       fputws (const wchar_t *, FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  wint_t    getwc (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  wint_t    getwchar (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  wint_t    putwc (wint_t, FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  wint_t    putwchar (wint_t);
+
+#ifndef __STRICT_ANSI__
+_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t * _getws (wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int       _putws (const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE    * _wfdopen(int, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE    * _wfopen (const wchar_t *, const wchar_t \
*); +_CRTIMP __cdecl __MINGW_NOTHROW  FILE    * _wfreopen (const wchar_t *, const \
wchar_t *, FILE *); +_CRTIMP __cdecl __MINGW_NOTHROW  FILE    * _wfsopen (const \
wchar_t *, const wchar_t *, int); +_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t * \
_wtmpnam (wchar_t *); +_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t * _wtempnam (const \
wchar_t *, const wchar_t *); +_CRTIMP __cdecl __MINGW_NOTHROW  int       _wrename \
(const wchar_t *, const wchar_t *); +_CRTIMP __cdecl __MINGW_NOTHROW  int       \
_wremove (const wchar_t *); +_CRTIMP __cdecl __MINGW_NOTHROW  void      _wperror \
(const wchar_t *); +_CRTIMP __cdecl __MINGW_NOTHROW  FILE    * _wpopen (const wchar_t \
*, const wchar_t *); +
+#endif  /* !__STRICT_ANSI__ */
 #endif	/* __MSVCRT__ */
 
 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
-int __cdecl __MINGW_NOTHROW snwprintf (wchar_t* s, size_t n, const wchar_t*  format, \
                ...);
-int __cdecl __MINGW_NOTHROW vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, \
__VALIST arg); +__cdecl __MINGW_NOTHROW  int  snwprintf (wchar_t *, size_t, const \
wchar_t *, ...); +__cdecl __MINGW_NOTHROW  int  vsnwprintf (wchar_t *, size_t, const \
wchar_t *, __VALIST); +
 #ifndef __NO_INLINE__
-__CRT_INLINE int __cdecl __MINGW_NOTHROW
-vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
-  { return _vsnwprintf ( s, n, format, arg);}
-#endif
-int __cdecl __MINGW_NOTHROW vwscanf (const wchar_t * __restrict__, __VALIST);
-int __cdecl __MINGW_NOTHROW vfwscanf (FILE * __restrict__,
-		       const wchar_t * __restrict__, __VALIST);
-int __cdecl __MINGW_NOTHROW vswscanf (const wchar_t * __restrict__,
-		       const wchar_t * __restrict__, __VALIST);
+__CRT_INLINE __cdecl __MINGW_NOTHROW
+__JMPSTUB__(( FUNCTION = vsnwprintf, REMAPPED = _vsnwprintf ))
+int vsnwprintf (wchar_t *__s, size_t __n, const wchar_t *__fmt, __VALIST __arg)
+{ return _vsnwprintf ( __s, __n, __fmt, __arg); }
 #endif
 
-#define _WSTDIO_DEFINED
-#endif /* _WSTDIO_DEFINED */
+__cdecl __MINGW_NOTHROW  int  vwscanf (const wchar_t *__restrict__, __VALIST);
+__cdecl __MINGW_NOTHROW
+int  vfwscanf (FILE *__restrict__, const wchar_t *__restrict__, __VALIST);
+__cdecl __MINGW_NOTHROW
+int  vswscanf (const wchar_t *__restrict__, const wchar_t * __restrict__, __VALIST);
 
-#ifndef __STRICT_ANSI__
-#ifdef __MSVCRT__
-#ifndef NO_OLDNAMES
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	wpopen (const wchar_t*, const wchar_t*);
-#endif /* not NO_OLDNAMES */
-#endif /* MSVCRT runtime */
+#endif  /* !__NO__ISOCEXT */
+#endif  /* ! (_STDIO_H && _WCHAR_H) */
 
-/*
- * Other Non ANSI wide functions
+#if defined _STDIO_H && ! defined __STRICT_ANSI__
+#if defined __MSVCRT__ && ! defined _NO_OLDNAMES
+_CRTIMP __cdecl __MINGW_NOTHROW  FILE * wpopen (const wchar_t *, const wchar_t *);
+#endif
+
+/* Other non-ANSI wide character functions...
  */
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	_fgetwchar (void);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	_fputwchar (wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_getw (FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_putw (int, FILE*);
+_CRTIMP __cdecl __MINGW_NOTHROW  wint_t _fgetwchar (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  wint_t _fputwchar (wint_t);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _getw (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int    _putw (int, FILE *);
 
 #ifndef _NO_OLDNAMES
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	fgetwchar (void);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	fputwchar (wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW	getw (FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	putw (int, FILE*);
-#endif	/* Not _NO_OLDNAMES */
+/* ...and their original names, before Microsoft uglification...
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW  wint_t  fgetwchar (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  wint_t  fputwchar (wint_t);
+_CRTIMP __cdecl __MINGW_NOTHROW  int     getw (FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int     putw (int, FILE *);
 
-#endif /* __STRICT_ANSI */
+#endif  /* !_NO_OLDNAMES */
+#endif  /* !__STRICT_ANSI__ */
 
 _END_C_DECLS
 
-#endif	/* Not RC_INVOKED */
-#endif /* _STDIO_H_ */
+#endif	/* ! RC_INVOKED */
+#endif  /* !_STDIO_H: $RCSfile$: end of file */
diff --git a/mingwrt/include/wchar.h b/mingwrt/include/wchar.h
index 3ab0830..83db1e8 100644
--- a/mingwrt/include/wchar.h
+++ b/mingwrt/include/wchar.h
@@ -7,7 +7,7 @@
  * $Id$
  *
  * Written by Rob Savoye <rob@cygnus.com>
- * Copyright (C) 1997, 1999-2009, 2011, 2015, MinGW.org Project.
+ * Copyright (C) 1997, 1999-2009, 2011, 2015, 2016, MinGW.org Project.
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -34,21 +34,22 @@
 #define _WCHAR_H
 #pragma GCC system_header
 
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/* MSDN says that isw* char classifications are in wchar.h and wctype.h.
- * Although the wctype names are ANSI, their exposure in this header is
- * not; nevertheless, we replicate them here, for MSDN conformity.
+/* All the headers include this file.
  */
-#include <wctype.h>
+#include <_mingw.h>
 
 #ifndef __STRICT_ANSI__
-/* This is also necessary, to support the non-ANSI wchar.h declarations
- * which MSDN identifies as being provided here.
- */
+ /* MSDN says that isw* char classifications are in wchar.h and wctype.h.
+  * Although the wctype names are ANSI, their exposure in this header is
+  * not; nevertheless, we replicate them here, for MSDN conformity.
+  */
+# include <wctype.h>
+
+ /* This is also necessary, to support the non-ANSI wchar.h declarations
+  * which MSDN identifies as being provided here.
+  */
 # include <sys/types.h>
-#endif /* __STRICT_ANSI__ */
+#endif	/* !__STRICT_ANSI__ */
 
 #define WCHAR_MIN	0
 #define WCHAR_MAX	0xffff
@@ -56,122 +57,80 @@
 # define WEOF		(wchar_t)(0xffff)
 
 #ifndef RC_INVOKED
-
-#define __need_size_t
-#define __need_wint_t
-#define __need_wchar_t
-#define __need_NULL
-#include <stddef.h>
-
-#ifndef __VALIST
-# if defined __GNUC__ && __GNUC__ >= 3
-#  define __need___va_list
-#  include <stdarg.h>
-#  define __VALIST __builtin_va_list
-# else
-#  define __VALIST char*
-# endif
-#endif
-
+#define __WCHAR_H_SOURCED__
+/* ISO-C, POSIX, and Microsoft specify an overlap of content between
+ * <wchar.h> and other system header files; by inclusion of such other
+ * headers within this "__WCHAR_H_SOURCED__" scope, we may selectively
+ * retrieve the overlapping content, without requiring duplication of
+ * that content here; thus, from...
+ */
+#include <stdio.h>
+/* ...we obtain (possibly indirect) definitions and declarations for:
+ *
+ *  macros  NULL, FILENAME_MAX
+ *  types   size_t, wchar_t, wint_t, va_list (a.k.a. __VALIST), FILE
+ *  types   ssize_t, off_t, __off64_t, (conditionally, as needed)
+ *
+ *  int     fwprintf (FILE *, const wchar_t *, ...);
+ *  int     wprintf (const wchar_t *, ...);
+ *  int     vfwprintf (FILE *, const wchar_t *, __VALIST);
+ *  int     vwprintf (const wchar_t *, __VALIST);
+ *  int     snwprintf (wchar_t *, size_t, const wchar_t *, ...);
+ *  int    _snwprintf (wchar_t *, size_t, const wchar_t *, ...);
+ *  int    _vscwprintf (const wchar_t *, __VALIST);
+ *  int    _vsnwprintf (wchar_t *, size_t, const wchar_t *, __VALIST);
+ *  int     vsnwprintf (wchar_t *, size_t, const wchar_t *, __VALIST);
+ *  int     fwscanf (FILE *, const wchar_t *, ...);
+ *  int     wscanf (const wchar_t *, ...);
+ *  int     swscanf (const wchar_t *, const wchar_t *, ...);
+ *  int     vwscanf (const wchar_t *, __VALIST);
+ *  int     vfwscanf (FILE *, const wchar_t *, __VALIST);
+ *  int     vswscanf (const wchar_t *, const wchar_t *, __VALIST);
+ *  wint_t  fgetwc (FILE *);
+ *  wint_t  fputwc (wchar_t, FILE *);
+ *  wint_t  ungetwc (wchar_t, FILE *);
+ *
+ *  The following pair of Microsoft functions conflict with their
+ *  corresponding ISO-C prototypes; consequently they will not be
+ *  declared when "__STRICT_ANSI__" checking is in effect:
+ *
+ *  int  swprintf (wchar_t *, const wchar_t *, ...);
+ *  int  vswprintf (wchar_t *, const wchar_t *, __VALIST);
+ *
+ *  The following group of functions is specified by ISO-C, but
+ *  their Microsoft implementations are available only if use of
+ *  "__MSVCRT__" is specified:
+ *
+ *  wchar_t * fgetws (wchar_t *, int, FILE *);
+ *  int       fputws (const wchar_t *, FILE *);
+ *  wint_t    getwc (FILE *);
+ *  wint_t    getwchar (void);
+ *  wint_t    putwc (wint_t, FILE *);
+ *  wint_t    putwchar (wint_t);
+ *
+ *  The following group of functions is also dependent on use of
+ *  "__MSVCRT__"; however, these are Microsoft specific, so their
+ *  are not declared if "__STRICT_ANSI__" checking is specified:
+ *
+ *  wchar_t * _getws (wchar_t *);
+ *  int       _putws (const wchar_t *);
+ *  FILE    * _wfdopen(int, const wchar_t *);
+ *  FILE    * _wfopen (const wchar_t *, const wchar_t *);
+ *  FILE    * _wfreopen (const wchar_t *, const wchar_t *, FILE *);
+ *  FILE    * _wfsopen (const wchar_t *, const wchar_t *, int);
+ *  wchar_t * _wtmpnam (wchar_t *);
+ *  wchar_t * _wtempnam (const wchar_t *, const wchar_t *);
+ *  int       _wrename (const wchar_t *, const wchar_t *);
+ *  int       _wremove (const wchar_t *);
+ *  void      _wperror (const wchar_t *);
+ *  FILE    * _wpopen (const wchar_t *, const wchar_t *);
+ *
+ */
 _BEGIN_C_DECLS
 
-#ifndef _FILE_DEFINED  /* Also in stdio.h */
-#define	_FILE_DEFINED
-typedef struct _iobuf
-{
-	char*	_ptr;
-	int	_cnt;
-	char*	_base;
-	int	_flag;
-	int	_file;
-	int	_charbuf;
-	int	_bufsiz;
-	char*	_tmpfname;
-} FILE;
-#endif	/* Not _FILE_DEFINED */
-
-#define __need_time_t
-#define _FAKE_TIME_H_SOURCED 1
-#include <parts/time.h>
-
-#ifndef _TM_DEFINED /* Also in time.h */
-struct tm {
-        int tm_sec;     /* seconds after the minute - [0,59] */
-        int tm_min;     /* minutes after the hour - [0,59] */
-        int tm_hour;    /* hours since midnight - [0,23] */
-        int tm_mday;    /* day of the month - [1,31] */
-        int tm_mon;     /* months since January - [0,11] */
-        int tm_year;    /* years since 1900 */
-        int tm_wday;    /* days since Sunday - [0,6] */
-        int tm_yday;    /* days since January 1 - [0,365] */
-        int tm_isdst;   /* daylight savings time flag */
-        };
-#define _TM_DEFINED
-#endif
-
-#ifndef _WSTDIO_DEFINED
-/*  Also in stdio.h - keep in sync */
-_CRTIMP int __cdecl __MINGW_NOTHROW	fwprintf (FILE*, const wchar_t*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	wprintf (const wchar_t*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_snwprintf (wchar_t*, size_t, const wchar_t*, \
                ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	vfwprintf (FILE*, const wchar_t*, __VALIST);
-_CRTIMP int __cdecl __MINGW_NOTHROW	vwprintf (const wchar_t*, __VALIST);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_vsnwprintf (wchar_t*, size_t, const wchar_t*, \
                __VALIST);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fwscanf (FILE*, const wchar_t*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	wscanf (const wchar_t*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	swscanf (const wchar_t*, const wchar_t*, ...);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	fgetwc (FILE*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	fputwc (wchar_t, FILE*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	ungetwc (wchar_t, FILE*);
-
-/* These differ from the ISO C prototypes, which have a maxlen parameter like \
                snprintf.  */
-#ifndef __STRICT_ANSI__
-_CRTIMP int __cdecl __MINGW_NOTHROW	swprintf (wchar_t*, const wchar_t*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW	vswprintf (wchar_t*, const wchar_t*, __VALIST);
-#endif
-
-#ifdef __MSVCRT__
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW fgetws (wchar_t*, int, FILE*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	fputws (const wchar_t*, FILE*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	getwc (FILE*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	getwchar (void);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	putwc (wint_t, FILE*);
-_CRTIMP wint_t __cdecl __MINGW_NOTHROW	putwchar (wint_t);
-#ifndef __STRICT_ANSI__
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _getws (wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_putws (const wchar_t*);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_wfdopen(int, const wchar_t *);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_wfopen (const wchar_t*, const wchar_t*);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_wfreopen (const wchar_t*, const wchar_t*, \
                FILE*);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_wfsopen (const wchar_t*, const wchar_t*, \
                int);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtmpnam (wchar_t*);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtempnam (const wchar_t*, const wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_wrename (const wchar_t*, const wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW	_wremove (const wchar_t*);
-_CRTIMP void __cdecl __MINGW_NOTHROW	_wperror (const wchar_t*);
-_CRTIMP FILE* __cdecl __MINGW_NOTHROW	_wpopen (const wchar_t*, const wchar_t*);
-#endif  /* __STRICT_ANSI__ */
-#endif	/* __MSVCRT__ */
-
-#ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
-int __cdecl __MINGW_NOTHROW snwprintf (wchar_t*, size_t, const wchar_t*, ...);
-int __cdecl __MINGW_NOTHROW vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
-#ifndef __NO_INLINE__
-__CRT_INLINE int __cdecl __MINGW_NOTHROW
-vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
-  { return _vsnwprintf ( s, n, format, arg);}
-#endif
-int __cdecl __MINGW_NOTHROW vwscanf (const wchar_t * __restrict__, __VALIST);
-int __cdecl __MINGW_NOTHROW vfwscanf (FILE * __restrict__,
-		       const wchar_t * __restrict__, __VALIST);
-int __cdecl __MINGW_NOTHROW vswscanf (const wchar_t * __restrict__,
-		       const wchar_t * __restrict__, __VALIST);
-#endif
-
-#define _WSTDIO_DEFINED
-#endif /* _WSTDIO_DEFINED */
-
-#ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */
+#ifndef _WSTDLIB_DEFINED
+/* Also declared in stdlib.h; FIXME: should be factored out.
+ */
 _CRTIMP long __cdecl __MINGW_NOTHROW 	wcstol (const wchar_t*, wchar_t**, int);
 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW wcstoul (const wchar_t*, wchar_t**, \
int);  _CRTIMP double __cdecl __MINGW_NOTHROW	wcstod (const wchar_t*, wchar_t**);
@@ -192,9 +151,9 @@ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wfullpath (wchar_t*, \
const wchar_t*, s  #endif /* _WSTDLIB_DEFINED */
 
 #ifndef _WTIME_DEFINED
-#ifndef __STRICT_ANSI__
-#ifdef __MSVCRT__
-/* wide function prototypes, also declared in time.h */
+#if defined __MSVCRT__ && ! defined __STRICT_ANSI__
+/* Wide function prototypes, also declared in time.h; FIXME: factor out.
+ */
 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW	_wasctime (const struct tm*);
 #if __MSVCRT_VERSION__ < 0x0800
 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW	_wctime (const time_t*);
@@ -213,8 +172,7 @@ _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW	_wctime (const time_t* \
_v)	{ return(_  #endif
 #endif
 
-#endif /* __MSVCRT__ */
-#endif /* __STRICT_ANSI__ */
+#endif	/* __MSVCRT__ && ! __STRICT_ANSI__ */
 _CRTIMP size_t __cdecl __MINGW_NOTHROW	wcsftime (wchar_t*, size_t, const wchar_t*, \
const struct tm*);  #define _WTIME_DEFINED
 #endif /* _WTIME_DEFINED */
@@ -312,7 +270,6 @@ struct __wfinddata64_t {
 };
 #endif
 #if __MSVCRT_VERSION__ >= 0x0800
-#include <stdio.h>
 struct __wfinddata32_t {
 	unsigned	attrib;
 	__time32_t	time_create;
@@ -558,7 +515,9 @@ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wsetlocale (int, const \
wchar_t*);  #define _WLOCALE_DEFINED
 #endif
 
-#ifndef _WPROCESS_DEFINED  /* also declared in process.h */
+#ifndef _WPROCESS_DEFINED
+/* Also declared in process.h; FIXME: to be factored out.
+ */
 #include <stdint.h>  /* For intptr_t.  */
 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecl	(const wchar_t*, const wchar_t*, \
...);  _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecle	(const wchar_t*, const \
wchar_t*, ...); @@ -584,5 +543,6 @@ _CRTIMP intptr_t __cdecl __MINGW_NOTHROW \
_wspawnvpe	(int, const wchar_t*, const  
 _END_C_DECLS
 
+#undef __WCHAR_H_SOURCED__
 #endif /* ! RC_INVOKED */
 #endif /* ! _WCHAR_H */
diff --git a/mingwrt/pseudo-reloc.c b/mingwrt/pseudo-reloc.c
index 2c80c5e..8b29f47 100644
--- a/mingwrt/pseudo-reloc.c
+++ b/mingwrt/pseudo-reloc.c
@@ -1,26 +1,33 @@
-/* pseudo-reloc.c
-
-   Contributed by Egor Duda  <deo@logos-m.ru>
-   Modified by addition of runtime_pseudo_reloc version 2
-   by Kai Tietz  <kai.tietz@onevision.com>
-
-   THIS SOFTWARE IS NOT COPYRIGHTED
-
-   This source code is offered for use in the public domain. You may
-   use, modify or distribute it freely.
-
-   This code is distributed in the hope that it will be useful but
-   WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
-   DISCLAMED. This includes but is not limited to warrenties of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*/
-
-#include <windows.h>
+/*
+ * pseudo-reloc.c
+ *
+ * Contributed by Egor Duda  <deo@logos-m.ru>
+ * Modified by addition of runtime_pseudo_reloc version 2
+ * by Kai Tietz  <kai.tietz@onevision.com>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warrenties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
 #include <stdio.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <memory.h>
 
+/* We need some of the MS-Windows data types and structures;
+ * define them, but with minimal namespace pollution.
+ */
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
 #if defined(__CYGWIN__)
 #include <wchar.h>
 #include <ntdef.h>
@@ -312,16 +319,16 @@ do_pseudo_reloc (void * start, void * end, void * base)
 	    break;
 	  case 32:
 	    reldata = (ptrdiff_t) (*((unsigned int *)reloc_target));
-#ifdef _WIN64
-	    if ((reldata & 0x80000000) != 0)
-	      reldata |= ~((ptrdiff_t) 0xffffffff);
-#endif
+#	    ifdef _WIN64
+	      if ((reldata & 0x80000000) != 0)
+	        reldata |= ~((ptrdiff_t) 0xffffffff);
+#	    endif
 	    break;
-#ifdef _WIN64
+#	  ifdef _WIN64
 	  case 64:
 	    reldata = (ptrdiff_t) (*((unsigned long long *)reloc_target));
 	    break;
-#endif
+#	  endif
 	  default:
 	    reldata=0;
 	    __report_error ("  Unknown pseudo relocation bit size %d.\n",
@@ -336,20 +343,20 @@ do_pseudo_reloc (void * start, void * end, void * base)
       /* Write the new relocation value back to *reloc_target */
       switch ((r->flags & 0xff))
 	{
-         case 8:
-           __write_memory ((void *) reloc_target, &reldata, 1);
-	   break;
-	 case 16:
-           __write_memory ((void *) reloc_target, &reldata, 2);
-	   break;
-	 case 32:
-           __write_memory ((void *) reloc_target, &reldata, 4);
-	   break;
-#ifdef _WIN64
-	 case 64:
-           __write_memory ((void *) reloc_target, &reldata, 8);
-	   break;
-#endif
+	  case 8:
+	    __write_memory ((void *) reloc_target, &reldata, 1);
+	    break;
+	  case 16:
+	    __write_memory ((void *) reloc_target, &reldata, 2);
+	    break;
+	  case 32:
+	    __write_memory ((void *) reloc_target, &reldata, 4);
+	    break;
+#	  ifdef _WIN64
+	  case 64:
+	    __write_memory ((void *) reloc_target, &reldata, 8);
+	    break;
+#	  endif
 	}
      }
 }

-----------------------------------------------------------------------

Summary of changes:
 mingwrt/ChangeLog       |   32 +++
 mingwrt/include/stdio.h |  710 ++++++++++++++++++++++++++---------------------
 mingwrt/include/wchar.h |  226 ++++++---------
 mingwrt/pseudo-reloc.c  |   83 +++---
 4 files changed, 567 insertions(+), 484 deletions(-)


hooks/post-receive
-- 
Repository: mingw-org-wsl



------------------------------

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

------------------------------

_______________________________________________
MinGW-cvs mailing list
MinGW-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-cvs


End of MinGW-cvs Digest, Vol 81, Issue 2
****************************************


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic