From c7ddffce1ea4383928922b3bfb4f1c022f3158ce Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 4 Sep 2010 13:40:30 +0200 Subject: [PATCH] strdup: Fix compilation error in C++ mode. * lib/string.in.h (strdup): In C++ mode with GNULIB_NAMESPACE, undefine the macro. --- ChangeLog | 6 ++++++ lib/string.in.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0d0d9f0c81..1755e4d5d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-09-04 Bruno Haible + + strdup: Fix compilation error in C++ mode. + * lib/string.in.h (strdup): In C++ mode with GNULIB_NAMESPACE, undefine + the macro. + 2010-09-04 Bruno Haible dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX. diff --git a/lib/string.in.h b/lib/string.in.h index bb6aa58e2f..db4c4aa645 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -311,6 +311,10 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); # else +# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup + /* strdup exists as a function and as a macro. Get rid of the macro. */ +# undef strdup +# endif # if !(@HAVE_DECL_STRDUP@ || defined strdup) _GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); # endif -- 2.30.2