summaryrefslogtreecommitdiff
path: root/m4/memchr.m4
diff options
context:
space:
mode:
authorClint Adams <clint@debian.org>2021-08-31 08:53:27 -0400
committerClint Adams <clint@debian.org>2021-08-31 08:53:27 -0400
commitf24d9c72cbde1abddef18e427b818e5b6266a5e0 (patch)
treef10e939c9cb7b767cb51dce4a84ec9872f3c61b1 /m4/memchr.m4
parentc7cd1604feb9bce8b62e9a5a306b8eeb30a11c97 (diff)
parentc50de48f2ed0b9476c3389fd07a85a5e8be798e2 (diff)
Update upstream source from tag 'upstream/v4.8'
Update to upstream version '4.8' with Debian dir 33bfe3afa4d1f33d660b71d89a5ac3eba646cc82
Diffstat (limited to 'm4/memchr.m4')
-rw-r--r--m4/memchr.m425
1 files changed, 19 insertions, 6 deletions
diff --git a/m4/memchr.m4 b/m4/memchr.m4
index 83c65c1..91eec88 100644
--- a/m4/memchr.m4
+++ b/m4/memchr.m4
@@ -1,5 +1,5 @@
-# memchr.m4 serial 13
-dnl Copyright (C) 2002-2004, 2009-2018 Free Software Foundation, Inc.
+# memchr.m4 serial 15
+dnl Copyright (C) 2002-2004, 2009-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -29,6 +29,8 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
# memchr should not dereference overestimated length after a match
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737
# https://sourceware.org/bugzilla/show_bug.cgi?id=10162
+ # memchr should cast the second argument to 'unsigned char'.
+ # This bug exists in Android 4.3.
# Assume that memchr works on platforms that lack mprotect.
AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
@@ -74,15 +76,26 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
if (memchr (fence - 1, 0, 3) != fence - 1)
result |= 4;
}
+ /* Test against bug on Android 4.3. */
+ {
+ char input[3];
+ input[0] = 'a';
+ input[1] = 'b';
+ input[2] = 'c';
+ if (memchr (input, 0x789abc00 | 'b', 3) != input + 1)
+ result |= 8;
+ }
return result;
]])],
[gl_cv_func_memchr_works=yes],
[gl_cv_func_memchr_works=no],
[case "$host_os" in
- # Guess yes on native Windows.
- mingw*) gl_cv_func_memchr_works="guessing yes" ;;
- # Be pessimistic for now.
- *) gl_cv_func_memchr_works="guessing no" ;;
+ # Guess no on Android.
+ linux*-android*) gl_cv_func_memchr_works="guessing no" ;;
+ # Guess yes on native Windows.
+ mingw*) gl_cv_func_memchr_works="guessing yes" ;;
+ # If we don't know, obey --enable-cross-guesses.
+ *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;;
esac
])
])