From 3ad52f3e21db96096105256ff66ebf480703a09f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 21 May 2023 18:25:45 -0700 Subject: [PATCH] strtol: match 'configure' to 'make check' MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Inferred from report by Tomasz Kłoczko . * m4/strtol.m4 (gl_FUNC_STRTOL): * m4/strtoll.m4 (gl_FUNC_STRTOLL): Also test "0b", since the test cases check it. --- ChangeLog | 6 ++++++ m4/strtol.m4 | 16 +++++++++++----- m4/strtoll.m4 | 16 +++++++++++----- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b29eed568..37eb0a06c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2023-05-21 Paul Eggert + strtol: match 'configure' to 'make check' + Inferred from report by Tomasz Kłoczko . + * m4/strtol.m4 (gl_FUNC_STRTOL): + * m4/strtoll.m4 (gl_FUNC_STRTOLL): + Also test "0b", since the test cases check it. + git-merge-changelog: port to size_t padding * lib/git-merge-changelog (entry_hashcode): As a nicety, Prefer SIZE_WIDTH to computing it ourselves. diff --git a/m4/strtol.m4 b/m4/strtol.m4 index 5cdd86adc7..b5ea56f229 100644 --- a/m4/strtol.m4 +++ b/m4/strtol.m4 @@ -1,4 +1,4 @@ -# strtol.m4 serial 8 +# strtol.m4 serial 9 dnl Copyright (C) 2002-2003, 2006, 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,10 +19,16 @@ AC_DEFUN([gl_FUNC_STRTOL], char *term; /* This test fails on Minix and native Windows. */ { - const char input[] = "0x"; - (void) strtol (input, &term, 16); - if (term != input + 1) - result |= 1; + static char const input[2][3] = {"0x", "0b"}; + static int const base[] = {0, 2, 10}; + int i, j; + for (i = 0; i < 2; i++) + for (j = 0; j < 3; j++) + { + (void) strtol (input[i], &term, base[j]); + if (term != input[i] + 1) + result |= 1; + } } /* This test fails on pre-C23 platforms. */ { diff --git a/m4/strtoll.m4 b/m4/strtoll.m4 index ec09609cd4..a0cbc805bc 100644 --- a/m4/strtoll.m4 +++ b/m4/strtoll.m4 @@ -1,4 +1,4 @@ -# strtoll.m4 serial 10 +# strtoll.m4 serial 11 dnl Copyright (C) 2002, 2004, 2006, 2008-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,10 +19,16 @@ AC_DEFUN([gl_FUNC_STRTOLL], char *term; /* This test fails on Minix and native Windows. */ { - const char input[] = "0x"; - (void) strtoll (input, &term, 16); - if (term != input + 1) - result |= 1; + static char const input[2][3] = {"0x", "0b"}; + static int const base[] = {0, 2, 10}; + int i, j; + for (i = 0; i < 2; i++) + for (j = 0; j < 3; j++) + { + (void) strtoll (input[i], &term, base[j]); + if (term != input[i] + 1) + result |= 1; + } } /* This test fails on pre-C23 platforms. */ { -- 2.39.5