summaryrefslogtreecommitdiff
path: root/lib/string.in.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-01-04 13:13:25 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2022-01-04 13:17:25 -0800
commitc899d9742a3dee2069eb3a4ee9380833b5574a95 (patch)
tree4f3bb33a1ed54c49b0e70241f662e5efe29bdb45 /lib/string.in.h
parenta0263cfee3cf64f4a77f90591af7ef7d8d78d8db (diff)
downloademacs-c899d9742a3dee2069eb3a4ee9380833b5574a95.tar.gz
Update from gnulib
Diffstat (limited to 'lib/string.in.h')
-rw-r--r--lib/string.in.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/string.in.h b/lib/string.in.h
index 0c4aefcceb9..03e6a17a36d 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -112,12 +112,26 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
-/* Declare 'free' if needed for _GL_ATTRIBUTE_DEALLOC_FREE. */
-_GL_EXTERN_C void free (void *);
+/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
+ been included yet. */
#if @GNULIB_FREE_POSIX@
# if (@REPLACE_FREE@ && !defined free \
&& !(defined __cplusplus && defined GNULIB_NAMESPACE))
-# define free rpl_free
+/* We can't do '#define free rpl_free' here. */
+_GL_EXTERN_C void rpl_free (void *);
+# undef _GL_ATTRIBUTE_DEALLOC_FREE
+# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
+# else
+# if defined _MSC_VER
+_GL_EXTERN_C void __cdecl free (void *);
+# else
+_GL_EXTERN_C void free (void *);
+# endif
+# endif
+#else
+# if defined _MSC_VER
+_GL_EXTERN_C void __cdecl free (void *);
+# else
_GL_EXTERN_C void free (void *);
# endif
#endif