changeset 13628:b8b731ae72a8

strdup: Fix compilation error in C++ mode. * lib/string.in.h (strdup): In C++ mode with GNULIB_NAMESPACE, undefine the macro.
author Bruno Haible <bruno@clisp.org>
date Sat, 04 Sep 2010 13:40:30 +0200
parents d268b353aecf
children 978ed1b129fb
files ChangeLog lib/string.in.h
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-09-04  Bruno Haible  <bruno@clisp.org>
+
+	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  <bruno@clisp.org>
 
 	dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX.
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -311,6 +311,10 @@
 _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