From 6ba3df05fe8ed1f93814e48c0445711fcbec16f8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 6 Nov 2024 05:05:26 +0100 Subject: [PATCH] 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. --- ChangeLog | 7 +++++++ m4/reallocarray.m4 | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7af54907a..1a2acaaf68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-11-06 Bruno Haible + + 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 wmemset tests: Verify N3322 functionality. diff --git a/m4/reallocarray.m4 b/m4/reallocarray.m4 index cc2ef2ccaa..c115dfbe45 100644 --- a/m4/reallocarray.m4 +++ b/m4/reallocarray.m4 @@ -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 ]]) 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 -- 2.39.5