summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-01-03 15:31:53 +0100
committerBruno Haible <bruno@clisp.org>2022-01-03 15:31:53 +0100
commit918e06951df709672d744e7600cc808b065a8e9e (patch)
tree250e48c5fec73e56f40eaf745434e294cd177d5b
parent316ba778dc74385399d7bc10ec0fa1dfb8374e49 (diff)
downloadgnulib-918e06951df709672d744e7600cc808b065a8e9e.tar.gz
realloc-gnu: Allow use as dependency from test modules.
* m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Set REPLACE_REALLOC_FOR_REALLOC_GNU instead of REPLACE_REALLOC. (gl_FUNC_REALLOC_POSIX): Set REPLACE_REALLOC_FOR_REALLOC_POSIX instead of REPLACE_REALLOC. * m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the realloc-gnu module indicator. (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_REALLOC_FOR_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_POSIX, not REPLACE_REALLOC. * modules/stdlib (Makefile.am): Substitute GNULIB_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_POSIX, not REPLACE_REALLOC. * modules/realloc-posix (Depends-on, configure.ac): Test REPLACE_REALLOC_FOR_REALLOC_POSIX instead of REPLACE_REALLOC. * modules/realloc-gnu (Comment): Remove section. (Depends-on): Add free-posix, malloc-gnu, xalloc-oversized. (configure.ac): Test REPLACE_REALLOC_FOR_REALLOC_GNU instead of REPLACE_REALLOC. Set a module indicator. * lib/stdlib.in.h (realloc): Test REPLACE_REALLOC_FOR_REALLOC_POSIX, REPLACE_REALLOC_FOR_REALLOC_GNU, and the respective module indicators instead of just REPLACE_REALLOC.
-rw-r--r--ChangeLog24
-rw-r--r--lib/stdlib.in.h3
-rw-r--r--m4/realloc.m48
-rw-r--r--m4/stdlib_h.m46
-rw-r--r--modules/realloc-gnu11
-rw-r--r--modules/realloc-posix8
-rw-r--r--modules/stdlib4
7 files changed, 46 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index ee1ede3d69..655529e833 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
2022-01-03 Bruno Haible <bruno@clisp.org>
+ realloc-gnu: Allow use as dependency from test modules.
+ * m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Set
+ REPLACE_REALLOC_FOR_REALLOC_GNU instead of REPLACE_REALLOC.
+ (gl_FUNC_REALLOC_POSIX): Set REPLACE_REALLOC_FOR_REALLOC_POSIX instead
+ of REPLACE_REALLOC.
+ * m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the
+ realloc-gnu module indicator.
+ (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_REALLOC_FOR_REALLOC_GNU,
+ REPLACE_REALLOC_FOR_REALLOC_POSIX, not REPLACE_REALLOC.
+ * modules/stdlib (Makefile.am): Substitute GNULIB_REALLOC_GNU,
+ REPLACE_REALLOC_FOR_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_POSIX, not
+ REPLACE_REALLOC.
+ * modules/realloc-posix (Depends-on, configure.ac): Test
+ REPLACE_REALLOC_FOR_REALLOC_POSIX instead of REPLACE_REALLOC.
+ * modules/realloc-gnu (Comment): Remove section.
+ (Depends-on): Add free-posix, malloc-gnu, xalloc-oversized.
+ (configure.ac): Test REPLACE_REALLOC_FOR_REALLOC_GNU instead of
+ REPLACE_REALLOC. Set a module indicator.
+ * lib/stdlib.in.h (realloc): Test REPLACE_REALLOC_FOR_REALLOC_POSIX,
+ REPLACE_REALLOC_FOR_REALLOC_GNU, and the respective module indicators
+ instead of just REPLACE_REALLOC.
+
+2022-01-03 Bruno Haible <bruno@clisp.org>
+
calloc-gnu: Allow use as dependency from test modules.
* m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Set REPLACE_CALLOC_FOR_CALLOC_GNU
instead of REPLACE_CALLOC.
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 64231c2d5f..d52c2f7963 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1109,7 +1109,8 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
#if @GNULIB_REALLOC_POSIX@
-# if @REPLACE_REALLOC@
+# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
+ || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|| _GL_USE_STDLIB_ALLOC)
# undef realloc
diff --git a/m4/realloc.m4 b/m4/realloc.m4
index eb981328ba..86e57c259f 100644
--- a/m4/realloc.m4
+++ b/m4/realloc.m4
@@ -1,4 +1,4 @@
-# realloc.m4 serial 25
+# realloc.m4 serial 26
dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -43,8 +43,8 @@ AC_DEFUN([gl_FUNC_REALLOC_GNU],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
- if test $REPLACE_REALLOC = 0; then
- _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC=1])
+ if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then
+ _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1])
fi
])# gl_FUNC_REALLOC_GNU
@@ -58,6 +58,6 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX],
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then
- REPLACE_REALLOC=1
+ REPLACE_REALLOC_FOR_REALLOC_POSIX=1
fi
])
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index 4e1d99668f..9e2096976f 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 65
+# stdlib_h.m4 serial 66
dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -92,6 +92,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_GNU])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH])
@@ -182,7 +183,8 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R])
REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM])
REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R])
- REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
+ REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU])
+ REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX])
REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY])
REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
diff --git a/modules/realloc-gnu b/modules/realloc-gnu
index 7752d8c6a4..b06a237dd3 100644
--- a/modules/realloc-gnu
+++ b/modules/realloc-gnu
@@ -1,22 +1,21 @@
Description:
realloc() function that is glibc compatible.
-Comment:
-This module should not be used as a dependency from a test module,
-otherwise when this module occurs as a tests-related module, it will
-have side effects on the compilation of the main modules in lib/.
-
Files:
lib/realloc.c
Depends-on:
realloc-posix
+free-posix [test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1]
+malloc-gnu [test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1]
+xalloc-oversized [test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1]
configure.ac:
gl_FUNC_REALLOC_GNU
-if test $REPLACE_REALLOC = 1; then
+if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then
AC_LIBOBJ([realloc])
fi
+gl_STDLIB_MODULE_INDICATOR([realloc-gnu])
Makefile.am:
diff --git a/modules/realloc-posix b/modules/realloc-posix
index a30356f31a..c87d7edd47 100644
--- a/modules/realloc-posix
+++ b/modules/realloc-posix
@@ -8,13 +8,13 @@ m4/malloc.m4
Depends-on:
stdlib
-free-posix [test $REPLACE_REALLOC = 1]
-malloc-posix [test $REPLACE_REALLOC = 1]
-xalloc-oversized [test $REPLACE_REALLOC = 1]
+free-posix [test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1]
+malloc-posix [test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1]
+xalloc-oversized [test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1]
configure.ac:
gl_FUNC_REALLOC_POSIX
-if test $REPLACE_REALLOC = 1; then
+if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then
AC_LIBOBJ([realloc])
fi
gl_STDLIB_MODULE_INDICATOR([realloc-posix])
diff --git a/modules/stdlib b/modules/stdlib
index 63e600d132..45d8f59331 100644
--- a/modules/stdlib
+++ b/modules/stdlib
@@ -60,6 +60,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \
-e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \
-e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
+ -e 's/@''GNULIB_REALLOC_GNU''@/$(GNULIB_REALLOC_GNU)/g' \
-e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
-e 's/@''GNULIB_REALLOCARRAY''@/$(GNULIB_REALLOCARRAY)/g' \
-e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
@@ -142,7 +143,8 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \
-e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \
-e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
- -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
+ -e 's|@''REPLACE_REALLOC_FOR_REALLOC_GNU''@|$(REPLACE_REALLOC_FOR_REALLOC_GNU)|g' \
+ -e 's|@''REPLACE_REALLOC_FOR_REALLOC_POSIX''@|$(REPLACE_REALLOC_FOR_REALLOC_POSIX)|g' \
-e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
-e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \