# HG changeset patch # User Bruno Haible # Date 1270292117 -7200 # Node ID 1bdb4545f2efffb37023a0c0be7f9b6e1580d8ff # Parent a071b99c37a8d844727f4997454e9836cf4ffd85 sys_stat: Fix C++ test error on mingw. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +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. diff --git a/build-aux/c++defs.h b/build-aux/c++defs.h --- 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 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -390,7 +390,10 @@ # 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)