From 759d93d57c95166a956ec9589cc5ca906e1a1766 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 3 Apr 2010 12:55:17 +0200 Subject: [PATCH] sys_stat: Fix C++ test error on mingw. --- ChangeLog | 6 ++++++ build-aux/c++defs.h | 18 ++++++++++++++++++ lib/sys_stat.in.h | 5 ++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 26a5c552b..14470638d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-04-03 Bruno Haible + sys_stat: Fix C++ test error on mingw. + * build-aux/c++defs.h (_GL_CXXALIAS_RPL_CAST_1): New macro. + * lib/sys_stat.in.h (lchmod): Use it instead of _GL_CXXALIAS_RPL_1. + +2010-04-03 Bruno Haible + pty: Update doc. * doc/glibc-headers/pty.texi: Mention changes done since 2010-03-18. diff --git a/build-aux/c++defs.h b/build-aux/c++defs.h index 7fbdd9636..590e65ace 100644 --- a/build-aux/c++defs.h +++ b/build-aux/c++defs.h @@ -126,6 +126,24 @@ _GL_EXTERN_C int _gl_cxxalias_dummy #endif +/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); + is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); + except that the C function rpl_func may have a slightly different + declaration. A cast is used to silence the "invalid conversion" error + that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + rettype (*const func) parameters = \ + reinterpret_cast(::rpl_func); \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + /* _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 diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 89724c397..82792e452 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -390,7 +390,10 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lchmod chmod # endif -_GL_CXXALIAS_RPL_1 (lchmod, chmod, int, (const char *filename, mode_t mode)); +/* Need to cast, because on mingw, the second parameter of chmod is + int mode. */ +_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int, + (const char *filename, mode_t mode)); # else # if 0 /* assume already declared */ _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) -- 2.11.0