[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lchmod on mingw
From: |
Bruno Haible |
Subject: |
lchmod on mingw |
Date: |
Sat, 3 Apr 2010 11:56:08 +0100 |
User-agent: |
KMail/1.9.9 |
On mingw, the C++ tests give this error:
../gllib/sys/stat.h:659: error: invalid conversion from `int (*)(const char*,
int)' to `int (*)(const char*, mode_t)'
The reason is that the 'chmod' function in mingw has an 'int' as second
argument type. This fixes it:
2010-04-03 Bruno Haible <address@hidden>
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.
--- build-aux/c++defs.h.orig Sat Apr 3 12:51:48 2010
+++ build-aux/c++defs.h Sat Apr 3 12:50:14 2010
@@ -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
--- lib/sys_stat.in.h.orig Sat Apr 3 12:51:48 2010
+++ lib/sys_stat.in.h Sat Apr 3 12:51:42 2010
@@ -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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- lchmod on mingw,
Bruno Haible <=