summaryrefslogtreecommitdiff
path: root/lib/stdlib.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-12-18 00:41:07 +0100
committerBruno Haible <bruno@clisp.org>2020-12-18 00:41:07 +0100
commit0aa8ef42465a8a7828960311230308af7042e414 (patch)
tree1394ecbdd1a5510077454f689e96357d1f855cb3 /lib/stdlib.in.h
parent8968aaa702c80a6d4c3af56e6892b5ad4359caf3 (diff)
downloadgnulib-0aa8ef42465a8a7828960311230308af7042e414.tar.gz
free: Fix warning.
Reported by Pádraig Brady <P@draigBrady.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00148.html>. * lib/stdlib.in.h (free): New declaration. * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether 'free' is declared. (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_FREE, REPLACE_FREE. * modules/stdlib (Makefile.am): Substitute GNULIB_FREE, REPLACE_FREE. * m4/free.m4 (gl_FUNC_FREE): Set REPLACE_FREE, instead of defining 'free' as a macro here. * modules/free (Depends-on): Add stdlib. (configure.ac): Test REPLACE_FREE. Invoke gl_STDLIB_MODULE_INDICATOR.
Diffstat (limited to 'lib/stdlib.in.h')
-rw-r--r--lib/stdlib.in.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index a76fbdc3d4..a512459e2d 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -284,6 +284,27 @@ _GL_CXXALIAS_SYS (fcvt, char *,
_GL_CXXALIASWARN (fcvt);
#endif
+#if @GNULIB_FREE@
+# if @REPLACE_FREE@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef free
+# define free rpl_free
+# endif
+_GL_FUNCDECL_RPL (free, void, (void *ptr));
+_GL_CXXALIAS_RPL (free, void, (void *ptr));
+# else
+_GL_CXXALIAS_SYS (free, void, (void *ptr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (free);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef free
+/* Assume free is always declared. */
+_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
+ "use gnulib module free for portability");
+#endif
+
/* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
required. In C++ with GNULIB_NAMESPACE, avoid differences between
platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have