Skip to content

Commit 218b45b

Browse files
dcpleungnashif
authored andcommitted
logging: fix warning of array subscript having type char
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 <[email protected]>
1 parent 37f94d6 commit 218b45b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/logging/log_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static u32_t count_s(const char *str, u32_t nargs)
109109
while ((curr = *str++) && arg < nargs) {
110110
if (curr == '%') {
111111
arm = !arm;
112-
} else if (arm && isalpha(curr)) {
112+
} else if (arm && isalpha((int)curr)) {
113113
if (curr == 's') {
114114
mask |= BIT(arg);
115115
}

0 commit comments

Comments
 (0)