]> Savannah Git Hosting - gnulib.git/commitdiff
reallocarray: Fix compilation error in C++ mode (regr. 2024-11-04).
authorBruno Haible <bruno@clisp.org>
Wed, 6 Nov 2024 04:05:26 +0000 (05:05 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 6 Nov 2024 04:05:26 +0000 (05:05 +0100)
* m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY): Don't use
REPLACE_REALLOC_FOR_REALLOC_POSIX here. Use gl_cv_malloc_ptrdiff
instead.

ChangeLog
m4/reallocarray.m4

index a7af54907aa8776b2710db758fdb39dd7c6bfd0d..1a2acaaf680047381c039a8248e2188a2489add6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-11-06  Bruno Haible  <bruno@clisp.org>
+
+       reallocarray: Fix compilation error in C++ mode (regr. 2024-11-04).
+       * m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY): Don't use
+       REPLACE_REALLOC_FOR_REALLOC_POSIX here. Use gl_cv_malloc_ptrdiff
+       instead.
+
 2024-11-05  Bruno Haible  <bruno@clisp.org>
 
        wmemset tests: Verify N3322 functionality.
index cc2ef2ccaaf6c4b12c93faa839d9a594b8beb497..c115dfbe45432ed4f118a8fd3f5dd6070f1269da 100644 (file)
@@ -1,5 +1,5 @@
 # reallocarray.m4
-# serial 6
+# serial 7
 dnl Copyright (C) 2017-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,7 +14,6 @@ AC_DEFUN([gl_FUNC_REALLOCARRAY],
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF])
   AC_REQUIRE([gl_FUNC_REALLOC_0_NONNULL])
-  REPLACE_REALLOCARRAY=$REPLACE_REALLOC_FOR_REALLOC_POSIX
   gl_CHECK_FUNCS_ANDROID([reallocarray], [[#include <stdlib.h>]])
   if test "$ac_cv_func_reallocarray" = no; then
     HAVE_REALLOCARRAY=0
@@ -22,7 +21,10 @@ AC_DEFUN([gl_FUNC_REALLOCARRAY],
       future*) REPLACE_REALLOCARRAY=1 ;;
     esac
   else
-    case $gl_cv_func_realloc_0_nonnull in
+    if test "$gl_cv_malloc_ptrdiff" = no; then
+      REPLACE_REALLOCARRAY=1
+    fi
+    case "$gl_cv_func_realloc_0_nonnull" in
       *yes) ;;
       *) REPLACE_REALLOCARRAY=1 ;;
     esac