+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.
+ (gl_FUNC_CALLOC_POSIX): Set REPLACE_CALLOC_FOR_CALLOC_POSIX instead of
+ REPLACE_CALLOC.
+ * m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the
+ calloc-gnu module indicator.
+ (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_CALLOC_FOR_CALLOC_GNU,
+ REPLACE_CALLOC_FOR_CALLOC_POSIX, not REPLACE_CALLOC.
+ * modules/stdlib (Makefile.am): Substitute GNULIB_CALLOC_GNU,
+ REPLACE_CALLOC_FOR_CALLOC_GNU, REPLACE_CALLOC_FOR_CALLOC_POSIX, not
+ REPLACE_CALLOC.
+ * modules/calloc-posix (Depends-on, configure.ac): Test
+ REPLACE_CALLOC_FOR_CALLOC_POSIX instead of REPLACE_CALLOC.
+ * modules/calloc-gnu (Depends-on): Add xalloc-oversized.
+ (configure.ac): Test REPLACE_CALLOC_FOR_CALLOC_GNU instead of
+ REPLACE_CALLOC. Set a module indicator.
+ * lib/stdlib.in.h (calloc): Test REPLACE_CALLOC_FOR_CALLOC_POSIX,
+ REPLACE_CALLOC_FOR_CALLOC_GNU, and the respective module indicators
+ instead of just REPLACE_CALLOC.
+
2022-01-03 Bruno Haible <bruno@clisp.org>
malloc-gnu: Allow use as dependency from test modules.
#endif
#if @GNULIB_CALLOC_POSIX@
-# if @REPLACE_CALLOC@
+# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
+ || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef calloc
# define calloc rpl_calloc
-# calloc.m4 serial 28
+# calloc.m4 serial 29
# Copyright (C) 2004-2022 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_CALLOC_POSIX])
- if test $REPLACE_CALLOC = 0; then
- _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC=1])
+ REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX"
+ if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then
+ _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1])
fi
])# gl_FUNC_CALLOC_GNU
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then
- REPLACE_CALLOC=1
+ REPLACE_CALLOC_FOR_CALLOC_POSIX=1
fi
dnl Although in theory we should also test for size_t overflow,
dnl in practice testing for ptrdiff_t overflow suffices
-# stdlib_h.m4 serial 64
+# stdlib_h.m4 serial 65
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,
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_POSIX])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX])
HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV])
REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC])
- REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC])
+ REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU])
+ REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX])
REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
REPLACE_FREE=0; AC_SUBST([REPLACE_FREE])
REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE])
Depends-on:
calloc-posix
+xalloc-oversized [test $REPLACE_REALLOC_FOR_CALLOC_GNU = 1]
configure.ac:
gl_FUNC_CALLOC_GNU
-if test $REPLACE_CALLOC = 1; then
+if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then
AC_LIBOBJ([calloc])
fi
+gl_STDLIB_MODULE_INDICATOR([calloc-gnu])
Makefile.am:
Depends-on:
stdlib
-xalloc-oversized [test $REPLACE_REALLOC = 1]
+xalloc-oversized [test $REPLACE_REALLOC_FOR_CALLOC_POSIX = 1]
configure.ac:
gl_FUNC_CALLOC_POSIX
-if test $REPLACE_CALLOC = 1; then
+if test $REPLACE_CALLOC_FOR_CALLOC_POSIX = 1; then
AC_LIBOBJ([calloc])
fi
gl_STDLIB_MODULE_INDICATOR([calloc-posix])
-e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \
-e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GNULIB_ALIGNED_ALLOC)/g' \
-e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \
+ -e 's/@''GNULIB_CALLOC_GNU''@/$(GNULIB_CALLOC_GNU)/g' \
-e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \
-e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \
-e 's/@''GNULIB_FREE_POSIX''@/$(GNULIB_FREE_POSIX)/g' \
-e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
-e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
-e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \
- -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
+ -e 's|@''REPLACE_CALLOC_FOR_CALLOC_GNU''@|$(REPLACE_CALLOC_FOR_CALLOC_GNU)|g' \
+ -e 's|@''REPLACE_CALLOC_FOR_CALLOC_POSIX''@|$(REPLACE_CALLOC_FOR_CALLOC_POSIX)|g' \
-e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
-e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \
-e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \