summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/nolibc/nolibc-test.c
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>2025-04-11 11:00:38 +0200
committerThomas Weißschuh <linux@weissschuh.net>2025-04-22 10:56:23 +0200
commit4c99fbc6a06f56e266f60f5f24d0cfd8311b2c09 (patch)
tree1fcf8a163adf10e3ebdd9b7adb7ebf802bcd29fb /tools/testing/selftests/nolibc/nolibc-test.c
parent6d1724ec864b577b50fa9cf668e80390767f4136 (diff)
tools/nolibc: handle intmax_t/uintmax_t in printf
In nolibc intmax_t and uintmax_t are always the same as (unsigned) long long/uint64_t as 128bit numbers are not supported. Even libcs that do support 128bit numbers often fix intmax_t to 64bit as it is used in ABIs and any change would break those. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Acked-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'tools/testing/selftests/nolibc/nolibc-test.c')
-rw-r--r--tools/testing/selftests/nolibc/nolibc-test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index b176a706609b..143dddfcd01a 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -1429,6 +1429,8 @@ static int run_vfprintf(int min, int max)
CASE_TEST(char); EXPECT_VFPRINTF(1, "c", "%c", 'c'); break;
CASE_TEST(hex); EXPECT_VFPRINTF(1, "f", "%x", 0xf); break;
CASE_TEST(pointer); EXPECT_VFPRINTF(3, "0x1", "%p", (void *) 0x1); break;
+ CASE_TEST(uintmax_t); EXPECT_VFPRINTF(20, "18446744073709551615", "%ju", 0xffffffffffffffffULL); break;
+ CASE_TEST(intmax_t); EXPECT_VFPRINTF(20, "-9223372036854775807", "%jd", 0x8000000000000001LL); break;
CASE_TEST(scanf); EXPECT_ZR(1, test_scanf()); break;
case __LINE__:
return ret; /* must be last */