OSDN Git Service

Factor out <stdlib.h> vs. <wchar.h> duplicate declarations.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Fri, 18 Mar 2016 20:37:38 +0000 (20:37 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Fri, 18 Mar 2016 20:37:38 +0000 (20:37 +0000)
mingwrt/ChangeLog
mingwrt/include/stdlib.h
mingwrt/include/wchar.h

index 378f6d6..3c7b712 100644 (file)
@@ -1,3 +1,22 @@
+2016-03-18  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Factor out <stdlib.h> vs. <wchar.h> duplicate declarations.
+
+       * include/stdlib.h [__WCHAR_H_SOURCED__]
+       (_STDLIB_H): Do not define it; restrict visible declarations to...
+       (wcstol, wcstoul, wcstod, _wgetenv, _wputenv, _wsearchenv, _wsystem)
+       (_wmakepath, _wsplitpath, _wfullpath, wcstof, wcstold): ...this subset
+       of regular <stdlib.h> content; full content is declared only when...
+       [!__WCHAR_H_SOURCED__] (_STDLIB_H): ...this applies; define it.
+       (_WSTDLIB_DEFINED): Do not define it; delete all references.
+       (pragma GCC system_header): Declare it; tidy layout.
+
+       * include/wchar.h: Delete duplicated declarations for...
+       (wcstol, wcstoul, wcstod, _wgetenv, _wputenv, _wsearchenv, _wsystem)
+       (_wmakepath, _wsplitpath, _wfullpath, wcstof, wcstold): ...these;
+       include <stdlib.h> selectively, to maintain their visibility.
+       (_WSTDLIB_DEFINED): Delete all references.
+
 2016-03-17  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Relocate misplaced umask() function prototypes.
index e37f346..79a7ec3 100644 (file)
@@ -7,7 +7,7 @@
  * $Id$
  *
  * Written by Rob Savoye <rob@cygnus.com>
- * Copyright (C) 1997-2009, 2011, 2014, 2015, MinGW.org Project.
+ * Copyright (C) 1997-2009, 2011, 2014-2016, MinGW.org Project.
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  *
  */
 #ifndef _STDLIB_H
+#pragma GCC system_header
+
+/* Some of the content of this header is made selectively accessible,
+ * when indirectly included via <wchar.h>; only when we have established
+ * that this inclusion is NOT via this selective method...
+ */
+#ifndef __WCHAR_H_SOURCED__
+ /* ...do we define the repeat inclusion guard for <stdlib.h> itself.
+  */
 #define _STDLIB_H
 
-/* All the headers include this file. */
+/* All MinGW headers must include <_mingw.h>; if included via <wchar.h>,
+ * we assume that this has been done already, otherwise we must attend to
+ * it for <stdlib.h>.
+ */
 #include <_mingw.h>
 
+#ifndef RC_INVOKED
 #define __need_size_t
 #define __need_wchar_t
 #define __need_NULL
-
-#ifndef RC_INVOKED
 #include <stddef.h>
 #endif /* RC_INVOKED */
 
 /* RAND_MAX is the maximum value that may be returned by rand.
  * The minimum is zero.
  */
-#define        RAND_MAX        0x7FFF
+#define RAND_MAX       0x7FFF
 
 /* These values may be used as exit status codes.
  */
-#define        EXIT_SUCCESS    0
-#define        EXIT_FAILURE    1
+#define EXIT_SUCCESS   0
+#define EXIT_FAILURE   1
 
 /* Definitions for path name functions.
- * NOTE: All of these values have simply been chosen to be conservatively high.
- *       Remember that with long file names we can no longer depend on
- *       extensions being short.
+ * NOTE: All of these values have simply been chosen to be conservatively
+ * high.  Remember that with long file names we can no longer depend on
+ * extensions being short.
  */
 #ifndef __STRICT_ANSI__
 
 #ifndef MAX_PATH
-#define        MAX_PATH        (260)
+#define MAX_PATH       (260)
 #endif
 
-#define        _MAX_PATH       MAX_PATH
-#define        _MAX_DRIVE      (3)
-#define        _MAX_DIR        256
-#define        _MAX_FNAME      256
-#define        _MAX_EXT        256
+#define _MAX_PATH      MAX_PATH
+#define _MAX_DRIVE     (3)
+#define _MAX_DIR       256
+#define _MAX_FNAME     256
+#define _MAX_EXT       256
 
-#endif /* ! __STRICT_ANSI__ */
+#endif /* !__STRICT_ANSI__ */
+#endif /* !__WCHAR_H_SOURCED__ */
 
 #ifndef RC_INVOKED
 
 _BEGIN_C_DECLS
 
-#if !defined (__STRICT_ANSI__)
+#ifdef _STDLIB_H
+#if ! defined __STRICT_ANSI__
 /* This seems like a convenient place to declare these variables, which
  * give programs using WinMain (or main for that matter) access to main-ish
  * argc and argv. environ is a pointer to a table of environment variables.
  * NOTE: Strings in _argv and environ are ANSI strings.
  */
-extern int     _argc;
-extern char**  _argv;
+extern int     _argc;
+extern char  **_argv;
 
+#ifdef __MSVCRT__
 /* Imports from the runtime DLL, for the above variables.
  */
-#ifdef __MSVCRT__
-
-extern int*  __cdecl __MINGW_NOTHROW   __p___argc(void);
-extern char*** __cdecl __MINGW_NOTHROW  __p___argv(void);
-extern wchar_t***  __cdecl __MINGW_NOTHROW __p___wargv(void);
+extern __cdecl __MINGW_NOTHROW  int       *__p___argc(void);
+extern __cdecl __MINGW_NOTHROW  char    ***__p___argv(void);
+extern __cdecl __MINGW_NOTHROW  wchar_t ***__p___wargv(void);
 
 #define __argc (*__p___argc())
 #define __argv (*__p___argv())
@@ -102,15 +114,17 @@ extern wchar_t***  __cdecl __MINGW_NOTHROW __p___wargv(void);
 
 #ifndef __DECLSPEC_SUPPORTED
 
-extern int*    _imp____argc_dll;
-extern char***  _imp____argv_dll;
+extern int    *_imp____argc_dll;
+extern char ***_imp____argv_dll;
+
 #define __argc (*_imp____argc_dll)
 #define __argv (*_imp____argv_dll)
 
 #else  /* __DECLSPEC_SUPPORTED */
 
 __MINGW_IMPORT int    __argc_dll;
-__MINGW_IMPORT char**  __argv_dll;
+__MINGW_IMPORT char **__argv_dll;
+
 #define __argc __argc_dll
 #define __argv __argv_dll
 
@@ -149,27 +163,29 @@ __MINGW_IMPORT char**  __argv_dll;
 # undef errno
   extern int errno;
 #else
- _CRTIMP int __cdecl __MINGW_NOTHROW *_errno(void);
+_CRTIMP __cdecl __MINGW_NOTHROW  int *_errno(void);
 # define errno  (*_errno())
 #endif
-_CRTIMP int __cdecl __MINGW_NOTHROW *__doserrno(void);
+_CRTIMP __cdecl __MINGW_NOTHROW  int *__doserrno(void);
 #define _doserrno  (*__doserrno())
 
 #if !defined (__STRICT_ANSI__)
 /* Use environ from the DLL, not as a global.
  */
 #ifdef __MSVCRT__
-  extern _CRTIMP char *** __cdecl __MINGW_NOTHROW __p__environ(void);
-  extern _CRTIMP wchar_t *** __cdecl __MINGW_NOTHROW  __p__wenviron(void);
-# define _environ (*__p__environ())
-# define _wenviron (*__p__wenviron())
+# define _environ  (*__p__environ())
+extern _CRTIMP __cdecl __MINGW_NOTHROW  char ***__p__environ(void);
+# define _wenviron  (*__p__wenviron())
+extern _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t ***__p__wenviron(void);
+
 #else  /* ! __MSVCRT__ */
 # ifndef __DECLSPEC_SUPPORTED
-    extern char *** _imp___environ_dll;
-#   define _environ (*_imp___environ_dll)
+# define _environ (*_imp___environ_dll)
+extern char ***_imp___environ_dll;
+
 # else  /* __DECLSPEC_SUPPORTED */
-    __MINGW_IMPORT char ** _environ_dll;
-#   define _environ _environ_dll
+# define _environ  _environ_dll
+__MINGW_IMPORT char ** _environ_dll;
 # endif  /* __DECLSPEC_SUPPORTED */
 #endif  /* ! __MSVCRT__ */
 
@@ -179,17 +195,18 @@ _CRTIMP int __cdecl __MINGW_NOTHROW *__doserrno(void);
 /* One of the MSVCRTxx libraries */
 
 #ifndef __DECLSPEC_SUPPORTED
-  extern int*  _imp___sys_nerr;
-# define       sys_nerr        (*_imp___sys_nerr)
+# define sys_nerr  (*_imp___sys_nerr)
+extern int *_imp___sys_nerr;
+
 #else /* __DECLSPEC_SUPPORTED */
-  __MINGW_IMPORT int   _sys_nerr;
+__MINGW_IMPORT int _sys_nerr;
+
 # ifndef _UWIN
-#   define     sys_nerr        _sys_nerr
+# define sys_nerr  _sys_nerr
 # endif  /* _UWIN */
 #endif  /* __DECLSPEC_SUPPORTED */
 
 #else  /* ! __MSVCRT__ */
-
 /* CRTDLL run time library */
 
 #ifndef __DECLSPEC_SUPPORTED
@@ -203,64 +220,63 @@ _CRTIMP int __cdecl __MINGW_NOTHROW *__doserrno(void);
 #endif  /* ! __MSVCRT__ */
 
 #ifndef __DECLSPEC_SUPPORTED
-extern char*** _imp__sys_errlist;
-#define        sys_errlist     (*_imp___sys_errlist)
+#define sys_errlist  (*_imp___sys_errlist)
+extern char ***_imp__sys_errlist;
+
 #else  /* __DECLSPEC_SUPPORTED */
-__MINGW_IMPORT char*   _sys_errlist[];
+__MINGW_IMPORT char *_sys_errlist[];
+
 #ifndef _UWIN
-#define        sys_errlist     _sys_errlist
+#define sys_errlist  _sys_errlist
 #endif  /* _UWIN */
 #endif  /* __DECLSPEC_SUPPORTED */
 
-/*
- * OS version and such constants.
+/* OS version and such constants.
  */
+#ifdef __MSVCRT__ /* MSVCRT.DLL and MSVCRxx.DLL variants */
 
-#ifdef __MSVCRT__
-/* msvcrtxx.dll */
-
-extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*   __p__osver(void);
-extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*   __p__winver(void);
-extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*   __p__winmajor(void);
-extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*   __p__winminor(void);
+extern _CRTIMP __cdecl __MINGW_NOTHROW  unsigned int *__p__osver(void);
+extern _CRTIMP __cdecl __MINGW_NOTHROW  unsigned int *__p__winver(void);
+extern _CRTIMP __cdecl __MINGW_NOTHROW  unsigned int *__p__winmajor(void);
+extern _CRTIMP __cdecl __MINGW_NOTHROW  unsigned int *__p__winminor(void);
 
 #ifndef __DECLSPEC_SUPPORTED
-# define _osver                (*__p__osver())
-# define _winver       (*__p__winver())
-# define _winmajor     (*__p__winmajor())
-# define _winminor     (*__p__winminor())
-#else
-__MINGW_IMPORT unsigned int _osver;
-__MINGW_IMPORT unsigned int _winver;
-__MINGW_IMPORT unsigned int _winmajor;
-__MINGW_IMPORT unsigned int _winminor;
+# define _osver     (*__p__osver())
+# define _winver    (*__p__winver())
+# define _winmajor  (*__p__winmajor())
+# define _winminor  (*__p__winminor())
+
+#else /* __DECLSPEC_SUPPORTED */
+__MINGW_IMPORT  unsigned int _osver;
+__MINGW_IMPORT  unsigned int _winver;
+__MINGW_IMPORT  unsigned int _winmajor;
+__MINGW_IMPORT  unsigned int _winminor;
 #endif  /* __DECLSPEC_SUPPORTED */
 
 #else  /* ! __MSVCRT__; thus CRTDLL */
-
 #ifndef __DECLSPEC_SUPPORTED
 
-extern unsigned int*   _imp___osver_dll;
-extern unsigned int*   _imp___winver_dll;
-extern unsigned int*   _imp___winmajor_dll;
-extern unsigned int*   _imp___winminor_dll;
+#define _osver     (*_imp___osver_dll)
+#define _winver    (*_imp___winver_dll)
+#define _winmajor  (*_imp___winmajor_dll)
+#define _winminor  (*_imp___winminor_dll)
 
-#define _osver         (*_imp___osver_dll)
-#define _winver                (*_imp___winver_dll)
-#define _winmajor      (*_imp___winmajor_dll)
-#define _winminor      (*_imp___winminor_dll)
+extern unsigned int *_imp___osver_dll;
+extern unsigned int *_imp___winver_dll;
+extern unsigned int *_imp___winmajor_dll;
+extern unsigned int *_imp___winminor_dll;
 
 #else  /* __DECLSPEC_SUPPORTED */
 
-__MINGW_IMPORT unsigned int    _osver_dll;
-__MINGW_IMPORT unsigned int    _winver_dll;
-__MINGW_IMPORT unsigned int    _winmajor_dll;
-__MINGW_IMPORT unsigned int    _winminor_dll;
+#define _osver     _osver_dll
+#define _winver    _winver_dll
+#define _winmajor  _winmajor_dll
+#define _winminor  _winminor_dll
 
-#define _osver         _osver_dll
-#define _winver                _winver_dll
-#define _winmajor      _winmajor_dll
-#define _winminor      _winminor_dll
+__MINGW_IMPORT unsigned int _osver_dll;
+__MINGW_IMPORT unsigned int _winver_dll;
+__MINGW_IMPORT unsigned int _winmajor_dll;
+__MINGW_IMPORT unsigned int _winminor_dll;
 
 #endif  /* __DECLSPEC_SUPPORTED */
 #endif  /* CRTDLL */
@@ -269,23 +285,26 @@ __MINGW_IMPORT unsigned int       _winminor_dll;
 /* Although _pgmptr is exported as DATA, be safe and use the access
  * function __p__pgmptr() to get it.
  */
-_CRTIMP char** __cdecl __MINGW_NOTHROW __p__pgmptr(void);
-#define _pgmptr     (*__p__pgmptr())
-_CRTIMP wchar_t** __cdecl __MINGW_NOTHROW __p__wpgmptr(void);
-#define _wpgmptr    (*__p__wpgmptr())
+#define _pgmptr  (*__p__pgmptr())
+_CRTIMP __cdecl __MINGW_NOTHROW  char **__p__pgmptr(void);
+
+#define _wpgmptr  (*__p__wpgmptr())
+_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t **__p__wpgmptr(void);
 
 #else  /* ! __MSVCRT__; thus CRTDLL */
 
 # ifndef __DECLSPEC_SUPPORTED
-  extern char** __imp__pgmptr_dll;
-# define _pgmptr (*_imp___pgmptr_dll)
+# define _pgmptr  (*_imp___pgmptr_dll)
+extern char **__imp__pgmptr_dll;
 
 # else  /* __DECLSPEC_SUPPORTED */
- __MINGW_IMPORT char* _pgmptr_dll;
+
 # define _pgmptr _pgmptr_dll
-# endif  /* __DECLSPEC_SUPPORTED */
+__MINGW_IMPORT  char *_pgmptr_dll;
 /* no wide version in CRTDLL */
-#endif  /* CRTDLL */
+
+# endif /* __DECLSPEC_SUPPORTED */
+#endif /* CRTDLL */
 
 /* This variable determines the default file mode.
  * TODO: Which flags work?
@@ -293,37 +312,36 @@ _CRTIMP wchar_t** __cdecl __MINGW_NOTHROW __p__wpgmptr(void);
 #if !defined (__DECLSPEC_SUPPORTED) || defined (__IN_MINGW_RUNTIME)
 
 #ifdef __MSVCRT__
-extern int* _imp___fmode;
-#define        _fmode  (*_imp___fmode)
+#define _fmode  (*_imp___fmode)
+extern int *_imp___fmode;
 #else
 /* CRTDLL */
-extern int* _imp___fmode_dll;
-#define        _fmode  (*_imp___fmode_dll)
+#define _fmode  (*_imp___fmode_dll)
+extern int *_imp___fmode_dll;
 #endif
 
 #else  /* __DECLSPEC_SUPPORTED */
-
 #ifdef __MSVCRT__
 __MINGW_IMPORT  int _fmode;
+
 #else  /* ! __MSVCRT__ */
+#define _fmode _fmode_dll
 __MINGW_IMPORT  int _fmode_dll;
-#define        _fmode  _fmode_dll
-#endif  /* ! __MSVCRT__ */
 
+#endif  /* !__MSVCRT__ */
 #endif  /* __DECLSPEC_SUPPORTED */
+#endif  /* !__STRICT_ANSI__ */
 
-#endif  /* ! __STRICT_ANSI__ */
-
-_CRTIMP int __cdecl __MINGW_NOTHROW atoi (const char *);
-_CRTIMP long __cdecl __MINGW_NOTHROW  atol (const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int atoi (const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  long atol (const char *);
 
-_CRTIMP double __cdecl __MINGW_NOTHROW strtod (const char *, char **);
-_CRTIMP double __cdecl __MINGW_NOTHROW atof (const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  double strtod (const char *, char **);
+_CRTIMP __cdecl __MINGW_NOTHROW  double atof (const char *);
 
 #if !defined (__STRICT_ANSI__)
-_CRTIMP double __cdecl __MINGW_NOTHROW _wtof (const wchar_t *);
-_CRTIMP int __cdecl __MINGW_NOTHROW _wtoi (const wchar_t *);
-_CRTIMP long __cdecl __MINGW_NOTHROW _wtol (const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  double _wtof (const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int _wtoi (const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  long _wtol (const wchar_t *);
 #endif
 
 #if __USE_MINGW_ANSI_STDIO
@@ -339,15 +357,15 @@ _CRTIMP long __cdecl __MINGW_NOTHROW _wtol (const wchar_t *);
  * an address reference for either must provide an equivalent of the
  * inline implementation, as non-inlined within their own code.
  */
-extern double __cdecl __MINGW_NOTHROW
-__strtod (const char *__restrict__, char **__restrict__);
+extern __cdecl __MINGW_NOTHROW
+double __strtod (const char *__restrict__, char **__restrict__);
 
-__CRT_ALIAS double __cdecl __MINGW_NOTHROW
-strtod (const char *__restrict__ __nptr, char **__restrict__ __endptr)
+__CRT_ALIAS __cdecl __MINGW_NOTHROW
+double strtod (const char *__restrict__ __nptr, char **__restrict__ __endptr)
 { return __strtod( __nptr, __endptr ); }
 
-__CRT_ALIAS double __cdecl __MINGW_NOTHROW
-atof (const char *__nptr) { return __strtod( __nptr, NULL ); }
+__CRT_ALIAS __cdecl __MINGW_NOTHROW
+double atof (const char *__nptr) { return __strtod( __nptr, NULL ); }
 
 #endif  /* __USE_MINGW_ANSI_STDIO */
 
@@ -357,147 +375,169 @@ atof (const char *__nptr) { return __strtod( __nptr, NULL ); }
  * specific variants of strtod(), which MSVCRT.DLL does not, but we
  * do, in libmingwex.a:
  */
-float __cdecl __MINGW_NOTHROW strtof
-(const char *__restrict__, char **__restrict__);
-
-long double __cdecl __MINGW_NOTHROW
-strtold (const char *__restrict__, char **__restrict__);
+__cdecl __MINGW_NOTHROW
+float strtof (const char *__restrict__, char **__restrict__);
 
+__cdecl __MINGW_NOTHROW
+long double strtold (const char *__restrict__, char **__restrict__);
 #endif  /* _ISOC99_SOURCE */
 
-_CRTIMP long __cdecl __MINGW_NOTHROW strtol (const char *, char **, int);
-_CRTIMP unsigned long __cdecl __MINGW_NOTHROW strtoul (const char *, char **, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  long strtol (const char *, char **, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  unsigned long strtoul (const char *, char **, int);
 
-#ifndef _WSTDLIB_DEFINED
-/* FIXME: also declared in <wchar.h>; should be factored out.
+#endif /* _STDLIB_H only */
+#if ! (defined _STDLIB_H && defined _WCHAR_H)
+/* Prototypes which are to be declared both here, in <stdlib.h>,
+ * and also in <wchar.h>; declare them here, such that they may be
+ * selectively included by <wchar.h>.
  */
-_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 **);
+_CRTIMP __cdecl __MINGW_NOTHROW
+long wcstol (const wchar_t *, wchar_t **, int);
+
+_CRTIMP __cdecl __MINGW_NOTHROW
+unsigned long wcstoul (const wchar_t *, wchar_t **, int);
+
+_CRTIMP __cdecl __MINGW_NOTHROW  double wcstod (const wchar_t *, wchar_t **);
 
 #ifdef _ISOC99_SOURCE
 /* Variants on wcstod(), specified by ISO-C99; once again, MSVCRT.DLL
  * doesn't have them, but we offer them in libmingwex.a
  */
-float __cdecl __MINGW_NOTHROW wcstof( const wchar_t *__restrict__, wchar_t **__restrict__);
-long double __cdecl __MINGW_NOTHROW wcstold (const wchar_t *__restrict__, wchar_t **__restrict__);
+__cdecl __MINGW_NOTHROW
+float wcstof (const wchar_t *__restrict__, wchar_t **__restrict__);
+
+__cdecl __MINGW_NOTHROW
+long double wcstold (const wchar_t *__restrict__, wchar_t **__restrict__);
 #endif  /* _ISOC99_SOURCE */
 
 #ifdef __MSVCRT__
-_CRTIMP wchar_t __cdecl __MINGW_NOTHROW *_wgetenv (const wchar_t *);
-_CRTIMP int __cdecl __MINGW_NOTHROW _wputenv (const wchar_t *);
-_CRTIMP void __cdecl __MINGW_NOTHROW _wsearchenv (const wchar_t *, const wchar_t *, wchar_t *);
-_CRTIMP int __cdecl __MINGW_NOTHROW _wsystem (const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wgetenv (const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int _wputenv (const wchar_t *);
 
-_CRTIMP void __cdecl __MINGW_NOTHROW _wmakepath
-(wchar_t *, const wchar_t *, const wchar_t *, const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW
+void _wsearchenv (const wchar_t *, const wchar_t *, wchar_t *);
 
-_CRTIMP void __cdecl __MINGW_NOTHROW _wsplitpath
-(const wchar_t *, wchar_t *, wchar_t *, wchar_t *, wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  int _wsystem (const wchar_t *);
 
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wfullpath (wchar_t *, const wchar_t *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW
+void _wmakepath (wchar_t *, const wchar_t *, const wchar_t *, const wchar_t *,
+    const wchar_t *
+  );
 
-#endif  /* __MSVCRT__ */
+_CRTIMP __cdecl __MINGW_NOTHROW
+void _wsplitpath (const wchar_t *, wchar_t *, wchar_t *, wchar_t *, wchar_t *);
+
+_CRTIMP __cdecl __MINGW_NOTHROW
+wchar_t *_wfullpath (wchar_t *, const wchar_t *, size_t);
 
-#define _WSTDLIB_DEFINED
-#endif  /* ! _WSTDLIB_DEFINED */
+#endif /* __MSVCRT__ */
+#endif /* _STDLIB_H || _WCHAR_H */
 
-_CRTIMP size_t __cdecl __MINGW_NOTHROW wcstombs        (char*, const wchar_t*, size_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW wctomb (char*, wchar_t);
+#ifdef _STDLIB_H  /* <stdlib.h> only */
+_CRTIMP __cdecl __MINGW_NOTHROW  size_t wcstombs (char *, const wchar_t *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW  int wctomb (char *, wchar_t);
 
-_CRTIMP int __cdecl __MINGW_NOTHROW mblen (const char*, size_t);
-_CRTIMP size_t __cdecl __MINGW_NOTHROW mbstowcs (wchar_t*, const char*, size_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW mbtowc (wchar_t*, const char*, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW  int mblen (const char *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW  size_t mbstowcs (wchar_t *, const char *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW  int mbtowc (wchar_t *, const char *, size_t);
 
-_CRTIMP int __cdecl __MINGW_NOTHROW rand (void);
-_CRTIMP void __cdecl __MINGW_NOTHROW srand (unsigned int);
+_CRTIMP __cdecl __MINGW_NOTHROW  int rand (void);
+_CRTIMP __cdecl __MINGW_NOTHROW  void srand (unsigned int);
 
-_CRTIMP void* __cdecl __MINGW_NOTHROW calloc (size_t, size_t) __MINGW_ATTRIB_MALLOC;
-_CRTIMP void* __cdecl __MINGW_NOTHROW malloc (size_t) __MINGW_ATTRIB_MALLOC;
-_CRTIMP void* __cdecl __MINGW_NOTHROW realloc (void*, size_t);
-_CRTIMP void __cdecl __MINGW_NOTHROW free (void*);
-_CRTIMP void __cdecl __MINGW_NOTHROW abort (void) __MINGW_ATTRIB_NORETURN;
-_CRTIMP void __cdecl __MINGW_NOTHROW exit (int) __MINGW_ATTRIB_NORETURN;
+_CRTIMP __cdecl __MINGW_NOTHROW  void *calloc (size_t, size_t) __MINGW_ATTRIB_MALLOC;
+_CRTIMP __cdecl __MINGW_NOTHROW  void *malloc (size_t) __MINGW_ATTRIB_MALLOC;
+_CRTIMP __cdecl __MINGW_NOTHROW  void *realloc (void *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW  void free (void *);
+_CRTIMP __cdecl __MINGW_NOTHROW  void abort (void) __MINGW_ATTRIB_NORETURN;
+_CRTIMP __cdecl __MINGW_NOTHROW  void exit (int) __MINGW_ATTRIB_NORETURN;
 
 /* Note: this is in startup code, not imported directly from the runtime DLL
  */
 int __cdecl __MINGW_NOTHROW atexit (void (*)(void));
 
-_CRTIMP int __cdecl __MINGW_NOTHROW system (const char*);
-_CRTIMP char* __cdecl __MINGW_NOTHROW getenv (const char*);
+_CRTIMP __cdecl __MINGW_NOTHROW  int system (const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  char *getenv (const char *);
 
-/* bsearch() and qsort() are also declared in non-ANSI header <search.h>
+/* bsearch() and qsort() are declared both here, in <stdlib.h>, and in
+ * non-ANSI header <search.h>; we reproduce these declarations in both,
+ * with no attempt to guard them, so the compiler may verify that they
+ * are consistent, if both headers are included.
  */
-_CRTIMP void* __cdecl
-bsearch (const void*, const void*, size_t, size_t, int (*)(const void*, const void*));
+_CRTIMP __cdecl  void *bsearch
+(const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
 
-_CRTIMP void __cdecl qsort(void*, size_t, size_t, int (*)(const void*, const void*));
+_CRTIMP __cdecl  void qsort
+(void *, size_t, size_t, int (*)(const void *, const void *));
 
-_CRTIMP int __cdecl __MINGW_NOTHROW abs (int) __MINGW_ATTRIB_CONST;
-_CRTIMP long __cdecl __MINGW_NOTHROW labs (long) __MINGW_ATTRIB_CONST;
+_CRTIMP __cdecl __MINGW_NOTHROW  int abs (int) __MINGW_ATTRIB_CONST;
+_CRTIMP __cdecl __MINGW_NOTHROW  long labs (long) __MINGW_ATTRIB_CONST;
 
-/*
- * div_t and ldiv_t are structures used to return the results of div and
- * ldiv.
+/* div_t and ldiv_t are structures used to return the results of div()
+ * and ldiv() functions.
  *
- * NOTE: div and ldiv appear not to work correctly unless
+ * NOTE: div() and ldiv() appear not to work correctly unless
  *       -fno-pcc-struct-return is specified. This is included in the
  *       mingw32 specs file.
  */
 typedef struct { int quot, rem; } div_t;
 typedef struct { long quot, rem; } ldiv_t;
 
-_CRTIMP div_t __cdecl __MINGW_NOTHROW div (int, int) __MINGW_ATTRIB_CONST;
-_CRTIMP ldiv_t __cdecl __MINGW_NOTHROW ldiv (long, long) __MINGW_ATTRIB_CONST;
+_CRTIMP __cdecl __MINGW_NOTHROW  div_t div (int, int) __MINGW_ATTRIB_CONST;
+_CRTIMP __cdecl __MINGW_NOTHROW  ldiv_t ldiv (long, long) __MINGW_ATTRIB_CONST;
 
 #if !defined (__STRICT_ANSI__)
 /* NOTE: Officially the three following functions are obsolete. The Win32 API
  *       functions SetErrorMode, Beep and Sleep are their replacements.
  */
-_CRTIMP void __cdecl __MINGW_NOTHROW _beep (unsigned int, unsigned int) __MINGW_ATTRIB_DEPRECATED;
+_CRTIMP __cdecl __MINGW_NOTHROW  void _beep (unsigned int, unsigned int) __MINGW_ATTRIB_DEPRECATED;
 /* Not to be confused with  _set_error_mode (int).  */
-_CRTIMP void __cdecl __MINGW_NOTHROW _seterrormode (int) __MINGW_ATTRIB_DEPRECATED;
-_CRTIMP void __cdecl __MINGW_NOTHROW _sleep (unsigned long) __MINGW_ATTRIB_DEPRECATED;
+_CRTIMP __cdecl __MINGW_NOTHROW  void _seterrormode (int) __MINGW_ATTRIB_DEPRECATED;
+_CRTIMP __cdecl __MINGW_NOTHROW  void _sleep (unsigned long) __MINGW_ATTRIB_DEPRECATED;
 
-_CRTIMP void __cdecl __MINGW_NOTHROW _exit (int) __MINGW_ATTRIB_NORETURN;
+_CRTIMP __cdecl __MINGW_NOTHROW  void _exit (int) __MINGW_ATTRIB_NORETURN;
 
-/* _onexit is MS extension. Use atexit for portability.  */
+/* _onexit is a Microsoft extension. Use atexit for portability. */
 /* Note: This is in startup code, not imported directly from dll */
 typedef  int (* _onexit_t)(void);
-_onexit_t __cdecl __MINGW_NOTHROW _onexit( _onexit_t );
+__cdecl __MINGW_NOTHROW  _onexit_t _onexit( _onexit_t );
 
-_CRTIMP int __cdecl __MINGW_NOTHROW _putenv (const char*);
-_CRTIMP void __cdecl __MINGW_NOTHROW _searchenv (const char*, const char*, char*);
+_CRTIMP __cdecl __MINGW_NOTHROW  int _putenv (const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW
+void _searchenv (const char *, const char *, char *);
 
-_CRTIMP char* __cdecl __MINGW_NOTHROW _ecvt (double, int, int*, int*);
-_CRTIMP char* __cdecl __MINGW_NOTHROW _fcvt (double, int, int*, int*);
-_CRTIMP char* __cdecl __MINGW_NOTHROW _gcvt (double, int, char*);
+_CRTIMP __cdecl __MINGW_NOTHROW  char *_ecvt (double, int, int *, int *);
+_CRTIMP __cdecl __MINGW_NOTHROW  char *_fcvt (double, int, int *, int *);
+_CRTIMP __cdecl __MINGW_NOTHROW  char *_gcvt (double, int, char *);
 
-_CRTIMP void __cdecl __MINGW_NOTHROW _makepath (char*, const char*, const char*, const char*, const char*);
-_CRTIMP void __cdecl __MINGW_NOTHROW _splitpath (const char*, char*, char*, char*, char*);
-_CRTIMP char* __cdecl __MINGW_NOTHROW _fullpath (char*, const char*, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW
+void _makepath (char *, const char *, const char *, const char *, const char *);
 
-_CRTIMP char* __cdecl __MINGW_NOTHROW _itoa (int, char*, int);
-_CRTIMP char* __cdecl __MINGW_NOTHROW _ltoa (long, char*, int);
-_CRTIMP char* __cdecl __MINGW_NOTHROW _ultoa(unsigned long, char*, int);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _itow (int, wchar_t*, int);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _ltow (long, wchar_t*, int);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _ultow (unsigned long, wchar_t*, int);
+_CRTIMP __cdecl __MINGW_NOTHROW
+void _splitpath (const char *, char *, char *, char *, char *);
+
+_CRTIMP __cdecl __MINGW_NOTHROW  char *_fullpath (char*, const char*, size_t);
+
+_CRTIMP __cdecl __MINGW_NOTHROW  char *_itoa (int, char *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  char *_ltoa (long, char *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  char *_ultoa(unsigned long, char *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_itow (int, wchar_t *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_ltow (long, wchar_t *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_ultow (unsigned long, wchar_t *, int);
 
 #ifdef __MSVCRT__
-_CRTIMP __int64 __cdecl __MINGW_NOTHROW        _atoi64 (const char *);
-_CRTIMP char* __cdecl __MINGW_NOTHROW _i64toa (__int64, char *, int);
-_CRTIMP char* __cdecl __MINGW_NOTHROW _ui64toa (unsigned __int64, char *, int);
-_CRTIMP __int64 __cdecl __MINGW_NOTHROW _wtoi64 (const wchar_t *);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _i64tow (__int64, wchar_t *, int);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _ui64tow (unsigned __int64, wchar_t *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  __int64 _atoi64 (const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW  char* _i64toa (__int64, char *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  char* _ui64toa (unsigned __int64, char *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  __int64 _wtoi64 (const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t* _i64tow (__int64, wchar_t *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  wchar_t* _ui64tow (unsigned __int64, wchar_t *, int);
 
-_CRTIMP unsigned int __cdecl __MINGW_NOTHROW (_rotl)(unsigned int, int) __MINGW_ATTRIB_CONST;
-_CRTIMP unsigned int __cdecl __MINGW_NOTHROW (_rotr)(unsigned int, int) __MINGW_ATTRIB_CONST;
-_CRTIMP unsigned long __cdecl __MINGW_NOTHROW (_lrotl)(unsigned long, int) __MINGW_ATTRIB_CONST;
-_CRTIMP unsigned long __cdecl __MINGW_NOTHROW (_lrotr)(unsigned long, int) __MINGW_ATTRIB_CONST;
+_CRTIMP __cdecl __MINGW_NOTHROW  unsigned int (_rotl)(unsigned int, int) __MINGW_ATTRIB_CONST;
+_CRTIMP __cdecl __MINGW_NOTHROW  unsigned int (_rotr)(unsigned int, int) __MINGW_ATTRIB_CONST;
+_CRTIMP __cdecl __MINGW_NOTHROW  unsigned long (_lrotl)(unsigned long, int) __MINGW_ATTRIB_CONST;
+_CRTIMP __cdecl __MINGW_NOTHROW  unsigned long (_lrotr)(unsigned long, int) __MINGW_ATTRIB_CONST;
 
-_CRTIMP int __cdecl __MINGW_NOTHROW _set_error_mode (int);
+_CRTIMP __cdecl __MINGW_NOTHROW  int _set_error_mode (int);
 
 # define _OUT_TO_DEFAULT       0
 # define _OUT_TO_STDERR        1
@@ -514,7 +554,8 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _set_error_mode (int);
 #   endif
 #  endif
 
-_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _set_abort_behavior (unsigned int, unsigned int);
+_CRTIMP __cdecl __MINGW_NOTHROW
+unsigned int _set_abort_behavior (unsigned int, unsigned int);
 
 /* These masks work with msvcr80.dll version 8.0.50215.44 (a beta release).
  */
@@ -530,69 +571,67 @@ typedef void
     uintptr_t);
 _invalid_parameter_handler _set_invalid_parameter_handler (_invalid_parameter_handler);
 
-# endif  /* __MSVCRT_VERSION__ >= __MSVCR80_DLL */
-#endif  /* __MSVCRT__ */
-
-#ifndef        _NO_OLDNAMES
+# endif /* __MSVCRT_VERSION__ >= __MSVCR80_DLL */
+#endif /* __MSVCRT__ */
 
-_CRTIMP int __cdecl __MINGW_NOTHROW    putenv (const char*);
-_CRTIMP void __cdecl __MINGW_NOTHROW   searchenv (const char*, const char*, char*);
+#ifndef _NO_OLDNAMES
+_CRTIMP __cdecl __MINGW_NOTHROW  int putenv (const char*);
+_CRTIMP __cdecl __MINGW_NOTHROW  void searchenv (const char*, const char*, char*);
 
-_CRTIMP char* __cdecl __MINGW_NOTHROW  itoa (int, char*, int);
-_CRTIMP char* __cdecl __MINGW_NOTHROW  ltoa (long, char*, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  char* itoa (int, char*, int);
+_CRTIMP __cdecl __MINGW_NOTHROW  char* ltoa (long, char*, int);
 
 #ifndef _UWIN
-_CRTIMP char* __cdecl __MINGW_NOTHROW  ecvt (double, int, int*, int*);
-_CRTIMP char* __cdecl __MINGW_NOTHROW  fcvt (double, int, int*, int*);
-_CRTIMP char* __cdecl __MINGW_NOTHROW  gcvt (double, int, char*);
+_CRTIMP __cdecl __MINGW_NOTHROW  char* ecvt (double, int, int*, int*);
+_CRTIMP __cdecl __MINGW_NOTHROW  char* fcvt (double, int, int*, int*);
+_CRTIMP __cdecl __MINGW_NOTHROW  char* gcvt (double, int, char*);
 
-#endif  /* ! _UWIN */
+#endif /* ! _UWIN */
 #endif /* ! _NO_OLDNAMES */
 #endif /* ! __STRICT_ANSI__ */
 
 #ifdef _ISOC99_SOURCE
 /* Further APIs required to support ISO-C99, but missing from MSVCRT.DLL;
- * we provide them in libmingwex.a
- *
+ * we provide them in libmingwex.a:
  *
  * ISO-C99 name for _exit()
  */
-void __cdecl __MINGW_NOTHROW _Exit(int) __MINGW_ATTRIB_NORETURN;
+__cdecl __MINGW_NOTHROW  void _Exit(int) __MINGW_ATTRIB_NORETURN;
 
 #ifndef __NO_INLINE__
 __CRT_INLINE __JMPSTUB__(( FUNCTION = _Exit, REMAPPED = _exit ))
-void __cdecl __MINGW_NOTHROW _Exit( int __status ){ _exit (__status); }
+__cdecl __MINGW_NOTHROW  void _Exit( int __status ){ _exit (__status); }
 #endif
 
 typedef struct { long long quot, rem; } lldiv_t;
-lldiv_t __cdecl __MINGW_NOTHROW lldiv (long long, long long) __MINGW_ATTRIB_CONST;
+__cdecl __MINGW_NOTHROW  lldiv_t lldiv (long long, long long) __MINGW_ATTRIB_CONST;
 
-long long __cdecl __MINGW_NOTHROW llabs (long long);
+__cdecl __MINGW_NOTHROW  long long llabs (long long);
 
 #ifndef __NO_INLINE__
 __CRT_INLINE
 /* No JMPSTUB or LIBIMPL reference here -- we provide a free-standing
  * implementation, along with imaxabs(), in mingwex/imaxabs.c
  */
-long long __cdecl __MINGW_NOTHROW llabs( long long __j )
+__cdecl __MINGW_NOTHROW  long long llabs( long long __j )
 { return __j >= 0 ? __j : -__j; }
 #endif
 
-long long  __cdecl __MINGW_NOTHROW
-strtoll (const char *__restrict__, char **__restrict, int);
+__cdecl __MINGW_NOTHROW
+long long strtoll (const char *__restrict__, char **__restrict, int);
 
-unsigned long long  __cdecl __MINGW_NOTHROW
-strtoull (const char *__restrict__, char **__restrict__, int);
+__cdecl __MINGW_NOTHROW
+unsigned long long strtoull (const char *__restrict__, char **__restrict__, int);
 
 #ifdef __MSVCRT__
 /* MSVCRT.DLL does not provide ISO-C99's atoll() function, but it does
  * provide an analogue, in _atoi64(); map it accordingly.
  */
-long long  __cdecl __MINGW_NOTHROW atoll (const char *);
+__cdecl __MINGW_NOTHROW  long long atoll (const char *);
 
 #ifndef __NO_INLINE__
 __CRT_INLINE __JMPSTUB__(( FUNCTION = atoll, REMAPPED = _atoi64 ))
-long long __cdecl __MINGW_NOTHROW atoll (const char * _c){ return _atoi64 (_c); }
+__cdecl __MINGW_NOTHROW  long long atoll (const char * _c){ return _atoi64 (_c); }
 #endif
 
 #endif  /* __MSVCRT__ */
@@ -609,33 +648,33 @@ long long __cdecl __MINGW_NOTHROW atoll (const char * _c){ return _atoi64 (_c);
  * is there really any justification for us to specify them at all?  For
  * the time being, declare as deprecated; perhaps remove later?
  */
-long long  __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED wtoll (const wchar_t *);
-char* __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED lltoa (long long, char *, int);
-char* __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED ulltoa (unsigned long long , char *, int);
-wchar_t* __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED lltow (long long, wchar_t *, int);
-wchar_t* __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED ulltow (unsigned long long, wchar_t *, int);
+__cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED  long long wtoll (const wchar_t *);
+__cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED  char *lltoa (long long, char *, int);
+__cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED  char *ulltoa (unsigned long long , char *, int);
+__cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED  wchar_t *lltow (long long, wchar_t *, int);
+__cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED  wchar_t *ulltow (unsigned long long, wchar_t *, int);
 
 #ifndef __NO_INLINE__
 /* None of these functions would exist at all, without either these inline
  * implementations, or their respective __JMPSTUB__ equivalents.
  */
 __CRT_INLINE __JMPSTUB__(( FUNCTION = lltoa, REMAPPED = _i64toa ))
-char* __cdecl __MINGW_NOTHROW lltoa (long long __n, char * __c, int __i)
+__cdecl __MINGW_NOTHROW  char *lltoa (long long __n, char * __c, int __i)
 { return _i64toa (__n, __c, __i); }
 
 __CRT_INLINE __JMPSTUB__(( FUNCTION = ulltoa, REMAPPED = _ui64toa ))
-char* __cdecl __MINGW_NOTHROW ulltoa (unsigned long long __n, char * __c, int __i)
+__cdecl __MINGW_NOTHROW  char *ulltoa (unsigned long long __n, char * __c, int __i)
 { return _ui64toa (__n, __c, __i); }
 
 __CRT_INLINE __JMPSTUB__(( FUNCTION = wtoll, REMAPPED = _wtoi64 ))
-long long __cdecl __MINGW_NOTHROW wtoll (const wchar_t * __w){ return _wtoi64 (__w); }
+__cdecl __MINGW_NOTHROW  long long wtoll (const wchar_t * __w){ return _wtoi64 (__w); }
 
 __CRT_INLINE __JMPSTUB__(( FUNCTION = lltow, REMAPPED = _i64tow ))
-wchar_t* __cdecl __MINGW_NOTHROW lltow (long long __n, wchar_t * __w, int __i)
+__cdecl __MINGW_NOTHROW  wchar_t *lltow (long long __n, wchar_t * __w, int __i)
 { return _i64tow (__n, __w, __i); }
 
 __CRT_INLINE __JMPSTUB__(( FUNCTION = ulltow, REMAPPED = _ui64tow ))
-wchar_t* __cdecl __MINGW_NOTHROW ulltow (unsigned long long __n, wchar_t * __w, int __i)
+__cdecl __MINGW_NOTHROW  wchar_t *ulltow (unsigned long long __n, wchar_t * __w, int __i)
 { return _ui64tow (__n, __w, __i); }
 
 #endif  /* ! __NO_INLINE__ */
@@ -649,8 +688,8 @@ wchar_t* __cdecl __MINGW_NOTHROW ulltow (unsigned long long __n, wchar_t * __w,
  */
 #if _POSIX_C_SOURCE >= 200112L
 
-int __cdecl __MINGW_NOTHROW mkstemp( char * );
-int __cdecl __MINGW_NOTHROW __mingw_mkstemp( int, char * );
+__cdecl __MINGW_NOTHROW  int mkstemp (char *);
+__cdecl __MINGW_NOTHROW  int __mingw_mkstemp (int, char *);
 
 /* On POSIX platforms, programmers may adopt an idiom such as:
  *
@@ -692,24 +731,25 @@ int __cdecl __MINGW_NOTHROW __mingw_mkstemp( int, char * );
 #endif
 
 __CRT_ALIAS __LIBIMPL__(( FUNCTION = mkstemp ))
-int __cdecl __MINGW_NOTHROW mkstemp( char *__filename_template )
+__cdecl __MINGW_NOTHROW  int mkstemp (char *__filename_template)
 { return __mingw_mkstemp( _MKSTEMP_INVOKE, __filename_template ); }
 
-#endif  /* _POSIX_C_SOURCE >= 200112L (for mkstemp()) */
+#endif /* _POSIX_C_SOURCE >= 200112L (for mkstemp()) */
 
 /* mkdtemp(3) function support: added as adjunct to feature request #2003.
  * POSIX wants _XOPEN_SOURCE >= 700, (implying _POSIX_C_SOURCE >= 200809L).
  */
 #if _POSIX_C_SOURCE >= 200809L
 
-char * __cdecl __MINGW_NOTHROW mkdtemp( char * );
-char * __cdecl __MINGW_NOTHROW __mingw_mkdtemp( char * );
+__cdecl __MINGW_NOTHROW  char *mkdtemp (char *);
+__cdecl __MINGW_NOTHROW  char *__mingw_mkdtemp (char *);
 
 __CRT_ALIAS __JMPSTUB__(( FUNCTION = mkdtemp ))
-char * __cdecl __MINGW_NOTHROW mkdtemp( char *__dirname_template )
+__cdecl __MINGW_NOTHROW  char *mkdtemp (char *__dirname_template)
 { return __mingw_mkdtemp( __dirname_template ); }
 
-#endif  /* _POSIX_C_SOURCE >= 200809L (for mkdtemp()) */
+#endif /* _POSIX_C_SOURCE >= 200809L (for mkdtemp()) */
+#endif /* _STDLIB_H */
 
 _END_C_DECLS
 
index 35aa20b..3b2f385 100644 (file)
  *  void      _wperror (const wchar_t *);
  *  FILE    * _wpopen (const wchar_t *, const wchar_t *);
  *
+ *
+ * In similar fashion, from...
  */
-_BEGIN_C_DECLS
-
-#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**);
-#if !defined __NO_ISOCEXT /* in libmingwex.a */
-float __cdecl __MINGW_NOTHROW wcstof (const wchar_t * __restrict__, wchar_t ** __restrict__);
-long double __cdecl __MINGW_NOTHROW wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
-#endif /* __NO_ISOCEXT */
-#ifdef __MSVCRT__
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetenv(const wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW    _wputenv(const wchar_t*);
-_CRTIMP void __cdecl __MINGW_NOTHROW   _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW    _wsystem(const wchar_t*);
-_CRTIMP void __cdecl __MINGW_NOTHROW   _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*);
-_CRTIMP void __cdecl __MINGW_NOTHROW   _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*);
-_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wfullpath (wchar_t*, const wchar_t*, size_t);
-#endif
-#define  _WSTDLIB_DEFINED
-#endif /* _WSTDLIB_DEFINED */
-
-/* Also in similar fashion, from...
+#include <stdlib.h>
+/* ...we obtain prototypes for universally supported functions:
+ *
+ *  long wcstol (const wchar_t *, wchar_t **, int);
+ *  unsigned long wcstoul (const wchar_t *, wchar_t **, int);
+ *  double wcstod (const wchar_t *, wchar_t **);
+ *
+ * The following are Microsoft specific, and require MSCVRT.DLL,
+ * or any of its non-free derivatives; they are not available to
+ * applications which use CRTDLL.DLL:
+ *
+ *  wchar_t *_wgetenv (const wchar_t *);
+ *  int _wputenv (const wchar_t *);
+ *  void _wsearchenv (const wchar_t *, const wchar_t *, wchar_t *);
+ *  int _wsystem (const wchar_t *);
+ *  void _wmakepath (wchar_t *, const wchar_t *, const wchar_t *,
+ *          const wchar_t *, const wchar_t *
+ *        );
+ *  void _wsplitpath (const wchar_t *, wchar_t *, wchar_t *,
+ *          wchar_t *, wchar_t *
+ *        );
+ *  wchar_t *_wfullpath (wchar_t *, const wchar_t *, size_t);
+ *
+ * ...while this pair are ISO-C99 standards, which are available
+ * in libmingwex.a, but not in any version of MSVCRT.DLL, (nor in
+ * any of its non-free derivatives prior to MSVCR120.DLL), nor in
+ * CRTDLL.DLL:
+ *
+ *  float wcstof (const wchar_t *restrict, wchar_t **restrict);
+ *  long double wcstold (const wchar_t *restrict, wchar_t **restrict);
+ *
+ *
+ * Again, in similar fashion, from...
  */
 #include <time.h>
 /* ...we obtain an opaque forward declaration of:
  *
  *  struct tm
  *
- * ...prototype declarations for the following ISO-C99 function,
+ * ...and prototype declarations for the following ISO-C99 function,
  * (which is always provided):
  *
  *  size_t wcsftime (wchar_t *, size_t, const wchar_t *, const struct tm *);
@@ -196,11 +206,11 @@ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wfullpath (wchar_t*, const wchar_t*, s
  * ...with the actual replacement being chosen at compile time, on
  * the basis of the user specified "_USE_32BIT_TIME_T" feature test
  * macro, (a Microsoft specific, brain damaged concept), which maps
- * _wctime() function itself, as in in-line alias for the selected
+ * _wctime() itself, as an in-line alias for its corresponding
  * replacement library function.
  *
  */
-
+_BEGIN_C_DECLS
 
 /* Wide character string functions must be specified here, as required
  * by the ISO-C Standard; however, MSVC contravenes this standard by also
@@ -351,11 +361,12 @@ unsigned long long __cdecl __MINGW_NOTHROW wcstoull(const wchar_t * __restrict__
                            wchar_t ** __restrict__, int);
 #endif /* __NO_ISOCEXT */
 
-#ifndef        __STRICT_ANSI__
-/* non-ANSI wide char functions from io.h, direct.h, sys/stat.h and locale.h.  */
-
-#ifndef        _FSIZE_T_DEFINED
-typedef        unsigned long   _fsize_t;
+#ifndef __STRICT_ANSI__
+/* non-ANSI wide char functions from io.h, direct.h, sys/stat.h and locale.h
+ * FIXME: these should be factored out, to avoid duplication.
+ */
+#ifndef _FSIZE_T_DEFINED
+typedef unsigned long  _fsize_t;
 #define _FSIZE_T_DEFINED
 #endif
 
@@ -504,7 +515,7 @@ struct _stat
        time_t  st_ctime;       /* Creation time */
 };
 
-#ifndef        _NO_OLDNAMES
+#ifndef _NO_OLDNAMES
 /* NOTE: Must be the same as _stat above. */
 struct stat
 {