]> Savannah Git Hosting - gnulib.git/commitdiff
string, wchar: Don't cause link errors for rpl_free (regr. 2021-09-07).
authorBruno Haible <bruno@clisp.org>
Sat, 18 Sep 2021 14:31:52 +0000 (16:31 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 18 Sep 2021 14:31:52 +0000 (16:31 +0200)
* 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.

ChangeLog
lib/string.in.h
lib/wchar.in.h
m4/string_h.m4
m4/wchar_h.m4
modules/string
modules/wchar

index 1a766b4fe8ac6606874b9a501340ccebe7e0b10a..61a7e58e0436b6df751d9b5085013b883d97aa7c 100644 (file)
--- 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.
index 8977153c88b407ff3da5d88ed04b4dd87d30f72a..8d77ae380001c366505cc7415d71a60bdf76c185 100644 (file)
 /* 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.  */
index acb9d4ea64811801427f27cb2e3776620d958ad2..f13379ad84e77367aacc48bb85915941237e0a42 100644 (file)
@@ -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@
index 80d1e58753ffe4770f34bff384d8ac7a9b0fbb58..9871dac8b28611b8bff2ac3b3a8e7699a5cc57a6 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 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])
 ])
 
index 818b3192e0ab0c5d8c79d60ba68d9b8e49d6102b..d69dbe67d9890165e4e77de968bf4962c8617dd0 100644 (file)
@@ -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])
 ])
 
index 306834591ecbd6a955b66ec447e501c188cf5407..e9c3153997b9e28b64c148a97ea3bffc4de61f0e 100644 (file)
@@ -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' \
index d34cb6a22ac906ae192b0b3c4b1f092113323236..becd7968a95c20015a1daee1190fe2bbda8f9f26 100644 (file)
@@ -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' \