summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-01-27 16:20:03 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2019-01-27 16:20:40 -0800
commitd81aa8516ef6df79d6d602d4f732d8a65bf1677c (patch)
treec384271af4f60e82ab204d020e7e6e3367e87877 /lib
parentcc1c46e4122a08657a7c75495115d1c60efb1b31 (diff)
downloademacs-d81aa8516ef6df79d6d602d4f732d8a65bf1677c.tar.gz
Update from Gnulib
This incorporates: 2019-01-26 getloadavg: Add support for Android 2019-01-24 fchownat: Fix compilation error on Android 4.3 2019-01-24 mbtowc: Fix compilation error on Android 4.3 2019-01-24 random: Fix compilation error on Android 4.3 2019-01-24 renameat: Fix compilation error on Android 4.3 2019-01-24 unlinkat: Fix compilation error on Android 4.3 2019-01-19 gettext: support disabling use of VLAs 2019-01-17 sys_stat: Fix warning on OS/2 kLIBC 2019-01-17 fcntl: Fix syntax error (regression from 2018-10-05) 2019-01-10 verify: Enable _GL_HAVE_STATIC_ASSERT for recent G++ 2018-12-22 stdioext: port to newer 32-bit Android 2018-12-16 libc-config: Support HP-UX cc in C99 mode. * build-aux/config.guess, build-aux/config.sub, doc/misc/texinfo.tex: * lib/cdefs.h, lib/fcntl.c, lib/getloadavg.c, lib/gettext.h: * lib/regexec.c, lib/stdio-impl.h, lib/stdio.in.h, lib/stdlib.in.h: * lib/sys_stat.in.h, lib/unistd.in.h, lib/verify.h, m4/stdlib_h.m4: Copy from Gnulib. * lib/gnulib.mk.in: Regenerate.
Diffstat (limited to 'lib')
-rw-r--r--lib/cdefs.h2
-rw-r--r--lib/fcntl.c2
-rw-r--r--lib/getloadavg.c21
-rw-r--r--lib/gettext.h13
-rw-r--r--lib/gnulib.mk.in15
-rw-r--r--lib/regexec.c2
-rw-r--r--lib/stdio-impl.h9
-rw-r--r--lib/stdio.in.h7
-rw-r--r--lib/stdlib.in.h68
-rw-r--r--lib/sys_stat.in.h9
-rw-r--r--lib/unistd.in.h13
-rw-r--r--lib/verify.h6
12 files changed, 131 insertions, 36 deletions
diff --git a/lib/cdefs.h b/lib/cdefs.h
index f7a10644064..96d26164199 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -340,7 +340,7 @@
semantics.
clang++ identifies itself as gcc-4.2, but has support for GNU inlining
- semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and
+ semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
__GNUC_GNU_INLINE__ macro definitions. */
#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \
|| (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
diff --git a/lib/fcntl.c b/lib/fcntl.c
index f602fad6285..51f62ef78a8 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -545,7 +545,7 @@ rpl_fcntl_DUPFD_CLOEXEC (int fd, int target)
#ifdef __KLIBC__
static int
-klibc_fcntl (int fd, int action, /* arg */...);
+klibc_fcntl (int fd, int action, /* arg */...)
{
va_list arg_ptr;
int arg;
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index 0ed697f57cb..353664777fb 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -47,8 +47,8 @@
N_NAME_POINTER The nlist n_name element is a pointer,
not an array.
HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'.
- LINUX_LDAV_FILE [__linux__, __CYGWIN__]: File containing
- load averages.
+ LINUX_LDAV_FILE [__linux__, __ANDROID__, __CYGWIN__]: File
+ containing load averages.
Specific system predefines this file uses, aside from setting
default values if not emacs:
@@ -65,7 +65,7 @@
UMAX4_3
VMS
_WIN32 Native Windows (possibly also defined on Cygwin)
- __linux__ Linux: assumes /proc file system mounted.
+ __linux__, __ANDROID__ Linux: assumes /proc file system mounted.
Support from Michael K. Johnson.
__CYGWIN__ Cygwin emulates linux /proc/loadavg.
__NetBSD__ NetBSD: assumes /kern file system mounted.
@@ -263,7 +263,7 @@
# ifdef LOAD_AVE_TYPE
# ifndef __VMS
-# ifndef __linux__
+# if !(defined __linux__ || defined __ANDROID__)
# ifndef NLIST_STRUCT
# include <a.out.h>
# else /* NLIST_STRUCT */
@@ -286,7 +286,7 @@
# ifndef LDAV_SYMBOL
# define LDAV_SYMBOL "_avenrun"
# endif /* LDAV_SYMBOL */
-# endif /* __linux__ */
+# endif /* __linux__ || __ANDROID__ */
# else /* __VMS */
@@ -359,7 +359,8 @@
# include <sys/dg_sys_info.h>
# endif
-# if (defined __linux__ || defined __CYGWIN__ || defined SUNOS_5 \
+# if (defined __linux__ || defined __ANDROID__ \
+ || defined __CYGWIN__ || defined SUNOS_5 \
|| (defined LOAD_AVE_TYPE && ! defined __VMS))
# include <fcntl.h>
# endif
@@ -388,7 +389,7 @@ static bool getloadavg_initialized;
/* Offset in kmem to seek to read load average, or 0 means invalid. */
static long offset;
-# if ! defined __VMS && ! defined sgi && ! defined __linux__
+# if ! defined __VMS && ! defined sgi && ! (defined __linux__ || defined __ANDROID__)
static struct nlist name_list[2];
# endif
@@ -498,8 +499,8 @@ getloadavg (double loadavg[], int nelem)
}
# endif
-# if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__))
- /* Linux without glibc, Cygwin */
+# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__)
+ /* Linux without glibc, Android, Cygwin */
# define LDAV_DONE
# undef LOAD_AVE_TYPE
@@ -554,7 +555,7 @@ getloadavg (double loadavg[], int nelem)
return elem;
-# endif /* __linux__ || __CYGWIN__ */
+# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */
# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */
# define LDAV_DONE
diff --git a/lib/gettext.h b/lib/gettext.h
index 89f53d917bb..c7c0fdb5311 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -184,9 +184,16 @@ npgettext_aux (const char *domain,
#include <string.h>
-#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
- /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc)
- || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )
+/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported.
+ This relates to the -Wvla and -Wvla-larger-than warnings, enabled in
+ the default GCC many warnings set. This allows programs to disable use
+ of VLAs, which may be unintended, or may be awkward to support portably,
+ or may have security implications due to non-deterministic stack usage. */
+
+#if (!defined GNULIB_NO_VLA \
+ && (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
+ /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc)
+ || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ))
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
#else
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 9666cd4e3e8..fdf45d61c4c 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -197,6 +197,7 @@ DBUS_OBJ = @DBUS_OBJ@
DEFS = @DEFS@
DESLIB = @DESLIB@
DOCMISC_W32 = @DOCMISC_W32@
+DUMPING = @DUMPING@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -556,6 +557,7 @@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
HAVE_GRANTPT = @HAVE_GRANTPT@
HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@
+HAVE_INITSTATE = @HAVE_INITSTATE@
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
HAVE_LCHMOD = @HAVE_LCHMOD@
HAVE_LCHOWN = @HAVE_LCHOWN@
@@ -566,6 +568,7 @@ HAVE_LSTAT = @HAVE_LSTAT@
HAVE_MAKEINFO = @HAVE_MAKEINFO@
HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
HAVE_MBSLEN = @HAVE_MBSLEN@
+HAVE_MBTOWC = @HAVE_MBTOWC@
HAVE_MEMCHR = @HAVE_MEMCHR@
HAVE_MEMPCPY = @HAVE_MEMPCPY@
HAVE_MKDIRAT = @HAVE_MKDIRAT@
@@ -613,6 +616,7 @@ HAVE_SCANDIR = @HAVE_SCANDIR@
HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@
HAVE_SETENV = @HAVE_SETENV@
HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@
+HAVE_SETSTATE = @HAVE_SETSTATE@
HAVE_SIGACTION = @HAVE_SIGACTION@
HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@
HAVE_SIGINFO_T = @HAVE_SIGINFO_T@
@@ -859,6 +863,7 @@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
REPLACE_GETPASS = @REPLACE_GETPASS@
REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
REPLACE_GMTIME = @REPLACE_GMTIME@
+REPLACE_INITSTATE = @REPLACE_INITSTATE@
REPLACE_ISATTY = @REPLACE_ISATTY@
REPLACE_LCHOWN = @REPLACE_LCHOWN@
REPLACE_LINK = @REPLACE_LINK@
@@ -894,6 +899,7 @@ REPLACE_PUTENV = @REPLACE_PUTENV@
REPLACE_PWRITE = @REPLACE_PWRITE@
REPLACE_QSORT_R = @REPLACE_QSORT_R@
REPLACE_RAISE = @REPLACE_RAISE@
+REPLACE_RANDOM = @REPLACE_RANDOM@
REPLACE_RANDOM_R = @REPLACE_RANDOM_R@
REPLACE_READ = @REPLACE_READ@
REPLACE_READLINK = @REPLACE_READLINK@
@@ -906,6 +912,7 @@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@
REPLACE_RMDIR = @REPLACE_RMDIR@
REPLACE_SELECT = @REPLACE_SELECT@
REPLACE_SETENV = @REPLACE_SETENV@
+REPLACE_SETSTATE = @REPLACE_SETSTATE@
REPLACE_SLEEP = @REPLACE_SLEEP@
REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
REPLACE_SPRINTF = @REPLACE_SPRINTF@
@@ -952,7 +959,6 @@ REPLACE_WRITE = @REPLACE_WRITE@
RSVG_CFLAGS = @RSVG_CFLAGS@
RSVG_LIBS = @RSVG_LIBS@
SEPCHAR = @SEPCHAR@
-SETFATTR = @SETFATTR@
SETTINGS_CFLAGS = @SETTINGS_CFLAGS@
SETTINGS_LIBS = @SETTINGS_LIBS@
SHELL = @SHELL@
@@ -1009,6 +1015,7 @@ XMKMF = @XMKMF@
XOBJ = @XOBJ@
XRANDR_CFLAGS = @XRANDR_CFLAGS@
XRANDR_LIBS = @XRANDR_LIBS@
+XRENDER_LIBS = @XRENDER_LIBS@
XWIDGETS_OBJ = @XWIDGETS_OBJ@
X_TOOLKIT_TYPE = @X_TOOLKIT_TYPE@
ac_ct_CC = @ac_ct_CC@
@@ -2552,7 +2559,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
+ -e 's|@''HAVE_INITSTATE''@|$(HAVE_INITSTATE)|g' \
-e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \
+ -e 's|@''HAVE_MBTOWC''@|$(HAVE_MBTOWC)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
-e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
@@ -2570,6 +2579,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
-e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \
-e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
+ -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \
-e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \
-e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
-e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
@@ -2580,6 +2590,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
-e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
-e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
+ -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \
-e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
-e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
@@ -2587,10 +2598,12 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \
+ -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \
-e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
-e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
-e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
+ -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \
-e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
-e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
diff --git a/lib/regexec.c b/lib/regexec.c
index 21cf7915f7c..2f7cb5dcb1f 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -2207,7 +2207,7 @@ sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx,
dfa->nexts[node_idx]))
/* The node can't accept the "multi byte", or the
destination was already thrown away, then the node
- could't accept the current input "multi byte". */
+ couldn't accept the current input "multi byte". */
naccepted = 0;
/* Otherwise, it is sure that the node could accept
'naccepted' bytes input. */
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index b2b2971f2ff..4260468b612 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -61,6 +61,11 @@
# define _r pub._r
# define _w pub._w
# elif defined __ANDROID__ /* Android */
+# ifdef __LP64__
+# define _gl_flags_file_t int
+# else
+# define _gl_flags_file_t short
+# endif
/* Up to this commit from 2015-10-12
<https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a>
the innards of FILE were public, and fp_ub could be defined like for OpenBSD,
@@ -70,8 +75,8 @@
# define fp_ ((struct { unsigned char *_p; \
int _r; \
int _w; \
- int _flags; \
- int _file; \
+ _gl_flags_file_t _flags; \
+ _gl_flags_file_t _file; \
struct { unsigned char *_base; size_t _size; } _bf; \
int _lbfsize; \
void *_cookie; \
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index acf29c4be09..4a8aa55528b 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -118,6 +118,13 @@
# include <unistd.h>
#endif
+/* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */
+/* But in any case avoid namespace pollution on glibc systems. */
+#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
+ && ! defined __GLIBC__
+# include <sys/stat.h>
+#endif
+
/* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include
it before we #define perror rpl_perror. */
/* But in any case avoid namespace pollution on glibc systems. */
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index d80d7ec6b05..be8ab3b86c2 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -306,9 +306,18 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
# else
+# if !@HAVE_MBTOWC@
+_GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+# endif
_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
# endif
_GL_CXXALIASWARN (mbtowc);
+#elif defined GNULIB_POSIXCHECK
+# undef mbtowc
+# if HAVE_RAW_DECL_MBTOWC
+_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
+ "use gnulib module mbtowc for portability");
+# endif
#endif
#if @GNULIB_MKDTEMP@
@@ -573,10 +582,19 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
+# if @REPLACE_RANDOM@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef random
+# define random rpl_random
+# endif
+_GL_FUNCDECL_RPL (random, long, (void));
+_GL_CXXALIAS_RPL (random, long, (void));
+# else
+# if !@HAVE_RANDOM@
_GL_FUNCDECL_SYS (random, long, (void));
-# endif
+# endif
_GL_CXXALIAS_SYS (random, long, (void));
+# endif
_GL_CXXALIASWARN (random);
#elif defined GNULIB_POSIXCHECK
# undef random
@@ -587,10 +605,19 @@ _GL_WARN_ON_USE (random, "random is unportable - "
#endif
#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
+# if @REPLACE_RANDOM@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef srandom
+# define srandom rpl_srandom
+# endif
+_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
+_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
+# else
+# if !@HAVE_RANDOM@
_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
-# endif
+# endif
_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
+# endif
_GL_CXXALIASWARN (srandom);
#elif defined GNULIB_POSIXCHECK
# undef srandom
@@ -601,31 +628,52 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - "
#endif
#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@ || !@HAVE_DECL_INITSTATE@
+# if @REPLACE_INITSTATE@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef initstate
+# define initstate rpl_initstate
+# endif
+_GL_FUNCDECL_RPL (initstate, char *,
+ (unsigned int seed, char *buf, size_t buf_size)
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (initstate, char *,
+ (unsigned int seed, char *buf, size_t buf_size));
+# else
+# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
_GL_FUNCDECL_SYS (initstate, char *,
(unsigned int seed, char *buf, size_t buf_size)
_GL_ARG_NONNULL ((2)));
-# endif
+# endif
_GL_CXXALIAS_SYS (initstate, char *,
(unsigned int seed, char *buf, size_t buf_size));
+# endif
_GL_CXXALIASWARN (initstate);
#elif defined GNULIB_POSIXCHECK
# undef initstate
-# if HAVE_RAW_DECL_INITSTATE_R
+# if HAVE_RAW_DECL_INITSTATE
_GL_WARN_ON_USE (initstate, "initstate is unportable - "
"use gnulib module random for portability");
# endif
#endif
#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@ || !@HAVE_DECL_SETSTATE@
+# if @REPLACE_SETSTATE@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef setstate
+# define setstate rpl_setstate
+# endif
+_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
+# else
+# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
-# endif
+# endif
_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
+# endif
_GL_CXXALIASWARN (setstate);
#elif defined GNULIB_POSIXCHECK
# undef setstate
-# if HAVE_RAW_DECL_SETSTATE_R
+# if HAVE_RAW_DECL_SETSTATE
_GL_WARN_ON_USE (setstate, "setstate is unportable - "
"use gnulib module random for portability");
# endif
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 58fa93fd0ad..9ddd1a8d004 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -54,9 +54,16 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
+/* Before doing "#define mknod rpl_mknod" below, we need to include all
+ headers that may declare mknod(). OS/2 kLIBC declares mknod() in
+ <unistd.h>, not in <sys/stat.h>. */
+#ifdef __KLIBC__
+# include <unistd.h>
+#endif
+
/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
headers that may declare mkdir(). Native Windows platforms declare mkdir
- in <io.h> and/or <direct.h>, not in <unistd.h>. */
+ in <io.h> and/or <direct.h>, not in <sys/stat.h>. */
#if defined _WIN32 && ! defined __CYGWIN__
# include <io.h> /* mingw32, mingw64 */
# include <direct.h> /* mingw64, MSVC 9 */
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index a10ca28a532..7778d25dc7e 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -68,9 +68,11 @@
# include <stdio.h>
#endif
-/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
+/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
+ <unistd.h>. */
/* But avoid namespace pollution on glibc systems. */
-#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
+#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
+ && (defined __CYGWIN__ || defined __ANDROID__) \
&& ! defined __GLIBC__
# include <fcntl.h>
#endif
@@ -113,6 +115,13 @@
# include <netdb.h>
#endif
+/* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */
+/* But avoid namespace pollution on glibc systems. */
+#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
+ && !defined __GLIBC__
+# include <sys/stat.h>
+#endif
+
/* MSVC defines off_t in <sys/types.h>.
May also define off_t to a 64-bit type on native Windows. */
#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
diff --git a/lib/verify.h b/lib/verify.h
index b2e5f6446e1..6930645a350 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -26,7 +26,7 @@
here generates easier-to-read diagnostics when verify (R) fails.
Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11.
- This will likely be supported by future GCC versions, in C++ mode.
+ This is supported by GCC 6.1.0 and later, in C++ mode.
Use this only with GCC. If we were willing to slow 'configure'
down we could also use it with other compilers, but since this
@@ -36,9 +36,7 @@
&& !defined __cplusplus)
# define _GL_HAVE__STATIC_ASSERT 1
#endif
-/* The condition (99 < __GNUC__) is temporary, until we know about the
- first G++ release that supports static_assert. */
-#if (99 < __GNUC__) && defined __cplusplus
+#if (6 <= __GNUC__) && defined __cplusplus
# define _GL_HAVE_STATIC_ASSERT 1
#endif