From 4bed390be8b146be3b4c73835b06f466871b931a Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 18 Sep 2021 16:31:52 +0200 Subject: 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. --- lib/string.in.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/string.in.h') 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. */ -- cgit v1.2.1