From efd13f2f20f8fbd178fd5dff28b5f31219ea0538 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 22 Jan 2023 14:41:07 +0100 Subject: [PATCH 42/47] Resolve conflicts for functions introduced in Android API level 28. * m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): Conditionally set REPLACE_POSIX_SPAWN. * lib/spawn.in.h: Adapt logic for defining the POSIX_SPAWN_* constants. (posix_spawn, posix_spawnp, posix_spawnattr_init, posix_spawnattr_destroy, posix_spawnattr_getsigdefault, posix_spawnattr_setsigdefault, posix_spawnattr_getsigmask, posix_spawnattr_setsigmask, posix_spawnattr_getflags, posix_spawnattr_setflags, posix_spawnattr_getpgroup, posix_spawnattr_setpgroup, posix_spawn_file_actions_init, posix_spawn_file_actions_destroy, posix_spawn_file_actions_addchdir, posix_spawn_file_actions_addfchdir): Disable _GL_CXXALIASWARN invocation on non-glibc systems. --- ChangeLog | 13 ++++++++++ lib/spawn.in.h | 64 +++++++++++++++++++++++++++++++++++++------------- m4/spawn_h.m4 | 5 +++- 3 files changed, 65 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 152b3399fa..5d85124904 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,19 @@ Resolve conflicts for functions introduced in Android API level 28. + * m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): Conditionally set + REPLACE_POSIX_SPAWN. + * lib/spawn.in.h: Adapt logic for defining the POSIX_SPAWN_* constants. + (posix_spawn, posix_spawnp, posix_spawnattr_init, + posix_spawnattr_destroy, posix_spawnattr_getsigdefault, + posix_spawnattr_setsigdefault, posix_spawnattr_getsigmask, + posix_spawnattr_setsigmask, posix_spawnattr_getflags, + posix_spawnattr_setflags, posix_spawnattr_getpgroup, + posix_spawnattr_setpgroup, posix_spawn_file_actions_init, + posix_spawn_file_actions_destroy, posix_spawn_file_actions_addchdir, + posix_spawn_file_actions_addfchdir): Disable _GL_CXXALIASWARN invocation + on non-glibc systems. + * m4/glob.m4 (gl_GLOB): Conditionally set REPLACE_GLOB. * lib/glob.in.h (glob): Disable _GL_CXXALIASWARN invocation on non-glibc systems. diff --git a/lib/spawn.in.h b/lib/spawn.in.h index 38cdf09912..958464a7d2 100644 --- a/lib/spawn.in.h +++ b/lib/spawn.in.h @@ -144,26 +144,26 @@ typedef struct /* Flags to be set in the 'posix_spawnattr_t'. */ #if @HAVE_POSIX_SPAWN@ +# if !@REPLACE_POSIX_SPAWN@ /* Use the values from the system, but provide the missing ones. */ -# ifndef POSIX_SPAWN_SETSCHEDPARAM -# define POSIX_SPAWN_SETSCHEDPARAM 0 -# endif -# ifndef POSIX_SPAWN_SETSCHEDULER -# define POSIX_SPAWN_SETSCHEDULER 0 -# endif -#else -# if @REPLACE_POSIX_SPAWN@ +# ifndef POSIX_SPAWN_SETSCHEDPARAM +# define POSIX_SPAWN_SETSCHEDPARAM 0 +# endif +# ifndef POSIX_SPAWN_SETSCHEDULER +# define POSIX_SPAWN_SETSCHEDULER 0 +# endif +# else /* @REPLACE_POSIX_SPAWN@ */ /* Use the values from the system, for better compatibility. */ /* But this implementation does not support AIX extensions. */ -# undef POSIX_SPAWN_FORK_HANDLERS -# else -# define POSIX_SPAWN_RESETIDS 0x01 -# define POSIX_SPAWN_SETPGROUP 0x02 -# define POSIX_SPAWN_SETSIGDEF 0x04 -# define POSIX_SPAWN_SETSIGMASK 0x08 -# define POSIX_SPAWN_SETSCHEDPARAM 0x10 -# define POSIX_SPAWN_SETSCHEDULER 0x20 +# undef POSIX_SPAWN_FORK_HANDLERS # endif +#else /* !@HAVE_POSIX_SPAWN@ */ +# define POSIX_SPAWN_RESETIDS 0x01 +# define POSIX_SPAWN_SETPGROUP 0x02 +# define POSIX_SPAWN_SETSIGDEF 0x04 +# define POSIX_SPAWN_SETSIGMASK 0x08 +# define POSIX_SPAWN_SETSCHEDPARAM 0x10 +# define POSIX_SPAWN_SETSCHEDULER 0x20 #endif /* A GNU extension. Use the next free bit position. */ #ifndef POSIX_SPAWN_USEVFORK @@ -234,7 +234,9 @@ _GL_CXXALIAS_SYS (posix_spawn, int, char *const argv[_Restrict_arr_], char *const envp[_Restrict_arr_])); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawn); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawn # if HAVE_RAW_DECL_POSIX_SPAWN @@ -278,7 +280,9 @@ _GL_CXXALIAS_SYS (posix_spawnp, int, const posix_spawnattr_t *__attrp, char *const argv[], char *const envp[])); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnp); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnp # if HAVE_RAW_DECL_POSIX_SPAWNP @@ -304,7 +308,9 @@ _GL_FUNCDECL_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr) # endif _GL_CXXALIAS_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_init); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_init # if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT @@ -329,7 +335,9 @@ _GL_FUNCDECL_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr) # endif _GL_CXXALIAS_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_destroy); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_destroy # if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY @@ -364,7 +372,9 @@ _GL_CXXALIAS_SYS (posix_spawnattr_getsigdefault, int, (const posix_spawnattr_t *_Restrict_ __attr, sigset_t *_Restrict_ __sigdefault)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_getsigdefault); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_getsigdefault # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT @@ -398,7 +408,9 @@ _GL_CXXALIAS_SYS (posix_spawnattr_setsigdefault, int, (posix_spawnattr_t *_Restrict_ __attr, const sigset_t *_Restrict_ __sigdefault)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_setsigdefault); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_setsigdefault # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT @@ -432,7 +444,9 @@ _GL_CXXALIAS_SYS (posix_spawnattr_getsigmask, int, (const posix_spawnattr_t *_Restrict_ __attr, sigset_t *_Restrict_ __sigmask)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_getsigmask); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_getsigmask # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK @@ -466,7 +480,9 @@ _GL_CXXALIAS_SYS (posix_spawnattr_setsigmask, int, (posix_spawnattr_t *_Restrict_ __attr, const sigset_t *_Restrict_ __sigmask)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_setsigmask); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_setsigmask # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK @@ -500,7 +516,9 @@ _GL_CXXALIAS_SYS (posix_spawnattr_getflags, int, (const posix_spawnattr_t *_Restrict_ __attr, short int *_Restrict_ __flags)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_getflags); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_getflags # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS @@ -530,7 +548,9 @@ _GL_FUNCDECL_SYS (posix_spawnattr_setflags, int, _GL_CXXALIAS_SYS (posix_spawnattr_setflags, int, (posix_spawnattr_t *__attr, short int __flags)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_setflags); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_setflags # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS @@ -564,7 +584,9 @@ _GL_CXXALIAS_SYS (posix_spawnattr_getpgroup, int, (const posix_spawnattr_t *_Restrict_ __attr, pid_t *_Restrict_ __pgroup)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_getpgroup); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_getpgroup # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP @@ -594,7 +616,9 @@ _GL_FUNCDECL_SYS (posix_spawnattr_setpgroup, int, _GL_CXXALIAS_SYS (posix_spawnattr_setpgroup, int, (posix_spawnattr_t *__attr, pid_t __pgroup)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_setpgroup); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_setpgroup # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP @@ -765,7 +789,9 @@ _GL_FUNCDECL_SYS (posix_spawn_file_actions_init, int, _GL_CXXALIAS_SYS (posix_spawn_file_actions_init, int, (posix_spawn_file_actions_t *__file_actions)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawn_file_actions_init); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawn_file_actions_init # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT @@ -795,7 +821,9 @@ _GL_FUNCDECL_SYS (posix_spawn_file_actions_destroy, int, _GL_CXXALIAS_SYS (posix_spawn_file_actions_destroy, int, (posix_spawn_file_actions_t *__file_actions)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawn_file_actions_destroy); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawn_file_actions_destroy # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY @@ -941,7 +969,9 @@ _GL_CXXALIAS_SYS (posix_spawn_file_actions_addchdir, int, (posix_spawn_file_actions_t *_Restrict_ __file_actions, const char *_Restrict_ __path)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawn_file_actions_addchdir); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawn_file_actions_addchdir # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR @@ -976,7 +1006,9 @@ _GL_CXXALIAS_SYS (posix_spawn_file_actions_addfchdir, int, (posix_spawn_file_actions_t *_Restrict_ __file_actions, int __fd)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawn_file_actions_addfchdir); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawn_file_actions_addfchdir # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4 index 3bee0f7be4..b7b9a61342 100644 --- a/m4/spawn_h.m4 +++ b/m4/spawn_h.m4 @@ -1,4 +1,4 @@ -# spawn_h.m4 serial 23 +# spawn_h.m4 serial 24 dnl Copyright (C) 2008-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, @@ -79,6 +79,9 @@ AC_DEFUN([gl_HAVE_POSIX_SPAWN], if test $ac_cv_func_posix_spawn != yes; then HAVE_POSIX_SPAWN=0 + case "$gl_cv_onwards_func_posix_spawn" in + future*) REPLACE_POSIX_SPAWN=1 ;; + esac fi ]) -- 2.34.1