bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: bug-gnulib@gnu.org
Subject: Re: fnmatch: rely on more gnulib modules
Date: Sun, 31 May 2020 02:51:06 +0200	[thread overview]
Message-ID: <7011871.yb4ltZRR22@omega> (raw)
In-Reply-To: <ae753bfa-23fe-afd7-fbac-86d16891714b@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 971 bytes --]

Paul Eggert wrote:
> fnmatch now depends on a module wmempcpy that does not exist, causing the
> bootstrap to fail.

Fixed the 'fnmatch' dependencies like this.


2020-05-30  Bruno Haible  <bruno@clisp.org>

	wmemchr: Relicense under LGPLv2+.
	* modules/wmemchr (License): Set to LGPLv2+.

2020-05-30  Bruno Haible  <bruno@clisp.org>

	wmempcpy: New module.
	Reported by Paul Eggert in
	<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00387.html>.
	* lib/wchar.in.h (wmempcpy): New declaration.
	* lib/wmempcpy.c: New file.
	* m4/wmempcpy.m4: New file.
	* m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmempcpy is declared.
	(gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMPCPY, HAVE_WMEMPCPY.
	* modules/wchar (Makefile.am): Substitute GNULIB_WMEMPCPY,
	HAVE_WMEMPCPY.
	* modules/wmempcpy: New file.
	* tests/test-wchar-c++.cc: Check the signature of wmempcpy.
	* doc/glibc-functions/wmempcpy.texi: Mention the new module.
	* modules/mempcpy (Description): Fix typo.


[-- Attachment #2: 0001-wmempcpy-New-module.patch --]
[-- Type: text/x-patch, Size: 10850 bytes --]

From 68935ae95b339a42ee955be00aa7921bd37916ba Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sun, 31 May 2020 02:42:47 +0200
Subject: [PATCH 1/2] wmempcpy: New module.

Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00387.html>.

* lib/wchar.in.h (wmempcpy): New declaration.
* lib/wmempcpy.c: New file.
* m4/wmempcpy.m4: New file.
* m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmempcpy is declared.
(gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMPCPY, HAVE_WMEMPCPY.
* modules/wchar (Makefile.am): Substitute GNULIB_WMEMPCPY,
HAVE_WMEMPCPY.
* modules/wmempcpy: New file.
* tests/test-wchar-c++.cc: Check the signature of wmempcpy.
* doc/glibc-functions/wmempcpy.texi: Mention the new module.
* modules/mempcpy (Description): Fix typo.
---
 ChangeLog                         | 17 +++++++++++++++++
 doc/glibc-functions/wmempcpy.texi |  8 ++++----
 lib/wchar.in.h                    | 23 +++++++++++++++++++++++
 lib/wmempcpy.c                    | 28 ++++++++++++++++++++++++++++
 m4/wchar_h.m4                     |  7 +++++--
 m4/wmempcpy.m4                    | 21 +++++++++++++++++++++
 modules/mempcpy                   |  2 +-
 modules/wchar                     |  2 ++
 modules/wmempcpy                  | 27 +++++++++++++++++++++++++++
 tests/test-wchar-c++.cc           |  5 +++++
 10 files changed, 133 insertions(+), 7 deletions(-)
 create mode 100644 lib/wmempcpy.c
 create mode 100644 m4/wmempcpy.m4
 create mode 100644 modules/wmempcpy

diff --git a/ChangeLog b/ChangeLog
index 4b39c3d3..b396b3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2020-05-30  Bruno Haible  <bruno@clisp.org>
 
+	wmempcpy: New module.
+	Reported by Paul Eggert in
+	<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00387.html>.
+	* lib/wchar.in.h (wmempcpy): New declaration.
+	* lib/wmempcpy.c: New file.
+	* m4/wmempcpy.m4: New file.
+	* m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmempcpy is declared.
+	(gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMPCPY, HAVE_WMEMPCPY.
+	* modules/wchar (Makefile.am): Substitute GNULIB_WMEMPCPY,
+	HAVE_WMEMPCPY.
+	* modules/wmempcpy: New file.
+	* tests/test-wchar-c++.cc: Check the signature of wmempcpy.
+	* doc/glibc-functions/wmempcpy.texi: Mention the new module.
+	* modules/mempcpy (Description): Fix typo.
+
+2020-05-30  Bruno Haible  <bruno@clisp.org>
+
 	crypto/gc-random: Fix list of crypto devices for NetBSD, OpenBSD.
 	* m4/gc-random.m4 (gl_GC_RANDOM): Don't special-case NetBSD and OpenBSD.
 
diff --git a/doc/glibc-functions/wmempcpy.texi b/doc/glibc-functions/wmempcpy.texi
index da5b4d2..be7e782 100644
--- a/doc/glibc-functions/wmempcpy.texi
+++ b/doc/glibc-functions/wmempcpy.texi
@@ -15,18 +15,18 @@ Documentation:
 @uref{https://www.kernel.org/doc/man-pages/online/pages/man3/wmempcpy.3.html,,man wmempcpy}.
 @end itemize
 
-Gnulib module: ---
+Gnulib module: wmempcpy
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many non-glibc platforms:
+Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin, mingw, MSVC 14, Android 5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on many non-glibc platforms:
-Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin, mingw, MSVC 14, Android 5.1.
-@item
 On Windows and 32-bit AIX platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index e1fa92f..bfcf611 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -624,6 +624,29 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
 #endif
 
 
+/* Copy N wide characters of SRC to DEST.
+   Return pointer to wide characters after the last written wide character.  */
+#if @GNULIB_WMEMPCPY@
+# if !@HAVE_WMEMPCPY@
+_GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wmempcpy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wmempcpy
+# if HAVE_RAW_DECL_WMEMPCPY
+_GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
+                 "use gnulib module wmempcpy for portability");
+# endif
+#endif
+
+
 /* Set N wide characters of S to C.  */
 #if @GNULIB_WMEMSET@
 # if !@HAVE_WMEMSET@
diff --git a/lib/wmempcpy.c b/lib/wmempcpy.c
new file mode 100644
index 0000000..9161c65
--- /dev/null
+++ b/lib/wmempcpy.c
@@ -0,0 +1,28 @@
+/* Copy wide character array, return pointer after last written wide character.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+/* Copy N wide characters of SRC to DEST.
+   Return pointer to wide characters after the last written wide character.  */
+wchar_t *
+wmempcpy (wchar_t *dest, const wchar_t *src, size_t n)
+{
+  return wmemcpy (dest, src, n) + n;
+}
diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4
index be09020..6c4e8a6 100644
--- a/m4/wchar_h.m4
+++ b/m4/wchar_h.m4
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar_h.m4 serial 45
+# wchar_h.m4 serial 46
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -52,7 +52,8 @@ AC_DEFUN([gl_WCHAR_H],
 #include <wchar.h>
     ]],
     [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
-     wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset
+     wcsrtombs wcsnrtombs wcwidth
+     wmemchr wmemcmp wmemcpy wmemmove wmempcpy wmemset
      wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp
      wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr
      wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth wcsftime
@@ -159,6 +160,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   GNULIB_WMEMCMP=0;     AC_SUBST([GNULIB_WMEMCMP])
   GNULIB_WMEMCPY=0;     AC_SUBST([GNULIB_WMEMCPY])
   GNULIB_WMEMMOVE=0;    AC_SUBST([GNULIB_WMEMMOVE])
+  GNULIB_WMEMPCPY=0;    AC_SUBST([GNULIB_WMEMPCPY])
   GNULIB_WMEMSET=0;     AC_SUBST([GNULIB_WMEMSET])
   GNULIB_WCSLEN=0;      AC_SUBST([GNULIB_WCSLEN])
   GNULIB_WCSNLEN=0;     AC_SUBST([GNULIB_WCSNLEN])
@@ -198,6 +200,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   HAVE_WMEMCMP=1;       AC_SUBST([HAVE_WMEMCMP])
   HAVE_WMEMCPY=1;       AC_SUBST([HAVE_WMEMCPY])
   HAVE_WMEMMOVE=1;      AC_SUBST([HAVE_WMEMMOVE])
+  HAVE_WMEMPCPY=1;      AC_SUBST([HAVE_WMEMPCPY])
   HAVE_WMEMSET=1;       AC_SUBST([HAVE_WMEMSET])
   HAVE_WCSLEN=1;        AC_SUBST([HAVE_WCSLEN])
   HAVE_WCSNLEN=1;       AC_SUBST([HAVE_WCSNLEN])
diff --git a/m4/wmempcpy.m4 b/m4/wmempcpy.m4
new file mode 100644
index 0000000..1795fc8
--- /dev/null
+++ b/m4/wmempcpy.m4
@@ -0,0 +1,21 @@
+# wmempcpy.m4 serial 1
+dnl Copyright (C) 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_WMEMPCPY],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  dnl Persuade glibc <wchar.h> to declare wmempcpy().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl The wmempcpy() declaration in lib/wchar.in.h uses 'restrict'.
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_FUNCS_ONCE([wmempcpy])
+  if test $ac_cv_func_wmempcpy = no; then
+    HAVE_WMEMPCPY=0
+  fi
+])
diff --git a/modules/mempcpy b/modules/mempcpy
index 9af4654..59009aa 100644
--- a/modules/mempcpy
+++ b/modules/mempcpy
@@ -1,5 +1,5 @@
 Description:
-mempcpy() function: copy memory area, return point after last written byte.
+mempcpy() function: copy memory area, return pointer after last written byte.
 
 Files:
 lib/mempcpy.c
diff --git a/modules/wchar b/modules/wchar
index cd4464b..a028f65 100644
--- a/modules/wchar
+++ b/modules/wchar
@@ -50,6 +50,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
 	      -e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \
 	      -e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \
 	      -e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \
+	      -e 's/@''GNULIB_WMEMPCPY''@/$(GNULIB_WMEMPCPY)/g' \
 	      -e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \
 	      -e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \
 	      -e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \
@@ -90,6 +91,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
 	      -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \
 	      -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \
 	      -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \
+	      -e 's|@''HAVE_WMEMPCPY''@|$(HAVE_WMEMPCPY)|g' \
 	      -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \
 	      -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \
 	      -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \
diff --git a/modules/wmempcpy b/modules/wmempcpy
new file mode 100644
index 0000000..edb4c5f
--- /dev/null
+++ b/modules/wmempcpy
@@ -0,0 +1,27 @@
+Description:
+wmempcpy() function: copy wide character array, return pointer after last written wide character.
+
+Files:
+lib/wmempcpy.c
+m4/wmempcpy.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WMEMPCPY
+if test $HAVE_WMEMPCPY = 0; then
+  AC_LIBOBJ([wmempcpy])
+fi
+gl_WCHAR_MODULE_INDICATOR([wmempcpy])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/tests/test-wchar-c++.cc b/tests/test-wchar-c++.cc
index 63480b1..3b9ba4b 100644
--- a/tests/test-wchar-c++.cc
+++ b/tests/test-wchar-c++.cc
@@ -95,6 +95,11 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::wmemmove, wchar_t *,
                  (wchar_t *, const wchar_t *, size_t));
 #endif
 
+#if GNULIB_TEST_WMEMPCPY
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wmempcpy, wchar_t *,
+                 (wchar_t *, const wchar_t *, size_t));
+#endif
+
 #if GNULIB_TEST_WMEMSET
 SIGNATURE_CHECK (GNULIB_NAMESPACE::wmemset, wchar_t *,
                  (wchar_t *, wchar_t, size_t));
-- 
2.7.4


[-- Attachment #3: 0002-wmemchr-Relicense-under-LGPLv2.patch --]
[-- Type: text/x-patch, Size: 988 bytes --]

From 0964a8cc11b4e13780e427c7dfc5d6a0fe072c9e Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sun, 31 May 2020 02:48:31 +0200
Subject: [PATCH 2/2] wmemchr: Relicense under LGPLv2+.

* modules/wmemchr (License): Set to LGPLv2+.
---
 ChangeLog       | 5 +++++
 modules/wmemchr | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index b396b3c..e813334 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2020-05-30  Bruno Haible  <bruno@clisp.org>
 
+	wmemchr: Relicense under LGPLv2+.
+	* modules/wmemchr (License): Set to LGPLv2+.
+
+2020-05-30  Bruno Haible  <bruno@clisp.org>
+
 	wmempcpy: New module.
 	Reported by Paul Eggert in
 	<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00387.html>.
diff --git a/modules/wmemchr b/modules/wmemchr
index f34cc4e..89bc3d1 100644
--- a/modules/wmemchr
+++ b/modules/wmemchr
@@ -22,7 +22,7 @@ Include:
 <wchar.h>
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 all
-- 
2.7.4


  parent reply	other threads:[~2020-05-31  0:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 12:02 fnmatch: rely on more gnulib modules Bruno Haible
2020-05-29 20:54 ` Paul Eggert
2020-05-29 23:27   ` Bruno Haible
2020-05-30 23:53   ` Paul Eggert
2020-05-31  0:14     ` Bruno Haible
2020-05-31  0:51     ` Bruno Haible [this message]
2020-05-31 17:19       ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7011871.yb4ltZRR22@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).