]> Savannah Git Hosting - gnulib.git/commitdiff
Resolve conflicts for functions introduced in Android API level 21.
authorBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 10:51:46 +0000 (11:51 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 14:56:29 +0000 (15:56 +0100)
* lib/string.in.h (stpcpy): Consider REPLACE_STPCPY. Disable
_GL_CXXALIASWARN invocation on non-glibc systems.
* m4/string_h.m4 (gl_STRING_H_DEFAULTS): Initialize REPLACE_STPCPY.
* modules/string (Makefile.am): Substitute REPLACE_STPCPY.
* m4/stpcpy.m4 (gl_FUNC_STPCPY): Conditionally set REPLACE_STPCPY.
* modules/stpcpy (configure.ac): Consider REPLACE_STPCPY.

ChangeLog
lib/string.in.h
m4/stpcpy.m4
m4/string_h.m4
modules/stpcpy
modules/string

index 80063baa0fe4c4628fd546d2c35cde06f17540c2..1cf4f77554724ce2451678f85aac522c5a8c10cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,13 @@
 
        Resolve conflicts for functions introduced in Android API level 21.
 
+       * lib/string.in.h (stpcpy): Consider REPLACE_STPCPY. Disable
+       _GL_CXXALIASWARN invocation on non-glibc systems.
+       * m4/string_h.m4 (gl_STRING_H_DEFAULTS): Initialize REPLACE_STPCPY.
+       * modules/string (Makefile.am): Substitute REPLACE_STPCPY.
+       * m4/stpcpy.m4 (gl_FUNC_STPCPY): Conditionally set REPLACE_STPCPY.
+       * modules/stpcpy (configure.ac): Consider REPLACE_STPCPY.
+
        * lib/stdlib.in.h (_Exit): Consider REPLACE__EXIT. Disable
        _GL_CXXALIASWARN invocation on non-glibc systems.
        (getprogname): Consider REPLACE_GETPROGNAME. Disable _GL_CXXALIASWARN
index b227a1788734f81ec342c2cf13c3db0fe16bb5a6..ffcc7e25c6be2cea64b00bbd9097a5770ad2cb31 100644 (file)
@@ -406,14 +406,28 @@ _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
 
 /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
 #if @GNULIB_STPCPY@
-# if ! @HAVE_STPCPY@
+# if @REPLACE_STPCPY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef stpcpy
+#   define stpcpy rpl_stpcpy
+#  endif
+_GL_FUNCDECL_RPL (stpcpy, char *,
+                  (char *restrict __dst, char const *restrict __src)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (stpcpy, char *,
+                  (char *restrict __dst, char const *restrict __src));
+# else
+#  if !@HAVE_STPCPY@
 _GL_FUNCDECL_SYS (stpcpy, char *,
                   (char *restrict __dst, char const *restrict __src)
                   _GL_ARG_NONNULL ((1, 2)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (stpcpy, char *,
                   (char *restrict __dst, char const *restrict __src));
+# endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (stpcpy);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpcpy
 # if HAVE_RAW_DECL_STPCPY
index 462f511d25dfbdc7145b41974ce79eb175d54c20..f3acbee7be96eadc8d4fb99daeb84b36caba92c3 100644 (file)
@@ -1,4 +1,4 @@
-# stpcpy.m4 serial 10
+# stpcpy.m4 serial 11
 dnl Copyright (C) 2002, 2007, 2009-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -16,6 +16,9 @@ AC_DEFUN([gl_FUNC_STPCPY],
   gl_CHECK_FUNCS_ANDROID([stpcpy], [[#include <string.h>]])
   if test $ac_cv_func_stpcpy = no; then
     HAVE_STPCPY=0
+    case "$gl_cv_onwards_func_stpcpy" in
+      future*) REPLACE_STPCPY=1 ;;
+    esac
   fi
 ])
 
index 5da3cc25291f86ef5b92b2b979e532eea3957434..132ed87d6abc0d01b58537e3dadcda249e224d45 100644 (file)
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 35
+# serial 36
 
 # Written by Paul Eggert.
 
@@ -131,6 +131,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
   REPLACE_FFSLL=0;              AC_SUBST([REPLACE_FFSLL])
   REPLACE_MEMCHR=0;             AC_SUBST([REPLACE_MEMCHR])
   REPLACE_MEMMEM=0;             AC_SUBST([REPLACE_MEMMEM])
+  REPLACE_STPCPY=0;             AC_SUBST([REPLACE_STPCPY])
   REPLACE_STPNCPY=0;            AC_SUBST([REPLACE_STPNCPY])
   REPLACE_STRCHRNUL=0;          AC_SUBST([REPLACE_STRCHRNUL])
   REPLACE_STRDUP=0;             AC_SUBST([REPLACE_STRDUP])
index a4aac236a2bc443579efd962809c76d1ea4e9ec1..66c481d691b1d9618e37a8b96bf1f54b4e30a688 100644 (file)
@@ -11,7 +11,8 @@ string
 
 configure.ac:
 gl_FUNC_STPCPY
-gl_CONDITIONAL([GL_COND_OBJ_STPCPY], [test $HAVE_STPCPY = 0])
+gl_CONDITIONAL([GL_COND_OBJ_STPCPY],
+               [test $HAVE_STPCPY = 0 || test $REPLACE_STPCPY = 1])
 AM_COND_IF([GL_COND_OBJ_STPCPY], [
   gl_PREREQ_STPCPY
 ])
index 70bf2b869f34fe8dfd4a376ce2e2329b6c5621e4..03a1b0547c0e77743f36494c31e3516e18d2c236 100644 (file)
@@ -109,6 +109,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
              -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
              -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \
+             -e 's|@''REPLACE_STPCPY''@|$(REPLACE_STPCPY)|g' \
              -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \
              -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \
              -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \