]> Savannah Git Hosting - gnulib.git/commitdiff
memchr: Remove support for some very old platforms.
authorBruno Haible <bruno@clisp.org>
Wed, 8 Jul 2020 01:19:54 +0000 (03:19 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 8 Jul 2020 01:19:54 +0000 (03:19 +0200)
* m4/memchr-obsolete.m4: Remove file.
* modules/memchr-obsolete: Remove file.
* m4/memchr.m4 (gl_FUNC_MEMCHR): Assume module 'memchr-obsolete' is
absent. Don't define HAVE_MEMCHR.
* lib/string.in.h (memchr): Assume HAVE_MEMCHR is 1.
* modules/memchr (Depends-on): Remove memchr-obsolete.
(configure.ac): Assume HAVE_MEMCHR is 1.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Don't initialize
HAVE_MEMCHR.
* modules/string (Makefile.am): Don't substitute HAVE_MEMCHR.
* doc/posix-functions/memchr.texi: Don't mention module
'memchr-obsolete'.
* m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Assume HAVE_MEMCHR is 1.
* m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Assume HAVE_MEMCHR is 1.
* modules/strnlen (Depends-on): Remove memchr-obsolete.

12 files changed:
ChangeLog
doc/posix-functions/memchr.texi
lib/string.in.h
m4/memchr-obsolete.m4 [deleted file]
m4/memchr.m4
m4/strcasestr.m4
m4/string_h.m4
m4/strstr.m4
modules/memchr
modules/memchr-obsolete [deleted file]
modules/string
modules/strnlen

index 8d0ccf56dae3023c8d582fd31068be5b52bf05bd..a1642ef1188c00759f318eb6127cf86b28a6106e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2020-07-07  Bruno Haible  <bruno@clisp.org>
 
+       memchr: Remove support for some very old platforms.
+       * m4/memchr-obsolete.m4: Remove file.
+       * modules/memchr-obsolete: Remove file.
+       * m4/memchr.m4 (gl_FUNC_MEMCHR): Assume module 'memchr-obsolete' is
+       absent. Don't define HAVE_MEMCHR.
+       * lib/string.in.h (memchr): Assume HAVE_MEMCHR is 1.
+       * modules/memchr (Depends-on): Remove memchr-obsolete.
+       (configure.ac): Assume HAVE_MEMCHR is 1.
+       * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Don't initialize
+       HAVE_MEMCHR.
+       * modules/string (Makefile.am): Don't substitute HAVE_MEMCHR.
+       * doc/posix-functions/memchr.texi: Don't mention module
+       'memchr-obsolete'.
+       * m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Assume HAVE_MEMCHR is 1.
+       * m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Assume HAVE_MEMCHR is 1.
+       * modules/strnlen (Depends-on): Remove memchr-obsolete.
+
        dup2: Remove support for some very old platforms.
        * m4/dup2-obsolete.m4: Remove file.
        * modules/dup2-obsolete: Remove file.
index 38d5b66df72b2700480e568a7cd0d4934bb3bd6e..5ceb71fd642e410e7b2b9108602880461df27092 100644 (file)
@@ -4,9 +4,9 @@
 
 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/memchr.html}
 
-Gnulib module: memchr or memchr-obsolete
+Gnulib module: memchr
 
-Portability problems fixed by either Gnulib module @code{memchr} or @code{memchr-obsolete}:
+Portability problems fixed by Gnulib:
 @itemize
 @item
 This function dereferences too much memory on some platforms:
@@ -17,12 +17,6 @@ of an @code{unsigned char} on some platforms:
 Android 5.0.
 @end itemize
 
-Portability problems fixed by Gnulib module @code{memchr-obsolete}:
-@itemize
-@item
-This function is missing on some older platforms.
-@end itemize
-
 Portability problems not fixed by Gnulib:
 @itemize
 @end itemize
index 77ccf94e28351fc20e0ec33cb25ba6a1d6593164..c18efa7c0a28806bf956a7c869cf422b1572d88e 100644 (file)
@@ -134,11 +134,6 @@ _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
                                   _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
 # else
-#  if ! @HAVE_MEMCHR@
-_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
-                                  _GL_ATTRIBUTE_PURE
-                                  _GL_ARG_NONNULL ((1)));
-#  endif
   /* On some systems, this function is defined as an overloaded function:
        extern "C" { const void * std::memchr (const void *, int, size_t); }
        extern "C++" { void * std::memchr (void *, int, size_t); }  */
diff --git a/m4/memchr-obsolete.m4 b/m4/memchr-obsolete.m4
deleted file mode 100644 (file)
index 7305a77..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# memchr-obsolete.m4 serial 1
-dnl Copyright (C) 2011-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.
-
-AC_DEFUN([gl_FUNC_MEMCHR_OBSOLETE],
-[
-  dnl The real code is in memchr.m4.
-  :
-])
index 91eec88e09f9f62705871d72ad320a2483e06c3c..81e8f985df43c9967b23b00c366475f4a3d543f5 100644 (file)
@@ -1,4 +1,4 @@
-# memchr.m4 serial 15
+# memchr.m4 serial 16
 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,
@@ -14,26 +14,17 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
   AC_CHECK_FUNCS_ONCE([mprotect])
 
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
-  m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [
-    dnl These days, we assume memchr is present.  But if support for old
-    dnl platforms is desired:
-    AC_CHECK_FUNCS_ONCE([memchr])
-    if test $ac_cv_func_memchr = no; then
-      HAVE_MEMCHR=0
-    fi
-  ])
-  if test $HAVE_MEMCHR = 1; then
-    # Detect platform-specific bugs in some versions of glibc:
-    # memchr should not dereference anything with length 0
-    #   https://bugzilla.redhat.com/show_bug.cgi?id=499689
-    # 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([[
+  # Detect platform-specific bugs in some versions of glibc:
+  # memchr should not dereference anything with length 0
+  #   https://bugzilla.redhat.com/show_bug.cgi?id=499689
+  # 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([[
 #include <string.h>
 #if HAVE_SYS_MMAN_H
 # include <fcntl.h>
@@ -87,23 +78,22 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
   }
   return result;
 ]])],
-         [gl_cv_func_memchr_works=yes],
-         [gl_cv_func_memchr_works=no],
-         [case "$host_os" in
-                             # 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
-         ])
-      ])
-    case "$gl_cv_func_memchr_works" in
-      *yes) ;;
-      *) REPLACE_MEMCHR=1 ;;
-    esac
-  fi
+       [gl_cv_func_memchr_works=yes],
+       [gl_cv_func_memchr_works=no],
+       [case "$host_os" in
+                           # 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
+       ])
+    ])
+  case "$gl_cv_func_memchr_works" in
+    *yes) ;;
+    *) REPLACE_MEMCHR=1 ;;
+  esac
 ])
 
 # Prerequisites of lib/memchr.c.
index 4c2275fc7174a699e572fac845647ca56156b8b5..ee2287321d0d7b5f4d9b67bc074ede3010d3710f 100644 (file)
@@ -1,4 +1,4 @@
-# strcasestr.m4 serial 25
+# strcasestr.m4 serial 26
 dnl Copyright (C) 2005, 2007-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,
@@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
   if test $ac_cv_func_strcasestr = no; then
     HAVE_STRCASESTR=0
   else
-    if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
+    if test $REPLACE_MEMCHR = 1; then
       REPLACE_STRCASESTR=1
     else
       dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092
index cc51337f0d1f3bed689e819227969d390f76d505..516b346b311c178f78c480639b33ef51b8d0e843 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 23
+# serial 24
 
 # Written by Paul Eggert.
 
@@ -87,7 +87,6 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   HAVE_EXPLICIT_BZERO=1;        AC_SUBST([HAVE_EXPLICIT_BZERO])
   HAVE_FFSL=1;                  AC_SUBST([HAVE_FFSL])
   HAVE_FFSLL=1;                 AC_SUBST([HAVE_FFSLL])
-  HAVE_MEMCHR=1;                AC_SUBST([HAVE_MEMCHR])
   HAVE_DECL_MEMMEM=1;           AC_SUBST([HAVE_DECL_MEMMEM])
   HAVE_MEMPCPY=1;               AC_SUBST([HAVE_MEMPCPY])
   HAVE_DECL_MEMRCHR=1;          AC_SUBST([HAVE_DECL_MEMRCHR])
index a2ec337f1713910128bf9973152ca9e434136b0a..529110793cddc69c238b458f29940b46d63e02f3 100644 (file)
@@ -1,4 +1,4 @@
-# strstr.m4 serial 21
+# strstr.m4 serial 22
 dnl Copyright (C) 2008-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,
@@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
 [
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   AC_REQUIRE([gl_FUNC_MEMCHR])
-  if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
+  if test $REPLACE_MEMCHR = 1; then
     REPLACE_STRSTR=1
   else
     dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092
index ed80e0c2d7a7ff702e38f701b7578232345f517b..3a413a20b42a02b121faa8ec9f298ea52cdc99fc 100644 (file)
@@ -10,11 +10,10 @@ m4/mmap-anon.m4
 Depends-on:
 extensions
 string
-memchr-obsolete
 
 configure.ac:
 gl_FUNC_MEMCHR
-if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
+if test $REPLACE_MEMCHR = 1; then
   AC_LIBOBJ([memchr])
   gl_PREREQ_MEMCHR
 fi
diff --git a/modules/memchr-obsolete b/modules/memchr-obsolete
deleted file mode 100644 (file)
index c1a6e43..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-Description:
-memchr() function for old platforms.
-
-Status:
-obsolete
-
-Notice:
-This module is obsolete.
-
-Files:
-m4/memchr-obsolete.m4
-
-Depends-on:
-memchr
-
-configure.ac:
-gl_FUNC_MEMCHR_OBSOLETE
-
-Makefile.am:
-
-Include:
-<string.h>
-
-License:
-LGPLv2+
-
-Maintainer:
-all
index 67209d5df9302e547905d3d8267a0cfb6c9b9e8b..bc87bc8818ecc8bb99d87c382aecf82fda73bd1a 100644 (file)
@@ -73,7 +73,6 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
              -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \
              -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
-             -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
index c78167113d4b0ac9a3ac616ceb72e88dd8da042e..ea5658a072b9d1c37a1c25f3ac2ffc7c380d54f0 100644 (file)
@@ -8,7 +8,6 @@ m4/strnlen.m4
 Depends-on:
 string
 extensions
-memchr-obsolete [test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1]
 
 configure.ac:
 gl_FUNC_STRNLEN