|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:49:33
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 3d83e9546e1f5050a7079eeca0a18d4259cd4949 (commit)
from 232cd0b0f1dfe08177ea2d584913433d23fdd9cf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3d83e9546e1f5050a7079eeca0a18d4259cd4949
Author: Marc Schink <de...@za...>
Date: Fri Mar 13 13:14:18 2026 +0100
flash/nor/fm4: Fix build on MSYS2 with Clang
The to{upper,lower} macros on MSYS2 (native) and Cygwin are implemented
as table lookups and expect values representable as 'unsigned char'.
Passing a signed char can lead to negative array indices and compile-time
errors (-Werror=char-subscripts).
Add explicit casts to 'unsigned char' to all affected is* calls, as
recommended by the TOUPPER(3) manual page.
Checkpatch-ignore: COMMIT_LOG_LONG_LINE
../src/flash/nor/fm4.c:608:28: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
608 | if (pattern[i] != 'x' && tolower(s[i]) != tolower(pattern[i]))
| ^~~~~~~~~~~~~
/usr/include/ctype.h:172:25: note: expanded from macro 'tolower'
172 | (void) __CTYPE_PTR[__x]; (tolower) (__x);})
| ^~~~
../src/flash/nor/fm4.c:608:45: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
608 | if (pattern[i] != 'x' && tolower(s[i]) != tolower(pattern[i]))
| ^~~~~~~~~~~~~~~~~~~
/usr/include/ctype.h:172:25: note: expanded from macro 'tolower'
172 | (void) __CTYPE_PTR[__x]; (tolower) (__x);})
| ^~~~
Change-Id: If9cca0a252d091bf01774ad33224904d807ee16c
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9539
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/flash/nor/fm4.c b/src/flash/nor/fm4.c
index 2db79ef50..4c8f14c9a 100644
--- a/src/flash/nor/fm4.c
+++ b/src/flash/nor/fm4.c
@@ -605,7 +605,7 @@ static bool fm4_name_match(const char *s, const char *pattern)
if (!pattern[i])
return true;
/* Use x as wildcard */
- if (pattern[i] != 'x' && tolower(s[i]) != tolower(pattern[i]))
+ if (pattern[i] != 'x' && tolower((unsigned char)s[i]) != tolower((unsigned char)pattern[i]))
return false;
i++;
}
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/fm4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
hooks/post-receive
--
Main OpenOCD repository
|