]> Savannah Git Hosting - gnulib.git/commitdiff
Do the Windows oldnames workaround through the C++ GNULIB_NAMESPACE.
authorBruno Haible <bruno@clisp.org>
Sun, 6 Dec 2020 15:43:36 +0000 (16:43 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 6 Dec 2020 15:43:36 +0000 (16:43 +0100)
Reported by Daniel R. Hurtmans <Daniel.Hurtmans@ulb.ac.be> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00029.html>.

* lib/c++defs.h (_GL_CXXALIAS_MDA_CAST): New macro.
* lib/fcntl.in.h (creat, open):  In C++ mode, when GNULIB_NAMESPACE is
defined: 1. Define a symbol in this namespace. 2. Don't redirect using
a preprocessor #define.
* lib/math.in.h (j0, j1, jn, y0, y1, yn): Likewise.
* lib/search.in.h (lfind, lsearch): Likewise.
* lib/stdio.in.h (fcloseall, fdopen, fileno, getw, putw, tempnam):
Likewise.
* lib/stdlib.in.h (ecvt, fcvt, gcvt, mktemp, putenv): Likewise.
* lib/string.in.h (memccpy, strdup): Likewise.
* lib/sys_stat.in.h (chmod, umask): Likewise.
* lib/time.in.h (tzset): Likewise.
* lib/unistd.in.h (access, chdir, close, dup, dup2, execl, execle,
execlp, execv, execve, execvp, execvpe, getcwd, getpid, isatty, lseek,
read, rmdir, swab, unlink, write): Likewise.
* lib/utime.in.h (utime): Likewise.
* lib/wchar.in.h (wcsdup): Likewise.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Initialize HAVE_DECL_FCLOSEALL.
(gl_STDIO_H): Set HAVE_DECL_FCLOSEALL.
* modules/stdio (Makefile.am): Substitute HAVE_DECL_FCLOSEALL.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_DECL_ECVT,
HAVE_DECL_FCVT, HAVE_DECL_GCVT.
(gl_STDLIB_H): Set HAVE_DECL_ECVT, HAVE_DECL_FCVT, HAVE_DECL_GCVT.
* modules/stdlib (Makefile.am): Substitute HAVE_DECL_ECVT,
HAVE_DECL_FCVT, HAVE_DECL_GCVT.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize HAVE_DECL_EXECVPE.
(gl_UNISTD_H): Set HAVE_DECL_EXECVPE.
* modules/unistd (Makefile.am): Substitute HAVE_DECL_EXECVPE.
* m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize HAVE_DECL_WCSDUP.
(gl_WCHAR_H): Set HAVE_DECL_WCSDUP.
* modules/wchar (Makefile.am): Substitute HAVE_DECL_WCSDUP.

21 files changed:
ChangeLog
lib/c++defs.h
lib/fcntl.in.h
lib/math.in.h
lib/search.in.h
lib/stdio.in.h
lib/stdlib.in.h
lib/string.in.h
lib/sys_stat.in.h
lib/time.in.h
lib/unistd.in.h
lib/utime.in.h
lib/wchar.in.h
m4/stdio_h.m4
m4/stdlib_h.m4
m4/unistd_h.m4
m4/wchar_h.m4
modules/stdio
modules/stdlib
modules/unistd
modules/wchar

index d7ef87912b6f868eb81c18a8e4d15bf1739bed08..5cb643ed75391e98778d85f904da8036d4ade4f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2020-12-06  Bruno Haible  <bruno@clisp.org>
+
+       Do the Windows oldnames workaround through the C++ GNULIB_NAMESPACE.
+       Reported by Daniel R. Hurtmans <Daniel.Hurtmans@ulb.ac.be> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00029.html>.
+       * lib/c++defs.h (_GL_CXXALIAS_MDA_CAST): New macro.
+       * lib/fcntl.in.h (creat, open):  In C++ mode, when GNULIB_NAMESPACE is
+       defined: 1. Define a symbol in this namespace. 2. Don't redirect using
+       a preprocessor #define.
+       * lib/math.in.h (j0, j1, jn, y0, y1, yn): Likewise.
+       * lib/search.in.h (lfind, lsearch): Likewise.
+       * lib/stdio.in.h (fcloseall, fdopen, fileno, getw, putw, tempnam):
+       Likewise.
+       * lib/stdlib.in.h (ecvt, fcvt, gcvt, mktemp, putenv): Likewise.
+       * lib/string.in.h (memccpy, strdup): Likewise.
+       * lib/sys_stat.in.h (chmod, umask): Likewise.
+       * lib/time.in.h (tzset): Likewise.
+       * lib/unistd.in.h (access, chdir, close, dup, dup2, execl, execle,
+       execlp, execv, execve, execvp, execvpe, getcwd, getpid, isatty, lseek,
+       read, rmdir, swab, unlink, write): Likewise.
+       * lib/utime.in.h (utime): Likewise.
+       * lib/wchar.in.h (wcsdup): Likewise.
+       * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Initialize HAVE_DECL_FCLOSEALL.
+       (gl_STDIO_H): Set HAVE_DECL_FCLOSEALL.
+       * modules/stdio (Makefile.am): Substitute HAVE_DECL_FCLOSEALL.
+       * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_DECL_ECVT,
+       HAVE_DECL_FCVT, HAVE_DECL_GCVT.
+       (gl_STDLIB_H): Set HAVE_DECL_ECVT, HAVE_DECL_FCVT, HAVE_DECL_GCVT.
+       * modules/stdlib (Makefile.am): Substitute HAVE_DECL_ECVT,
+       HAVE_DECL_FCVT, HAVE_DECL_GCVT.
+       * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize HAVE_DECL_EXECVPE.
+       (gl_UNISTD_H): Set HAVE_DECL_EXECVPE.
+       * modules/unistd (Makefile.am): Substitute HAVE_DECL_EXECVPE.
+       * m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize HAVE_DECL_WCSDUP.
+       (gl_WCHAR_H): Set HAVE_DECL_WCSDUP.
+       * modules/wchar (Makefile.am): Substitute HAVE_DECL_WCSDUP.
+
 2020-12-06  Bruno Haible  <bruno@clisp.org>
 
        doc: Mention some missing function declarations.
index de956d2eac8aea47f64b117121ab391a3b022305..5c01607019c7e48c6e71e4fe3b4fdba4c475d0ee 100644 (file)
     _GL_EXTERN_C int _gl_cxxalias_dummy
 #endif
 
+/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
+   is like  _GL_CXXALIAS_MDA (func, rettype, parameters);
+   except that the C function func may have a slightly different declaration.
+   A cast is used to silence the "invalid conversion" error that would
+   otherwise occur.  */
+#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
+
 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
    declares a C++ alias called GNULIB_NAMESPACE::func
    that redirects to the system provided function func, if GNULIB_NAMESPACE
index 6f16bc6692150a23a36696b43012e6970b80c4fb..11c9aae9bcc4db4d10f1f0758aec73760a82bc0f 100644 (file)
@@ -112,9 +112,21 @@ _GL_CXXALIASWARN (creat);
 /* Assume creat is always declared.  */
 _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
                  "use gnulib module creat for portability");
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef creat
-# define creat _creat
+#else
+/* On native Windows, map 'creat' to '_creat', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::creat always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef creat
+#   define creat _creat
+#  endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (creat, int, (const char *filename, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
+# endif
+_GL_CXXALIASWARN (creat);
 #endif
 
 #if @GNULIB_FCNTL@
@@ -174,9 +186,22 @@ _GL_CXXALIASWARN (open);
 /* Assume open is always declared.  */
 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
                  "use gnulib module open for portability");
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef open
-# define open _open
+#else
+/* On native Windows, map 'open' to '_open', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::open always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef open
+#   define open _open
+#  endif
+_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
+# else
+_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
+# endif
+# if !defined __hpux
+_GL_CXXALIASWARN (open);
+# endif
 #endif
 
 #if @GNULIB_OPENAT@
index 1d7b7031c43afde50857707b93eb3f90ba5a5d4f..4090eff35e303a77d178e9e6e95076d2957575a5 100644 (file)
@@ -1336,20 +1336,47 @@ _GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - "
 #endif
 
 
+/* On native Windows, map 'j0' to '_j0', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::j0 always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef j0
-# define j0 _j0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef j0
+#  define j0 _j0
+# endif
+_GL_CXXALIAS_MDA (j0, double, (double x));
+#else
+_GL_CXXALIAS_SYS (j0, double, (double x));
 #endif
+_GL_CXXALIASWARN (j0);
 
+/* On native Windows, map 'j1' to '_j1', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::j1 always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef j1
-# define j1 _j1
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef j1
+#  define j1 _j1
+# endif
+_GL_CXXALIAS_MDA (j1, double, (double x));
+#else
+_GL_CXXALIAS_SYS (j1, double, (double x));
 #endif
+_GL_CXXALIASWARN (j1);
 
+/* On native Windows, map 'jn' to '_jn', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::jn always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef jn
-# define jn _jn
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef jn
+#  define jn _jn
+# endif
+_GL_CXXALIAS_MDA (jn, double, (int n, double x));
+#else
+_GL_CXXALIAS_SYS (jn, double, (int n, double x));
 #endif
+_GL_CXXALIASWARN (jn);
 
 
 /* Return x * 2^exp.  */
@@ -2316,20 +2343,47 @@ _GL_WARN_ON_USE (truncl, "truncl is unportable - "
 #endif
 
 
+/* On native Windows, map 'y0' to '_y0', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::y0 always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef y0
-# define y0 _y0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef y0
+#  define y0 _y0
+# endif
+_GL_CXXALIAS_MDA (y0, double, (double x));
+#else
+_GL_CXXALIAS_SYS (y0, double, (double x));
 #endif
+_GL_CXXALIASWARN (y0);
 
+/* On native Windows, map 'y1' to '_y1', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::y1 always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef y1
-# define y1 _y1
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef y1
+#  define y1 _y1
+# endif
+_GL_CXXALIAS_MDA (y1, double, (double x));
+#else
+_GL_CXXALIAS_SYS (y1, double, (double x));
 #endif
+_GL_CXXALIASWARN (y1);
 
+/* On native Windows, map 'yn' to '_yn', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::yn always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef yn
-# define yn _yn
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef yn
+#  define yn _yn
+# endif
+_GL_CXXALIAS_MDA (yn, double, (int n, double x));
+#else
+_GL_CXXALIAS_SYS (yn, double, (int n, double x));
 #endif
+_GL_CXXALIASWARN (yn);
 
 
 /* Definitions of function-like macros come here, after the function
index d991dc71d51b0da545818b9166d6da23d86a5330..7fc6f65faf10b1e544296ab1cc71af617b25133c 100644 (file)
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
+/* On native Windows, map 'lfind' to '_lfind', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::lfind always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef lfind
-# define lfind _lfind
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef lfind
+#  define lfind _lfind
+# endif
+_GL_CXXALIAS_MDA (lfind, void *,
+                  (const void *key, const void *base, unsigned int *nmemb,
+                   unsigned int size,
+                   int (*compar) (const void *, const void *)));
+#else
+_GL_CXXALIAS_SYS (lfind, void *,
+                  (const void *key, const void *base, size_t *nmemb,
+                   size_t size,
+                   int (*compar) (const void *, const void *)));
 #endif
+_GL_CXXALIASWARN (lfind);
 
+/* On native Windows, map 'lsearch' to '_lsearch', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::lsearch always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef lsearch
-# define lsearch _lsearch
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef lsearch
+#  define lsearch _lsearch
+# endif
+_GL_CXXALIAS_MDA (lsearch, void *,
+                  (const void *key, void *base, unsigned int *nmemb,
+                   unsigned int size,
+                   int (*compar) (const void *, const void *)));
+#else
+_GL_CXXALIAS_SYS (lsearch, void *,
+                  (const void *key, void *base, size_t *nmemb,
+                   size_t size,
+                   int (*compar) (const void *, const void *)));
 #endif
+_GL_CXXALIASWARN (lsearch);
 
 
 #if @GNULIB_TSEARCH@
index 341246af2bc205c6d40c97f1cd399cc33cd4640e..f86f78773185409947ccf08fe72979adfb927675 100644 (file)
@@ -229,9 +229,27 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
                  "use gnulib module fclose for portable POSIX compliance");
 #endif
 
+/* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is
+   not required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have
+   it.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef fcloseall
-# define fcloseall _fcloseall
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef fcloseall
+#  define fcloseall _fcloseall
+# endif
+_GL_CXXALIAS_MDA (fcloseall, int, (void));
+#else
+# if @HAVE_DECL_FCLOSEALL@
+#  if defined __FreeBSD__
+_GL_CXXALIAS_SYS (fcloseall, void, (void));
+#  else
+_GL_CXXALIAS_SYS (fcloseall, int, (void));
+#  endif
+# endif
+#endif
+#if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@
+_GL_CXXALIASWARN (fcloseall);
 #endif
 
 #if @GNULIB_FDOPEN@
@@ -258,9 +276,20 @@ _GL_CXXALIASWARN (fdopen);
 /* Assume fdopen is always declared.  */
 _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
                  "use gnulib module fdopen for portability");
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef fdopen
-# define fdopen _fdopen
+#else
+/* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fdopen always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fdopen
+#   define fdopen _fdopen
+#  endif
+_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
+# else
+_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
+# endif
+_GL_CXXALIASWARN (fdopen);
 #endif
 
 #if @GNULIB_FFLUSH@
@@ -325,10 +354,19 @@ _GL_CXXALIASWARN (fgets);
 # endif
 #endif
 
+/* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fileno always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef fileno
-# define fileno _fileno
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef fileno
+#  define fileno _fileno
+# endif
+_GL_CXXALIAS_MDA (fileno, int, (FILE *restrict stream));
+#else
+_GL_CXXALIAS_SYS (fileno, int, (FILE *restrict stream));
 #endif
+_GL_CXXALIASWARN (fileno);
 
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
@@ -857,10 +895,19 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 #endif
 
+/* On native Windows, map 'getw' to '_getw', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::getw always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef getw
-# define getw _getw
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef getw
+#  define getw _getw
+# endif
+_GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream));
+#else
+_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream));
 #endif
+_GL_CXXALIASWARN (getw);
 
 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
 struct obstack;
@@ -1075,10 +1122,19 @@ _GL_CXXALIASWARN (puts);
 # endif
 #endif
 
+/* On native Windows, map 'putw' to '_putw', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::putw always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef putw
-# define putw _putw
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef putw
+#  define putw _putw
+# endif
+_GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream));
+#else
+_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream));
 #endif
+_GL_CXXALIASWARN (putw);
 
 #if @GNULIB_REMOVE@
 # if @REPLACE_REMOVE@
@@ -1259,10 +1315,19 @@ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
                  "POSIX compliance");
 #endif
 
+/* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::tempnam always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef tempnam
-# define tempnam _tempnam
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef tempnam
+#  define tempnam _tempnam
+# endif
+_GL_CXXALIAS_MDA (tempnam, char *, (const char *dir, const char *prefix));
+#else
+_GL_CXXALIAS_SYS (tempnam, char *, (const char *dir, const char *prefix));
 #endif
+_GL_CXXALIASWARN (tempnam);
 
 #if @GNULIB_TMPFILE@
 # if @REPLACE_TMPFILE@
index ee0499a9033f56f839897688efc893387a789517..c7ec0786fbcb75076123e7b16e6f67ecadea44f9 100644 (file)
@@ -53,8 +53,8 @@
 # include <sys/loadavg.h>
 #endif
 
-/* Native Windows platforms declare mktemp() in <io.h>.  */
-#if 0 && (defined _WIN32 && ! defined __CYGWIN__)
+/* Native Windows platforms declare _mktemp() in <io.h>.  */
+#if defined _WIN32 && !defined __CYGWIN__
 # include <io.h>
 #endif
 
@@ -242,19 +242,65 @@ _GL_WARN_ON_USE (canonicalize_file_name,
 # endif
 #endif
 
+/* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
+   it.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef ecvt
-# define ecvt _ecvt
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef ecvt
+#  define ecvt _ecvt
+# endif
+_GL_CXXALIAS_MDA (ecvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+#else
+# if @HAVE_DECL_ECVT@
+_GL_CXXALIAS_SYS (ecvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+# endif
+#endif
+#if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
+_GL_CXXALIASWARN (ecvt);
 #endif
 
+/* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
+   it.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef fcvt
-# define fcvt _fcvt
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef fcvt
+#  define fcvt _fcvt
+# endif
+_GL_CXXALIAS_MDA (fcvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+#else
+# if @HAVE_DECL_FCVT@
+_GL_CXXALIAS_SYS (fcvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+# endif
+#endif
+#if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
+_GL_CXXALIASWARN (fcvt);
 #endif
 
+/* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
+   it.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef gcvt
-# define gcvt _gcvt
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef gcvt
+#  define gcvt _gcvt
+# endif
+_GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
+#else
+# if @HAVE_DECL_GCVT@
+_GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
+# endif
+#endif
+#if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
+_GL_CXXALIASWARN (gcvt);
 #endif
 
 #if @GNULIB_GETLOADAVG@
@@ -508,10 +554,19 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
 # endif
 #endif
 
+/* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::mktemp always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef mktemp
-# define mktemp _mktemp
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef mktemp
+#  define mktemp _mktemp
+# endif
+_GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
+#else
+_GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
 #endif
+_GL_CXXALIASWARN (mktemp);
 
 /* Allocate memory with indefinite extent and specified alignment.  */
 #if @GNULIB_POSIX_MEMALIGN@
@@ -630,9 +685,20 @@ _GL_CXXALIAS_MDA (putenv, int, (char *string));
 _GL_CXXALIAS_SYS (putenv, int, (char *string));
 # endif
 _GL_CXXALIASWARN (putenv);
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef putenv
-# define putenv _putenv
+#else
+/* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::putenv always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putenv
+#   define putenv _putenv
+#  endif
+_GL_CXXALIAS_MDA (putenv, int, (char *string));
+# else
+_GL_CXXALIAS_SYS (putenv, int, (char *string));
+# endif
+_GL_CXXALIASWARN (putenv);
 #endif
 
 #if @GNULIB_QSORT_R@
index b0c490bd864f2c83e018fbfdd74b1f37a257c3ad..1bda0fc56f0f1a2e55b3e48c23d3a99a558602cf 100644 (file)
@@ -123,10 +123,21 @@ _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
 #endif
 
 
+/* On native Windows, map 'memccpy' to '_memccpy', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::memccpy always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef memccpy
-# define memccpy _memccpy
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef memccpy
+#  define memccpy _memccpy
+# endif
+_GL_CXXALIAS_MDA (memccpy, void *,
+                  (void *dest, const void *src, int c, size_t n));
+#else
+_GL_CXXALIAS_SYS (memccpy, void *,
+                  (void *dest, const void *src, int c, size_t n));
 #endif
+_GL_CXXALIASWARN (memccpy);
 
 
 /* Return the first instance of C within N bytes of S, or NULL.  */
@@ -413,9 +424,23 @@ _GL_CXXALIASWARN (strdup);
 _GL_WARN_ON_USE (strdup, "strdup is unportable - "
                  "use gnulib module strdup for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef strdup
-# define strdup _strdup
+#else
+/* On native Windows, map 'creat' to '_creat', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::creat always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strdup
+#   define strdup _strdup
+#  endif
+_GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
+# else
+#  if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
+#   undef strdup
+#  endif
+_GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
+# endif
+_GL_CXXALIASWARN (strdup);
 #endif
 
 /* Append no more than N characters from SRC onto DEST.  */
index 2578b48df61f99e3169f57aa2e9f86acf9212b51..3c497c5417c7b35fbe3410006aeff984d999967f 100644 (file)
@@ -391,10 +391,20 @@ struct stat
 #endif
 
 
+/* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::chmod always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef chmod
-# define chmod _chmod
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef chmod
+#  define chmod _chmod
+# endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
+#else
+_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
 #endif
+_GL_CXXALIASWARN (chmod);
 
 
 #if @GNULIB_FCHMODAT@
@@ -808,10 +818,20 @@ _GL_WARN_ON_USE (stat, "stat is unportable - "
 #endif
 
 
+/* On native Windows, map 'umask' to '_umask', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::umask always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef umask
-# define umask _umask
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef umask
+#  define umask _umask
+# endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask));
+#else
+_GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask));
 #endif
+_GL_CXXALIASWARN (umask);
 
 
 #if @GNULIB_UTIMENSAT@
index 2c7172e8a5f042f990d3aca4084b67447025e561..e95282f0689f3740c19859a2686abc5f273b627c 100644 (file)
@@ -145,9 +145,20 @@ _GL_CXXALIAS_MDA (tzset, void, (void));
 _GL_CXXALIAS_SYS (tzset, void, (void));
 #  endif
 _GL_CXXALIASWARN (tzset);
-# elif defined _WIN32 && !defined __CYGWIN__
-#  undef tzset
-#  define tzset _tzset
+# else
+/* On native Windows, map 'tzset' to '_tzset', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::tzset always.  */
+#  if defined _WIN32 && !defined __CYGWIN__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef tzset
+#    define tzset _tzset
+#   endif
+_GL_CXXALIAS_MDA (tzset, void, (void));
+#  else
+_GL_CXXALIAS_SYS (tzset, void, (void));
+#  endif
+_GL_CXXALIASWARN (tzset);
 # endif
 
 /* Return the 'time_t' representation of TP and normalize TP.  */
index 5cf6f9d2476498bb5c1f20c8e320063d7b99f872..c9fb36889ae8b4c9c7b394cd14285578dbd3beef 100644 (file)
 # undef __need_system_stdlib_h
 #endif
 
-/* Native Windows platforms declare chdir, getcwd, rmdir in
+/* Native Windows platforms declare _chdir, _getcwd, _rmdir in
    <io.h> and/or <direct.h>, not in <unistd.h>.
-   They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
-   lseek(), read(), unlink(), write() in <io.h>.  */
+   They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
+   _lseek(), _read(), _unlink(), _write() in <io.h>.  */
 #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
       || defined GNULIB_POSIXCHECK) \
      && (defined _WIN32 && ! defined __CYGWIN__))
 # include <io.h>
 #endif
 
+/* Native Windows platforms declare _execl*, _execv* in <process.h>.  */
+#if defined _WIN32 && !defined __CYGWIN__
+# include <process.h>
+#endif
+
 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
    NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>.  */
 /* But avoid namespace pollution on glibc systems.  */
 
 /* MSVC defines off_t in <sys/types.h>.
    May also define off_t to a 64-bit type on native Windows.  */
-/* But avoid namespace pollution on glibc systems.  */
-#ifndef __GLIBC__
-/* Get off_t, ssize_t.  */
-# include <sys/types.h>
-#endif
+/* Get off_t, ssize_t, mode_t.  */
+#include <sys/types.h>
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
@@ -292,9 +294,20 @@ _GL_WARN_ON_USE (access, "access does not always support X_OK - "
                  "also, this function is a security risk - "
                  "use the gnulib module faccessat instead");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef access
-# define access _access
+#else
+/* On native Windows, map 'access' to '_access', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::access always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef access
+#   define access _access
+#  endif
+_GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
+# else
+_GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
+# endif
+_GL_CXXALIASWARN (access);
 #endif
 
 
@@ -315,9 +328,20 @@ _GL_CXXALIASWARN (chdir);
 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
                  "use gnulib module chdir for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef chdir
-# define chdir _chdir
+#else
+/* On native Windows, map 'chdir' to '_chdir', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::chdir always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chdir
+#   define chdir _chdir
+#  endif
+_GL_CXXALIAS_MDA (chdir, int, (const char *file));
+# else
+_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIASWARN (chdir);
 #endif
 
 
@@ -380,9 +404,20 @@ _GL_CXXALIASWARN (close);
 /* Assume close is always declared.  */
 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
                  "use gnulib module close for portability");
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef close
-# define close _close
+#else
+/* On native Windows, map 'close' to '_close', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::close always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close _close
+#  endif
+_GL_CXXALIAS_MDA (close, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (close, int, (int fd));
+# endif
+_GL_CXXALIASWARN (close);
 #endif
 
 
@@ -428,9 +463,20 @@ _GL_CXXALIASWARN (dup);
 _GL_WARN_ON_USE (dup, "dup is unportable - "
                  "use gnulib module dup for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef dup
-# define dup _dup
+#else
+/* On native Windows, map 'dup' to '_dup', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::dup always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup
+#   define dup _dup
+#  endif
+_GL_CXXALIAS_MDA (dup, int, (int oldfd));
+# else
+_GL_CXXALIAS_SYS (dup, int, (int oldfd));
+# endif
+_GL_CXXALIASWARN (dup);
 #endif
 
 
@@ -462,9 +508,20 @@ _GL_CXXALIASWARN (dup2);
 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
                  "use gnulib module dup2 for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef dup2
-# define dup2 _dup2
+#else
+/* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::dup2 always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup2
+#   define dup2 _dup2
+#  endif
+_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
+# else
+_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
+# endif
+_GL_CXXALIASWARN (dup2);
 #endif
 
 
@@ -565,40 +622,116 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
 #endif
 
 
+/* On native Windows, map 'execl' to '_execl', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execl always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execl
-# define execl _execl
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execl
+#  define execl _execl
+# endif
+_GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, ...));
+#else
+_GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
 #endif
+_GL_CXXALIASWARN (execl);
 
+/* On native Windows, map 'execle' to '_execle', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execle always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execle
-# define execle _execle
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execle
+#  define execle _execle
+# endif
+_GL_CXXALIAS_MDA (execle, intptr_t, (const char *program, const char *arg, ...));
+#else
+_GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
 #endif
+_GL_CXXALIASWARN (execle);
 
+/* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execlp always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execlp
-# define execlp _execlp
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execlp
+#  define execlp _execlp
+# endif
+_GL_CXXALIAS_MDA (execlp, intptr_t, (const char *program, const char *arg, ...));
+#else
+_GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
 #endif
+_GL_CXXALIASWARN (execlp);
 
 
+/* On native Windows, map 'execv' to '_execv', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execv always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execv
-# define execv _execv
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execv
+#  define execv _execv
+# endif
+_GL_CXXALIAS_MDA (execv, intptr_t,
+                  (const char *program, const char * const *argv));
+#else
+_GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
 #endif
+_GL_CXXALIASWARN (execv);
 
+/* On native Windows, map 'execve' to '_execve', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execve always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execve
-# define execve _execve
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execve
+#  define execve _execve
+# endif
+_GL_CXXALIAS_MDA (execve, intptr_t,
+                  (const char *program, const char * const *argv,
+                   const char * const *env));
+#else
+_GL_CXXALIAS_SYS (execve, int,
+                  (const char *program, char * const *argv, char * const *env));
 #endif
+_GL_CXXALIASWARN (execve);
 
+/* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execvp always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execvp
-# define execvp _execvp
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execvp
+#  define execvp _execvp
+# endif
+_GL_CXXALIAS_MDA (execvp, intptr_t,
+                  (const char *program, const char * const *argv));
+#else
+_GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
 #endif
+_GL_CXXALIASWARN (execvp);
 
+/* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have
+   it.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execvpe
-# define execvpe _execvpe
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execvpe
+#  define execvpe _execvpe
+# endif
+_GL_CXXALIAS_MDA (execvpe, intptr_t,
+                  (const char *program, const char * const *argv,
+                   const char * const *env));
+#else
+# if @HAVE_DECL_EXECVPE@
+_GL_CXXALIAS_SYS (execvpe, int,
+                  (const char *program, char * const *argv, char * const *env));
+# endif
+#endif
+#if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_EXECVPE@
+_GL_CXXALIASWARN (execvpe);
 #endif
 
 
@@ -795,9 +928,20 @@ _GL_CXXALIASWARN (getcwd);
 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
                  "use gnulib module getcwd for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef getcwd
-# define getcwd _getcwd
+#else
+/* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::getcwd always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getcwd
+#   define getcwd _getcwd
+#  endif
+_GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
+# else
+_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
+# endif
+_GL_CXXALIASWARN (getcwd);
 #endif
 
 
@@ -1132,10 +1276,19 @@ _GL_WARN_ON_USE (getpass, "getpass is unportable - "
 #endif
 
 
+/* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::getpid always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef getpid
-# define getpid _getpid
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef getpid
+#  define getpid _getpid
+# endif
+_GL_CXXALIAS_MDA (getpid, int, (void));
+#else
+_GL_CXXALIAS_SYS (getpid, pid_t, (void));
 #endif
+_GL_CXXALIASWARN (getpid);
 
 
 #if @GNULIB_GETUSERSHELL@
@@ -1226,9 +1379,20 @@ _GL_CXXALIASWARN (isatty);
 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
                  "use gnulib module isatty for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef isatty
-# define isatty _isatty
+#else
+/* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::isatty always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef isatty
+#   define isatty _isatty
+#  endif
+_GL_CXXALIAS_MDA (isatty, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (isatty, int, (int fd));
+# endif
+_GL_CXXALIASWARN (isatty);
 #endif
 
 
@@ -1356,9 +1520,20 @@ _GL_CXXALIASWARN (lseek);
 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
                  "systems - use gnulib module lseek for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef lseek
-# define lseek _lseek
+#else
+/* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::lseek always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef lseek
+#   define lseek _lseek
+#  endif
+_GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence));
+# else
+_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
+# endif
+_GL_CXXALIASWARN (lseek);
 #endif
 
 
@@ -1498,15 +1673,27 @@ _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
 #  endif
 _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
 # else
-/* Need to cast, because on mingw, the third parameter is
-                                                          unsigned int count
-   and the return type is 'int'.  */
-_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
+_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (read);
+#else
+/* On native Windows, map 'read' to '_read', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::read always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef read
+#   define read _read
+#  endif
+#  ifdef __MINGW32__
+_GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
+#  else
+_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
+#  endif
+# else
+_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
 # endif
 _GL_CXXALIASWARN (read);
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef read
-# define read _read
 #endif
 
 
@@ -1605,9 +1792,20 @@ _GL_CXXALIASWARN (rmdir);
 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
                  "use gnulib module rmdir for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef rmdir
-# define rmdir _rmdir
+#else
+/* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::rmdir always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rmdir
+#   define rmdir _rmdir
+#  endif
+_GL_CXXALIAS_MDA (rmdir, int, (char const *name));
+# else
+_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
+# endif
+_GL_CXXALIASWARN (rmdir);
 #endif
 
 
@@ -1666,10 +1864,19 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
 #endif
 
 
+/* On native Windows, map 'swab' to '_swab', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::creat always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef swab
-# define swab _swab
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef swab
+#  define swab _swab
+# endif
+_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n));
+#else
+_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
 #endif
+_GL_CXXALIASWARN (swab);
 
 
 #if @GNULIB_SYMLINK@
@@ -1812,9 +2019,20 @@ _GL_CXXALIASWARN (unlink);
 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
                  "use gnulib module unlink for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef unlink
-# define unlink _unlink
+#else
+/* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::unlink always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unlink
+#   define unlink _unlink
+#  endif
+_GL_CXXALIAS_MDA (unlink, int, (char const *file));
+# else
+_GL_CXXALIAS_SYS (unlink, int, (char const *file));
+# endif
+_GL_CXXALIASWARN (unlink);
 #endif
 
 
@@ -1893,15 +2111,27 @@ _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
 #  endif
 _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
 # else
-/* Need to cast, because on mingw, the third parameter is
-                                                             unsigned int count
-   and the return type is 'int'.  */
-_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
+_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (write);
+#else
+/* On native Windows, map 'write' to '_write', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::write always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef write
+#   define write _write
+#  endif
+#  ifdef __MINGW32__
+_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count));
+#  else
+_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count));
+#  endif
+# else
+_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
 # endif
 _GL_CXXALIASWARN (write);
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef write
-# define write _write
 #endif
 
 _GL_INLINE_HEADER_END
index 3eab701f57d975865c7e17cf5409658a222b7383..c8a96181a0436b0e9aa4ae2837ca78fe88e896ba 100644 (file)
@@ -85,9 +85,22 @@ _GL_WARN_ON_USE (utime,
                  "utime is unportable - "
                  "use gnulib module canonicalize-lgpl for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef utime
-# define utime _utime
+#else
+/* On native Windows, map 'utime' to '_utime', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::utime always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef utime
+#   define utime _utime
+#  endif
+_GL_CXXALIAS_MDA (utime, int, (const char *filename, const struct utimbuf *ts));
+# else
+_GL_CXXALIAS_SYS (utime, int, (const char *filename, const struct utimbuf *ts));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (utime);
+# endif
 #endif
 
 #if @GNULIB_UTIME@
index d09c2cb33c579dbe319c55ba849e8ec779b9cf14..9bc31b230e2767316b404952f707fe099e935050 100644 (file)
@@ -961,9 +961,25 @@ _GL_CXXALIASWARN (wcsdup);
 _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
                  "use gnulib module wcsdup for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef wcsdup
-# define wcsdup _wcsdup
+#else
+/* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::wcsdup always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcsdup
+#   define wcsdup _wcsdup
+#  endif
+_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
+# else
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+#  if @HAVE_DECL_WCSDUP@
+_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+#  endif
+# endif
+# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@
+_GL_CXXALIASWARN (wcsdup);
+# endif
 #endif
 
 
index 5f968bc26a5e71c7450f0e7a578577b63764dd22..6003a31b3822a14d6c717b43da15e70a26dd9679 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 50
+# stdio_h.m4 serial 51
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -109,6 +109,11 @@ AC_DEFUN([gl_STDIO_H],
     renameat snprintf tmpfile vdprintf vsnprintf])
 
   AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_DECLS_ONCE([fcloseall])
+  if test $ac_cv_have_decl_fcloseall = no; then
+    HAVE_DECL_FCLOSEALL=0
+  fi
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -176,6 +181,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   GNULIB_VSNPRINTF=0;            AC_SUBST([GNULIB_VSNPRINTF])
   GNULIB_VSPRINTF_POSIX=0;       AC_SUBST([GNULIB_VSPRINTF_POSIX])
   dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_DECL_FCLOSEALL=1;         AC_SUBST([HAVE_DECL_FCLOSEALL])
   HAVE_DECL_FPURGE=1;            AC_SUBST([HAVE_DECL_FPURGE])
   HAVE_DECL_FSEEKO=1;            AC_SUBST([HAVE_DECL_FSEEKO])
   HAVE_DECL_FTELLO=1;            AC_SUBST([HAVE_DECL_FTELLO])
index 7e81f3adcb11310dcc0005a8acd8f70fd6189ffe..8b3cfe3183d78b42a4dfbd4e9aeeadca3f523ac7 100644 (file)
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 51
+# stdlib_h.m4 serial 52
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -31,6 +31,19 @@ AC_DEFUN([gl_STDLIB_H],
     strtod strtold strtoll strtoull unlockpt unsetenv])
 
   AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_DECLS_ONCE([ecvt])
+  if test $ac_cv_have_decl_ecvt = no; then
+    HAVE_DECL_ECVT=0
+  fi
+  AC_CHECK_DECLS_ONCE([fcvt])
+  if test $ac_cv_have_decl_fcvt = no; then
+    HAVE_DECL_FCVT=0
+  fi
+  AC_CHECK_DECLS_ONCE([gcvt])
+  if test $ac_cv_have_decl_gcvt = no; then
+    HAVE_DECL_GCVT=0
+  fi
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -86,6 +99,9 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_ALIGNED_ALLOC=1;      AC_SUBST([HAVE_ALIGNED_ALLOC])
   HAVE_ATOLL=1;              AC_SUBST([HAVE_ATOLL])
   HAVE_CANONICALIZE_FILE_NAME=1;  AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
+  HAVE_DECL_ECVT=1;          AC_SUBST([HAVE_DECL_ECVT])
+  HAVE_DECL_FCVT=1;          AC_SUBST([HAVE_DECL_FCVT])
+  HAVE_DECL_GCVT=1;          AC_SUBST([HAVE_DECL_GCVT])
   HAVE_DECL_GETLOADAVG=1;    AC_SUBST([HAVE_DECL_GETLOADAVG])
   HAVE_GETSUBOPT=1;          AC_SUBST([HAVE_GETSUBOPT])
   HAVE_GRANTPT=1;            AC_SUBST([HAVE_GRANTPT])
index 07b9158195f3d1992e0f3e131bf37c6f97c284ee..b26d2c88dde0c07ce6a3798a8d00194d5b5d68b7 100644 (file)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 82
+# unistd_h.m4 serial 83
 dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -51,6 +51,11 @@ AC_DEFUN([gl_UNISTD_H],
     truncate ttyname_r unlink unlinkat usleep])
 
   AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_DECLS_ONCE([execvpe])
+  if test $ac_cv_have_decl_execvpe = no; then
+    HAVE_DECL_EXECVPE=0
+  fi
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -153,6 +158,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_UNLINKAT=1;        AC_SUBST([HAVE_UNLINKAT])
   HAVE_USLEEP=1;          AC_SUBST([HAVE_USLEEP])
   HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
+  HAVE_DECL_EXECVPE=1;    AC_SUBST([HAVE_DECL_EXECVPE])
   HAVE_DECL_FCHDIR=1;     AC_SUBST([HAVE_DECL_FCHDIR])
   HAVE_DECL_FDATASYNC=1;  AC_SUBST([HAVE_DECL_FDATASYNC])
   HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME])
index 08b7c86849b3c2f1ca8f8c4947fd879618f26eff..e0a4060018a89aa21136c2663133281fa149d956 100644 (file)
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar_h.m4 serial 47
+# wchar_h.m4 serial 48
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -60,6 +60,22 @@ AC_DEFUN([gl_WCHAR_H],
     ])
 
   AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_DECLS([wcsdup], [], [], [[
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+   <wchar.h>.
+   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+   included before <wchar.h>.  */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
+#include <wchar.h>
+    ]])
+  if test $ac_cv_have_decl_wcsdup = no; then
+    HAVE_DECL_WCSDUP=0
+  fi
 ])
 
 dnl Check whether <wchar.h> is usable at all.
@@ -232,6 +248,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   HAVE_WCSWIDTH=1;      AC_SUBST([HAVE_WCSWIDTH])
   HAVE_WCSFTIME=1;      AC_SUBST([HAVE_WCSFTIME])
   HAVE_DECL_WCTOB=1;    AC_SUBST([HAVE_DECL_WCTOB])
+  HAVE_DECL_WCSDUP=1;   AC_SUBST([HAVE_DECL_WCSDUP])
   HAVE_DECL_WCWIDTH=1;  AC_SUBST([HAVE_DECL_WCWIDTH])
   REPLACE_MBSTATE_T=0;  AC_SUBST([REPLACE_MBSTATE_T])
   REPLACE_BTOWC=0;      AC_SUBST([REPLACE_BTOWC])
index e953316a07f03f89e7660192f511d62457f7f98b..0805a9e1de9524e685f466f7f2b8c0f3af21835d 100644 (file)
@@ -85,7 +85,8 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \
              -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \
              < $(srcdir)/stdio.in.h | \
-         sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
+         sed -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \
+             -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
              -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \
              -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
index 032a2e66631aa55f73b7d976c26bf259b3e1b5ff..930c5db5a269247409bfd4347e981035877e83a1 100644 (file)
@@ -73,6 +73,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's|@''HAVE_ALIGNED_ALLOC''@|$(HAVE_ALIGNED_ALLOC)|g' \
              -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
              -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''HAVE_DECL_ECVT''@|$(HAVE_DECL_ECVT)|g' \
+             -e 's|@''HAVE_DECL_FCVT''@|$(HAVE_DECL_FCVT)|g' \
+             -e 's|@''HAVE_DECL_GCVT''@|$(HAVE_DECL_GCVT)|g' \
              -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
              -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
              -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
index 18b91c48c668eaed8007a483481eaa6bd9affd85..9af096397aa13b822a4c57f11357057200644d02 100644 (file)
@@ -126,6 +126,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
              -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
              -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
+             -e 's|@''HAVE_DECL_EXECVPE''@|$(HAVE_DECL_EXECVPE)|g' \
              -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \
              -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \
              -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \
index a028f65cfd5b20c546cc8881c04d9808e31fbad2..5151688131ff86eb9076acd65979484d6bef6d8a 100644 (file)
@@ -118,6 +118,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \
              -e 's|@''HAVE_WCSFTIME''@|$(HAVE_WCSFTIME)|g' \
              -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
+             -e 's|@''HAVE_DECL_WCSDUP''@|$(HAVE_DECL_WCSDUP)|g' \
              -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
          | \
          sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \