bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] xstrtoll-tests: use %lld for long long


From: Paul Eggert
Subject: [PATCH 1/2] xstrtoll-tests: use %lld for long long
Date: Sun, 16 Jan 2022 22:48:29 -0800

* tests/test-xstrtoll.c, tests/test-xstrtoull.c (__spec):
Do not assume long long is 64 bits, or that exact-width
64-bit types exist.  Although these assumptions are true
on current Gnulib platforms they are not true in general.
Also, GCC warns if PRId64 is "ld" but intmax_t is long long
even when long and long long are both 64 bits.
---
 ChangeLog              | 10 ++++++++++
 tests/test-xstrtoll.c  |  2 +-
 tests/test-xstrtoull.c |  2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c941ea151b..a1896fa7d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-01-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       xstrtoll-tests: use %lld for long long
+       * tests/test-xstrtoll.c, tests/test-xstrtoull.c (__spec):
+       Do not assume long long is 64 bits, or that exact-width
+       64-bit types exist.  Although these assumptions are true
+       on current Gnulib platforms they are not true in general.
+       Also, GCC warns if PRId64 is "ld" but intmax_t is long long
+       even when long and long long are both 64 bits.
+
 2022-01-15  Bruno Haible  <bruno@clisp.org>
 
        Don't pass unknown warning option to clang.
diff --git a/tests/test-xstrtoll.c b/tests/test-xstrtoll.c
index 03dd232aee..47a552ebff 100644
--- a/tests/test-xstrtoll.c
+++ b/tests/test-xstrtoll.c
@@ -1,4 +1,4 @@
 #define __xstrtol xstrtoll
 #define __strtol_t long long int
-#define __spec PRId64
+#define __spec "lld"
 #include "test-xstrtol.c"
diff --git a/tests/test-xstrtoull.c b/tests/test-xstrtoull.c
index cb3a91cf0b..cf6c853265 100644
--- a/tests/test-xstrtoull.c
+++ b/tests/test-xstrtoull.c
@@ -1,4 +1,4 @@
 #define __xstrtol xstrtoull
 #define __strtol_t unsigned long long int
-#define __spec PRIu64
+#define __spec "llu"
 #include "test-xstrtol.c"
-- 
2.32.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]