]> Savannah Git Hosting - gnulib.git/commitdiff
calloc-gnu: Allow use as dependency from test modules.
authorBruno Haible <bruno@clisp.org>
Mon, 3 Jan 2022 14:17:02 +0000 (15:17 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 3 Jan 2022 14:17:02 +0000 (15:17 +0100)
* 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.

ChangeLog
lib/stdlib.in.h
m4/calloc.m4
m4/stdlib_h.m4
modules/calloc-gnu
modules/calloc-posix
modules/stdlib

index 90c019dd4a26ba0234d4154db3d05acc93fe6626..ee1ede3d6963b7282e0fdafff5d8dd7ed1c2fb72 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+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.
index 5664fd216fbf5173398025656daebd6da538eef1..64231c2d5f4978a4a851753c77fa4ad8f3f4f864 100644 (file)
@@ -260,7 +260,8 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
 #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
index 3cc21c5243a10b2268dff89690b96da716b92ede..c01520e53d7257855622bd50846b271094e99677 100644 (file)
@@ -1,4 +1,4 @@
-# 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
@@ -58,8 +58,9 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU],
 [
   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
 
@@ -73,7 +74,7 @@ AC_DEFUN([gl_FUNC_CALLOC_POSIX],
   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
index 69ab51aa3dc2fb937ec9ef76d75ca3ab8500e397..4e1d99668f0556196f5d421674760d71966f63a2 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -68,6 +68,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
     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])
@@ -165,7 +166,8 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   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])
index bbd2a493304cad2bd4476cd839bde75c78f72fc4..037345bad255d4b6f444b0057d767d44861006ad 100644 (file)
@@ -7,12 +7,14 @@ m4/calloc.m4
 
 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:
 
index dc9cadd5cb6652cc79b0c2973296fe350eb42ff7..9ff6913b8293ade66c644b5a6222881b8a80d212 100644 (file)
@@ -8,11 +8,11 @@ m4/malloc.m4
 
 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])
index ed7912b9ff1e513cb342e7b11e6196fbaae0197c..63e600d13231cf6ebf5a3d95d51f503f2c9fceb7 100644 (file)
@@ -37,6 +37,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -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' \
@@ -125,7 +126,8 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -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' \