Hi Simon, > Building in cygwin fails because: > > depbase=`echo test-fcntl-h-c++.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ > g++ -DHAVE_CONFIG_H -I. -I. -I. -I.. -I./.. -I../gllib -I./../gllib > -MT test-fcntl-h-c++.o -MD -MP -MF $depbase.Tpo -c -o test-fcntl-h-c++.o > test-fcntl-h-c++.cc &&\ > mv -f $depbase.Tpo $depbase.Po > In file included from ../gllib/fcntl.h:41, > from test-fcntl-h-c++.cc:22: > ../gllib/sys/stat.h:668: error: ‘lchmod’ was not declared in this scope > ../gllib/sys/stat.h:668: error: invalid type in declaration before ‘;’ > token > make[3]: *** [test-fcntl-h-c++.o] Error 1
The problem is that we try to attach a warning attribute to a function that is not declared. This is in the case (defined __cplusplus && defined GNULIB_NAMESPACE). In the opposite case, we do a #define lchmod chmod, and in this case there is also a bug: we are attaching the warning attribute to the 'chmod' function. Fixed as follows: 2010-03-27 Bruno Haible <br...@clisp.org> Fix a compilation error on Cygwin with g++ >= 4.3. * lib/sys_stat.in.h (lchmod): Don't warn about the use of this function if it is undefined or if we alias it to chmod. (lstat): Don't warn about the use of this function if it is undefined or if we alias it to stat. Reported by Simon Josefsson. --- lib/sys_stat.in.h.orig Sat Mar 27 14:28:06 2010 +++ lib/sys_stat.in.h Sat Mar 27 14:24:25 2010 @@ -398,7 +398,9 @@ # endif _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); # endif +# if @HAVE_LCHMOD@ _GL_CXXALIASWARN (lchmod); +# endif #elif defined GNULIB_POSIXCHECK # undef lchmod # if HAVE_RAW_DECL_LCHMOD @@ -427,7 +429,9 @@ # else _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); # endif +# if @HAVE_LSTAT@ _GL_CXXALIASWARN (lstat); +# endif #elif defined GNULIB_POSIXCHECK # undef lstat # if HAVE_RAW_DECL_LSTAT