Mercurial > hg > octave-lyh > gnulib-hg
changeset 13118:1bdb4545f2ef
sys_stat: Fix C++ test error on mingw.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 03 Apr 2010 12:55:17 +0200 |
parents | a071b99c37a8 |
children | 5fa4ec4a6e8b |
files | ChangeLog build-aux/c++defs.h lib/sys_stat.in.h |
diffstat | 3 files changed, 28 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-04-03 Bruno Haible <bruno@clisp.org> + + 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 <bruno@clisp.org> pty: Update doc.
--- 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<rettype(*)parameters>(::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
--- 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)