|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:48:54
|
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 232cd0b0f1dfe08177ea2d584913433d23fdd9cf (commit)
from a22e4331e7c9a7377e63dcd3de151e82f9b5ddbf (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 232cd0b0f1dfe08177ea2d584913433d23fdd9cf
Author: Marc Schink <de...@za...>
Date: Thu Feb 26 05:56:57 2026 -0800
Fix build issue on MSYS2 and Cygwin
The is* 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 ISALPHA(3) manual page.
Example error message on Cygwin:
../src/helper/log.c: In function âfind_nonprint_charâ:
../src/helper/log.c:525:33: error: array subscript has type âcharâ [-Werror=char-subscripts]
525 | if (!isprint(buf[i]))
Change-Id: I9c7a5cc1085e15fed0f3f974ec943abad44e68a0
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9478
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/helper/log.c b/src/helper/log.c
index 0976f4e0f..afba0d172 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -526,7 +526,7 @@ void log_socket_error(const char *socket_desc)
const char *find_nonprint_char(const char *buf, unsigned int buf_len)
{
for (unsigned int i = 0; i < buf_len; i++) {
- if (!isprint(buf[i]))
+ if (!isprint((unsigned char)buf[i]))
return buf + i;
}
return NULL;
diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c
index 3f94ffec7..7bf049cd8 100644
--- a/src/jtag/adapter.c
+++ b/src/jtag/adapter.c
@@ -970,7 +970,7 @@ COMMAND_HANDLER(adapter_gpio_config_handler)
while (i < CMD_ARGC) {
LOG_DEBUG("Processing %s", CMD_ARGV[i]);
- if (isdigit(*CMD_ARGV[i])) {
+ if (isdigit((unsigned char)*CMD_ARGV[i])) {
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[i], gpio_config->gpio_num);
++i;
continue;
diff --git a/src/pld/efinix.c b/src/pld/efinix.c
index b6e5f9e47..eff62c62b 100644
--- a/src/pld/efinix.c
+++ b/src/pld/efinix.c
@@ -82,7 +82,8 @@ static int efinix_read_bit_file(struct raw_bit_file *bit_file, const char *filen
return ERROR_PLD_FILE_LOAD_FAILED;
}
- if (!isxdigit(buffer[0]) || !isxdigit(buffer[1])) {
+ if (!isxdigit((unsigned char)buffer[0]) ||
+ !isxdigit((unsigned char)buffer[1])) {
fclose(input_file);
free(bit_file->data);
bit_file->data = NULL;
diff --git a/src/pld/gatemate.c b/src/pld/gatemate.c
index 479f6d183..11b6ae76e 100644
--- a/src/pld/gatemate.c
+++ b/src/pld/gatemate.c
@@ -57,7 +57,8 @@ static int gatemate_read_cfg_line(struct gatemate_bit_file *bit_file, const char
} else if (line_buffer[idx] == 0) {
break;
} else if (idx + 1 < nread) {
- if (isxdigit(line_buffer[idx]) && isxdigit(line_buffer[idx + 1])) {
+ if (isxdigit((unsigned char)line_buffer[idx]) &&
+ isxdigit((unsigned char)line_buffer[idx + 1])) {
uint8_t byte;
unhexify(&byte, line_buffer + idx, 2);
int retval = gatemate_add_byte_to_bitfile(bit_file, byte);
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index ea7f38fb8..83d50c2d0 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -602,7 +602,8 @@ static void telnet_auto_complete(struct connection *connection)
/* user command position in the line, ignore leading spaces */
size_t usr_cmd_pos = seq_start;
- while ((usr_cmd_pos < t_con->line_cursor) && isspace(t_con->line[usr_cmd_pos]))
+ while ((usr_cmd_pos < t_con->line_cursor) &&
+ isspace((unsigned char)t_con->line[usr_cmd_pos]))
usr_cmd_pos++;
/* check user command length */
@@ -616,9 +617,10 @@ static void telnet_auto_complete(struct connection *connection)
* because info commands does not tolerate multiple spaces */
size_t optimized_spaces = 0;
char query[usr_cmd_len + 1];
+
for (size_t i = 0; i < usr_cmd_len; i++) {
- if ((i < usr_cmd_len - 1) && isspace(t_con->line[usr_cmd_pos + i])
- && isspace(t_con->line[usr_cmd_pos + i + 1])) {
+ if ((i < usr_cmd_len - 1) && isspace((unsigned char)t_con->line[usr_cmd_pos + i])
+ && isspace((unsigned char)t_con->line[usr_cmd_pos + i + 1])) {
optimized_spaces++;
continue;
}
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 8054a1c9b..3dffce50e 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -4380,7 +4380,7 @@ static bool parse_csr_address(const char *reg_address_str, unsigned int *reg_add
{
*reg_addr = -1;
/* skip initial spaces */
- while (isspace(reg_address_str[0]))
+ while (isspace((unsigned char)reg_address_str[0]))
++reg_address_str;
/* try to detect if string starts with 0x or 0X */
bool is_hex_address = strncmp(reg_address_str, "0x", 2) == 0 ||
-----------------------------------------------------------------------
Summary of changes:
src/helper/log.c | 2 +-
src/jtag/adapter.c | 2 +-
src/pld/efinix.c | 3 ++-
src/pld/gatemate.c | 3 ++-
src/server/telnet_server.c | 8 +++++---
src/target/riscv/riscv.c | 2 +-
6 files changed, 12 insertions(+), 8 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|