[libc-commits] [libc] [libc] Clean up remaining use of *_WIDTH macros in printf (PR #102679)

Roland McGrath via libc-commits libc-commits at lists.llvm.org
Fri Aug 9 13:36:21 PDT 2024


https://github.com/frobtech updated https://github.com/llvm/llvm-project/pull/102679

>From e7b905bc39f054d98416257eb6ed0985468f5c94 Mon Sep 17 00:00:00 2001
From: Roland McGrath <mcgrathr at google.com>
Date: Fri, 9 Aug 2024 13:33:33 -0700
Subject: [PATCH] [libc] Clean up remaining use of *_WIDTH macros in printf

The previous change missed the second spot doing the same thing.

Bug: https://issues.fuchsia.dev/358196552
---
 libc/src/stdio/printf_core/parser.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h
index 684911a567569..1084cdc4349da 100644
--- a/libc/src/stdio/printf_core/parser.h
+++ b/libc/src/stdio/printf_core/parser.h
@@ -597,11 +597,11 @@ template <typename ArgProvider> class Parser {
             break;
           case (LengthModifier::w):
           case (LengthModifier::wf):
-            if (bw <= INT_WIDTH) {
+            if (bw <= cpp::numeric_limits<unsigned int>::digits) {
               conv_size = type_desc_from_type<int>();
-            } else if (bw <= LONG_WIDTH) {
+            } else if (bw <= cpp::numeric_limits<unsigned long>::digits) {
               conv_size = type_desc_from_type<long>();
-            } else if (bw <= LLONG_WIDTH) {
+            } else if (bw <= cpp::numeric_limits<unsigned long long>::digits) {
               conv_size = type_desc_from_type<long long>();
             } else {
               conv_size = type_desc_from_type<intmax_t>();



More information about the libc-commits mailing list