]> 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:55:01 +0000 (11:55 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 14:56:31 +0000 (15:56 +0100)
* lib/unistd.in.h (dup3): Consider REPLACE_DUP3. Disable
_GL_CXXALIASWARN invocation on non-glibc systems.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_DUP3.
* modules/unistd (Makefile.am): Substitute REPLACE_DUP3.
* m4/dup3.m4 (gl_FUNC_DUP3): Conditionally set REPLACE_DUP3.

ChangeLog
lib/unistd.in.h
m4/dup3.m4
m4/unistd_h.m4
modules/unistd

index 1cf4f77554724ce2451678f85aac522c5a8c10cf..22a28b2fd3f6d20bcd9f9f8247e035233086a1d6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
 
        Resolve conflicts for functions introduced in Android API level 21.
 
+       * lib/unistd.in.h (dup3): Consider REPLACE_DUP3. Disable
+       _GL_CXXALIASWARN invocation on non-glibc systems.
+       * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_DUP3.
+       * modules/unistd (Makefile.am): Substitute REPLACE_DUP3.
+       * m4/dup3.m4 (gl_FUNC_DUP3): Conditionally set REPLACE_DUP3.
+
        * 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.
index df095ba479210060e17a15efb6420e55133115ab..345b73945a2c8672fcac1b630aec7f1b595a5156 100644 (file)
@@ -541,17 +541,22 @@ _GL_CXXALIASWARN (dup2);
    Return newfd if successful, otherwise -1 and errno set.
    See the Linux man page at
    <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>.  */
-# if @HAVE_DUP3@
+# if @REPLACE_DUP3@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup3
 #   define dup3 rpl_dup3
 #  endif
 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
 # else
+#  if !@HAVE_DUP3@
 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
+#  endif
 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (dup3);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef dup3
 # if HAVE_RAW_DECL_DUP3
index 644a172006dea9583a417eb1a400f2418af6fb24..602222e9259e6b3af6fb9177baf4bc851e974558 100644 (file)
@@ -1,4 +1,4 @@
-# dup3.m4 serial 6
+# dup3.m4 serial 7
 dnl Copyright (C) 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,
@@ -15,6 +15,11 @@ AC_DEFUN([gl_FUNC_DUP3],
   gl_CHECK_FUNCS_ANDROID([dup3], [[#include <unistd.h>]])
   if test $ac_cv_func_dup3 != yes; then
     HAVE_DUP3=0
+    case "$gl_cv_onwards_func_dup3" in
+      future*) REPLACE_DUP3=1 ;;
+    esac
+  else
+    REPLACE_DUP3=1
   fi
 
 dnl Not needed yet, because dup3 is unconditionally replaced.
index c7ef46c26d563bbac825aaf3c3d297e7e40c2504..8fbd82b2b73a8b5520057d2fa99d8c180e6c60e3 100644 (file)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 91
+# unistd_h.m4 serial 92
 dnl Copyright (C) 2006-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,
@@ -225,6 +225,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_COPY_FILE_RANGE=0;         AC_SUBST([REPLACE_COPY_FILE_RANGE])
   REPLACE_DUP=0;                     AC_SUBST([REPLACE_DUP])
   REPLACE_DUP2=0;                    AC_SUBST([REPLACE_DUP2])
+  REPLACE_DUP3=0;                    AC_SUBST([REPLACE_DUP3])
   REPLACE_EXECL=0;                   AC_SUBST([REPLACE_EXECL])
   REPLACE_EXECLE=0;                  AC_SUBST([REPLACE_EXECLE])
   REPLACE_EXECLP=0;                  AC_SUBST([REPLACE_EXECLP])
index 80080ede9ef44b7235a2bb2f3d1e9c4689f02181..065e4ad52ea6f040a5847b0e0f076960882aaccc 100644 (file)
@@ -179,6 +179,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_COPY_FILE_RANGE''@|$(REPLACE_COPY_FILE_RANGE)|g' \
              -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
              -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
+             -e 's|@''REPLACE_DUP3''@|$(REPLACE_DUP3)|g' \
              -e 's|@''REPLACE_EXECL''@|$(REPLACE_EXECL)|g' \
              -e 's|@''REPLACE_EXECLE''@|$(REPLACE_EXECLE)|g' \
              -e 's|@''REPLACE_EXECLP''@|$(REPLACE_EXECLP)|g' \