strdup: Fix compilation error in C++ mode.
authorBruno Haible <bruno@clisp.org>
Sat, 4 Sep 2010 11:40:30 +0000 (13:40 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 4 Sep 2010 11:40:30 +0000 (13:40 +0200)
* lib/string.in.h (strdup): In C++ mode with GNULIB_NAMESPACE, undefine
the macro.

ChangeLog
lib/string.in.h

index 0d0d9f0c81964f69b9ef30d72194ba605e9cd44c..1755e4d5d311b096910a09babe1aa2114915869f 100644 (file)
--- 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.
index bb6aa58e2f9053ec02a178033db84a1f807c1be1..db4c4aa645850fd70cc75d8f41c1f39808ffe700 100644 (file)
@@ -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