From 218b45b74964616457968eed5462d2924d91fc11 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Thu, 12 Dec 2019 17:13:05 -0800 Subject: [PATCH] logging: fix warning of array subscript having type `char` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the count_s() function, with -Wchar-subscripts, GCC warns about array subscript having type ‘char’ with the isalpha() call. Since isalpha() takes an int, so do a type-cast there to get rid of the warning. This happens on XCC which is based on GCC 4.2. Signed-off-by: Daniel Leung --- subsys/logging/log_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/logging/log_core.c b/subsys/logging/log_core.c index dbddbd5c0f..3ca1fc3f9b 100644 --- a/subsys/logging/log_core.c +++ b/subsys/logging/log_core.c @@ -109,7 +109,7 @@ static u32_t count_s(const char *str, u32_t nargs) while ((curr = *str++) && arg < nargs) { if (curr == '%') { arm = !arm; - } else if (arm && isalpha(curr)) { + } else if (arm && isalpha((int)curr)) { if (curr == 's') { mask |= BIT(arg); }