Compilation failure on gcc-15.2.0
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 67/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- c
- Lĩnh vực
- devtools, embedded-iot
Hướng nghiên cứu
Review the supplied patch across the listed files under src/flash/nor, src/helper, src/rtos, src/server, and src/target. Start by reproducing the OpenOCD build with gcc-15.2.0, then check the proposed changes against the affected call sites. Done means OpenOCD compiles successfully with that compiler.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
OpenOCD fails to compile on gcc-15.2.0. Fixed and include a patch. Feel free to use.
From cbacacbbfbfc5b1a9c8280ab25d9845201a58574 Mon Sep 17 00:00:00 2001
Date: Wed, 8 Jul 2026 14:24:10 +0200
Subject: [PATCH] fix compiler errors for gcc 15.2.0
src/flash/nor/ambiqmicro.c | 2 +-
src/flash/nor/at91sam7.c | 4 ++--
src/flash/nor/kinetis.c | 4 ++--
src/flash/nor/max32xxx.c | 2 +-
src/flash/nor/msp432.c | 2 +-
src/flash/nor/stellaris.c | 2 +-
src/flash/nor/stldr_driver.c | 4 ++--
src/flash/nor/stm32f2x.c | 2 +-
src/helper/log.c | 2 +-
src/helper/options.c | 2 +-
src/rtos/eCos.c | 2 +-
src/server/telnet_server.c | 2 +-
src/target/arc_jtag.c | 4 ++--
13 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/flash/nor/ambiqmicro.c b/src/flash/nor/ambiqmicro.c
index 2b458bc8f..bb893778c 100644
--- a/src/flash/nor/ambiqmicro.c
+++ b/src/flash/nor/ambiqmicro.c
@@ -124,7 +124,7 @@ FLASH_BANK_COMMAND_HANDLER(ambiqmicro_flash_bank_command)
if (CMD_ARGC < 6)
return ERROR_COMMAND_SYNTAX_ERROR;
- ambiqmicro_info = calloc(sizeof(struct ambiqmicro_flash_bank), 1);
-
ambiqmicro_info = calloc(1, sizeof(struct ambiqmicro_flash_bank));
bank->driver_priv = ambiqmicro_info;
diff --git a/src/flash/nor/at91sam7.c b/src/flash/nor/at91sam7.c
index 6879a1bf2..86c80765f 100644
--- a/src/flash/nor/at91sam7.c
+++ b/src/flash/nor/at91sam7.c
@@ -560,7 +560,7 @@ static int at91sam7_read_part_info(struct flash_bank bank)
if (bnk > 0) {
if (!t_bank->next) {
/ create a new flash bank element */
-
struct flash_bank *fb = calloc(sizeof(struct flash_bank), 1);
-
struct flash_bank *fb = calloc(1, sizeof(struct flash_bank)); if (!fb) { LOG_ERROR("No memory for flash bank"); return ERROR_FAIL;
@@ -748,7 +748,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command)
if (bnk > 0) {
if (!t_bank->next) {
/* create a new bank element */
-
struct flash_bank *fb = calloc(sizeof(struct flash_bank), 1);
-
struct flash_bank *fb = calloc(1, sizeof(struct flash_bank)); if (!fb) { LOG_ERROR("No memory for flash bank"); return ERROR_FAIL;
diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c
index e8074e35b..fee36444e 100644
--- a/src/flash/nor/kinetis.c
+++ b/src/flash/nor/kinetis.c
@@ -930,7 +930,7 @@ FLASH_BANK_COMMAND_HANDLER(kinetis_flash_bank_command)
k_chip = kinetis_get_chip(target);
if (!k_chip) {
-
k_chip = calloc(sizeof(struct kinetis_chip), 1);
-
k_chip = calloc(1, sizeof(struct kinetis_chip)); if (!k_chip) { LOG_ERROR("No memory"); return ERROR_FAIL;
@@ -1031,7 +1031,7 @@ static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
bank_idx - k_chip->num_pflash_blocks);
}
-
bank = calloc(sizeof(struct flash_bank), 1);
-
bank = calloc(1, sizeof(struct flash_bank)); if (!bank) return ERROR_FAIL;
diff --git a/src/flash/nor/max32xxx.c b/src/flash/nor/max32xxx.c
index 51d6ae271..59a14af8b 100644
--- a/src/flash/nor/max32xxx.c
+++ b/src/flash/nor/max32xxx.c
@@ -87,7 +87,7 @@ FLASH_BANK_COMMAND_HANDLER(max32xxx_flash_bank_command)
return ERROR_FLASH_BANK_INVALID;
}
- info = calloc(sizeof(struct max32xxx_flash_bank), 1);
-
info = calloc(1, sizeof(struct max32xxx_flash_bank));
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[2], info->flash_size);
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[6], info->flc_base);
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[7], info->sector_size);
diff --git a/src/flash/nor/msp432.c b/src/flash/nor/msp432.c
index 5e2935d02..b5e2b0bf8 100644
--- a/src/flash/nor/msp432.c
+++ b/src/flash/nor/msp432.c
@@ -937,7 +937,7 @@ static int msp432_probe(struct flash_bank *bank)if (is_main && MSP432P4 == msp432_bank->family_type) {
/* Create the info flash bank needed by MSP432P4 variants */
-
struct flash_bank *info = calloc(sizeof(struct flash_bank), 1);
-
struct flash_bank *info = calloc(1, sizeof(struct flash_bank)); if (!info) return ERROR_FAIL;
diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c
index 972686e3f..eab6244d4 100644
--- a/src/flash/nor/stellaris.c
+++ b/src/flash/nor/stellaris.c
@@ -453,7 +453,7 @@ FLASH_BANK_COMMAND_HANDLER(stellaris_flash_bank_command)
if (CMD_ARGC < 6)
return ERROR_COMMAND_SYNTAX_ERROR;
- stellaris_info = calloc(sizeof(struct stellaris_flash_bank), 1);
- stellaris_info = calloc(1, sizeof(struct stellaris_flash_bank));
bank->base = 0x0;
bank->driver_priv = stellaris_info;
diff --git a/src/flash/nor/stldr_driver.c b/src/flash/nor/stldr_driver.c
index bdc8678a3..559a29b2a 100644
--- a/src/flash/nor/stldr_driver.c
+++ b/src/flash/nor/stldr_driver.c
@@ -264,7 +264,7 @@ static int stldr_parse(struct flash_bank *bank, const char *stldr_path)
return ERROR_FAIL;
}
-
struct stldr_section *section = calloc(sizeof(struct stldr_section), 1);
-
struct stldr_section *section = calloc(1, sizeof(struct stldr_section)); if (!section) { free(content); return ERROR_FAIL;
@@ -416,7 +416,7 @@ FLASH_BANK_COMMAND_HANDLER(stldr_flash_bank_command)
if (CMD_ARGC != 6 && CMD_ARGC != 7)
return ERROR_COMMAND_SYNTAX_ERROR;
- stldr_info = calloc(sizeof(struct stldr_flash_bank), 1);
-
stldr_info = calloc(1, sizeof(struct stldr_flash_bank));
if (!stldr_info) {
LOG_ERROR("Out of memory");
return ERROR_FAIL;
diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c
index 4e0f73182..3bafde56f 100644
--- a/src/flash/nor/stm32f2x.c
+++ b/src/flash/nor/stm32f2x.c
@@ -1020,7 +1020,7 @@ static int stm32x_probe(struct flash_bank *bank)
assert(num_sectors > 0);bank->num_sectors = num_sectors;
-
bank->sectors = calloc(sizeof(struct flash_sector), num_sectors);
-
bank->sectors = calloc(num_sectors, sizeof(struct flash_sector)); if (stm32x_otp_is_f7(bank)) bank->size = STM32F7_OTP_SIZE;
diff --git a/src/helper/log.c b/src/helper/log.c
index 471069ade..2bf4efc78 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -81,7 +81,7 @@ static void log_puts(enum log_levels level,
const char *function,
const char *string)
{
- char *f;
-
const char *f;
if (!log_output) {
/* log_init() not called yet; print on stderr */
diff --git a/src/helper/options.c b/src/helper/options.c
index 61a101469..643007931 100644
--- a/src/helper/options.c
+++ b/src/helper/options.c
@@ -151,7 +151,7 @@ static char *find_relative_path(const char *from, const char *to)
while (from[0] != '\0') {
if (from[0] != '/')
i++;
-
char *next = strchr(from, '/');
-
const char *next = strchr(from, '/'); if (!next) break; from = next + 1;
diff --git a/src/rtos/eCos.c b/src/rtos/eCos.c
index 10ed12809..aca2f4ebc 100644
--- a/src/rtos/eCos.c
+++ b/src/rtos/eCos.c
@@ -511,7 +511,7 @@ static bool ecos_escape_string(const char *raw, char *out, size_t limit)
continue;
}
-
char *fidx = strchr(tokens, *raw);
-
const char *fidx = strchr(tokens, *raw); if (!fidx) { /* Should never happen assuming xmlchars * vector and tokens string match. */
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index 938bc5b06..fa3523553 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -68,7 +68,7 @@ static int telnet_outputline(struct connection *connection, const char *line)
/* process lines in buffer */
while (*line) {
-
char *line_end = strchr(line, '\n');
-
const char *line_end = strchr(line, '\n'); if (line_end) len = line_end-line;
diff --git a/src/target/arc_jtag.c b/src/target/arc_jtag.c
index ddb4f6232..a186709c6 100644
--- a/src/target/arc_jtag.c
+++ b/src/target/arc_jtag.c
@@ -298,7 +298,7 @@ static int arc_jtag_read_registers(struct arc_jtag *jtag_info, uint32_t type,
ARC_JTAG_READ_FROM_CORE_REG : ARC_JTAG_READ_FROM_AUX_REG);
arc_jtag_enque_set_transaction(jtag_info, transaction, TAP_DRPAUSE);
- uint8_t *data_buf = calloc(sizeof(uint8_t), count * 4);
-
uint8_t *data_buf = calloc(count * 4, sizeof(uint8_t));
arc_jtag_enque_register_rw(jtag_info, addr, data_buf, NULL, count);
@@ -498,7 +498,7 @@ int arc_jtag_read_memory(struct arc_jtag *jtag_info, uint32_t addr,
if (!count)
return ERROR_OK;
- data_buf = calloc(sizeof(uint8_t), count * 4);
-
data_buf = calloc(count * 4, sizeof(uint8_t));
arc_jtag_enque_reset_transaction(jtag_info);/* We are reading from memory. */
--
2.53.0
- Ngôn ngữ chính
- C
- Star
- 202
- Fork
- 57
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của STMicroelectronics/OpenOCD
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
bug
STMicroelectronics/OpenOCD#44 · 1 bình luận · 1 người được giao ·
-
Request to upstream STM32 support (e.g. STM32H5) or provide pre-built binaries of the ST fork Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
STMicroelectronics/OpenOCD#42 · 9 bình luận · 5 reaction ·
Tất cả issue của STMicroelectronics/OpenOCD
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
zephyrproject-rtos/zephyr#120318 · 1 bình luận ·
-
issue: bug report
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
darktable-org/darktable#22386 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100