summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-09-18 16:31:52 +0200
committerBruno Haible <bruno@clisp.org>2021-09-18 16:31:52 +0200
commit4bed390be8b146be3b4c73835b06f466871b931a (patch)
tree7f5bacc5dfd8f7558f1fa22e2ab4c3b461b94411
parent7818455627c5e54813ac89924b8b67d0bc869146 (diff)
downloadgnulib-4bed390be8b146be3b4c73835b06f466871b931a.tar.gz
string, wchar: Don't cause link errors for rpl_free (regr. 2021-09-07).
* lib/string.in.h (free, rpl_free): Consider GNULIB_FREE_POSIX variable. * lib/wchar.in.h (free, rpl_free): Likewise. * m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Require module indicator variable initializations from the stdlib module. * m4/wchar_h.m4 (gl_WCHAR_H_REQUIRE_DEFAULTS): Likewise. * modules/string (Makefile.am): Substitute GNULIB_FREE_POSIX in string.h. * modules/wchar (Makefile.am): Substitute GNULIB_FREE_POSIX in wchar.h.
-rw-r--r--ChangeLog11
-rw-r--r--lib/string.in.h10
-rw-r--r--lib/wchar.in.h10
-rw-r--r--m4/string_h.m44
-rw-r--r--m4/wchar_h.m44
-rw-r--r--modules/string1
-rw-r--r--modules/wchar1
7 files changed, 31 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 1a766b4fe8..61a7e58e04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2021-09-18 Bruno Haible <bruno@clisp.org>
+
+ string, wchar: Don't cause link errors for rpl_free (regr. 2021-09-07).
+ * lib/string.in.h (free, rpl_free): Consider GNULIB_FREE_POSIX variable.
+ * lib/wchar.in.h (free, rpl_free): Likewise.
+ * m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Require module
+ indicator variable initializations from the stdlib module.
+ * m4/wchar_h.m4 (gl_WCHAR_H_REQUIRE_DEFAULTS): Likewise.
+ * modules/string (Makefile.am): Substitute GNULIB_FREE_POSIX in string.h.
+ * modules/wchar (Makefile.am): Substitute GNULIB_FREE_POSIX in wchar.h.
+
2021-09-17 Bruno Haible <bruno@clisp.org>
threadlib: Avoid crashes in thread-related functions on Cygwin 3.2.0.
diff --git a/lib/string.in.h b/lib/string.in.h
index 8977153c88..8d77ae3800 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -84,12 +84,14 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
/* Declare 'free' if needed for _GL_ATTRIBUTE_DEALLOC_FREE. */
-#if (@REPLACE_FREE@ && !defined free \
- && !(defined __cplusplus && defined GNULIB_NAMESPACE))
_GL_EXTERN_C void free (void *);
-# define free rpl_free
-#endif
+#if @GNULIB_FREE_POSIX@
+# if (@REPLACE_FREE@ && !defined free \
+ && !(defined __cplusplus && defined GNULIB_NAMESPACE))
+# define free rpl_free
_GL_EXTERN_C void free (void *);
+# endif
+#endif
/* Clear a block of memory. The compiler will not delete a call to
this function, even if the block is dead after the call. */
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index acb9d4ea64..f13379ad84 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -147,12 +147,14 @@ typedef int rpl_mbstate_t;
#endif
/* Declare 'free' if needed for _GL_ATTRIBUTE_DEALLOC_FREE. */
-#if (@REPLACE_FREE@ && !defined free \
- && !(defined __cplusplus && defined GNULIB_NAMESPACE))
_GL_EXTERN_C void free (void *);
-# define free rpl_free
-#endif
+#if @GNULIB_FREE_POSIX@
+# if (@REPLACE_FREE@ && !defined free \
+ && !(defined __cplusplus && defined GNULIB_NAMESPACE))
+# define free rpl_free
_GL_EXTERN_C void free (void *);
+# endif
+#endif
/* Convert a single-byte character to a wide character. */
#if @GNULIB_BTOWC@
diff --git a/m4/string_h.m4 b/m4/string_h.m4
index 80d1e58753..9871dac8b2 100644
--- a/m4/string_h.m4
+++ b/m4/string_h.m4
@@ -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 32
+# serial 33
# Written by Paul Eggert.
@@ -93,6 +93,8 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_STRDUP], [1])
])
m4_require(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS])
+ dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized.
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS])
AC_REQUIRE([gl_STRING_H_DEFAULTS])
])
diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4
index 818b3192e0..d69dbe67d9 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 53
+# wchar_h.m4 serial 54
AC_DEFUN_ONCE([gl_WCHAR_H],
[
@@ -189,6 +189,8 @@ AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1])
])
m4_require(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS])
+ dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized.
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS])
AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
])
diff --git a/modules/string b/modules/string
index 306834591e..e9c3153997 100644
--- a/modules/string
+++ b/modules/string
@@ -75,6 +75,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \
-e 's/@''GNULIB_MDA_MEMCCPY''@/$(GNULIB_MDA_MEMCCPY)/g' \
-e 's/@''GNULIB_MDA_STRDUP''@/$(GNULIB_MDA_STRDUP)/g' \
+ -e 's/@''GNULIB_FREE_POSIX''@/$(GNULIB_FREE_POSIX)/g' \
< $(srcdir)/string.in.h | \
sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \
-e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
diff --git a/modules/wchar b/modules/wchar
index d34cb6a22a..becd7968a9 100644
--- a/modules/wchar
+++ b/modules/wchar
@@ -79,6 +79,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \
-e 's/@''GNULIB_WCSFTIME''@/$(GNULIB_WCSFTIME)/g' \
-e 's/@''GNULIB_MDA_WCSDUP''@/$(GNULIB_MDA_WCSDUP)/g' \
+ -e 's/@''GNULIB_FREE_POSIX''@/$(GNULIB_FREE_POSIX)/g' \
< $(srcdir)/wchar.in.h | \
sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
-e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \