From: Bruno Haible Date: Sat, 4 Sep 2010 11:35:19 +0000 (+0200) Subject: dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX. X-Git-Tag: v0.1~3860 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;ds=sidebyside;h=a16c31d99cfb6eedd8d96e614a0cf8468145d5d3;p=gnulib.git dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX. * lib/dirent.in.h (dirfd): In C++ mode with GNULIB_NAMESPACE, turn the macro into a function. Reported by Jarno Rajahalme . --- diff --git a/ChangeLog b/ChangeLog index 3f55b0b0d..0d0d9f0c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2010-09-04 Bruno Haible + dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX. + * lib/dirent.in.h (dirfd): In C++ mode with GNULIB_NAMESPACE, turn the + macro into a function. + Reported by Jarno Rajahalme . + +2010-09-04 Bruno Haible + Set PATH_SEPARATOR the same way autoconf does. * build-aux/relocatable.sh.in (func_find_curr_installdir): Determine the value of PATH_SEPARATOR the same way autoconf-generated configure diff --git a/lib/dirent.in.h b/lib/dirent.in.h index 8414f2636..afcad9c7a 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -60,6 +60,12 @@ _GL_CXXALIASWARN (closedir); _GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (dirfd, int, (DIR *)); # else +# if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd + /* dirfd is defined as a macro and not as a function. + Turn it into a function and get rid of the macro. */ +static inline int (dirfd) (DIR *dp) { return dirfd (dp); } +# undef dirfd +# endif # if !(@HAVE_DECL_DIRFD@ || defined dirfd) _GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); # endif