This is an automated email from Gerrit. "Antonio Borneo <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9431
-- gerrit commit 85582bbe4c98b85a5f6f49d922b855ebafb0107f Author: Antonio Borneo <[email protected]> Date: Mon Feb 2 14:52:45 2026 +0100 configure: silent MacOS clang warning gnu-folding-constant On the specific fork of clang for MacOS, the compiler gets more strict on the use of GNU folding constants, generating warnings that halts the build of OpenOCD. The GNU folding constants are highlighted by upstream clang only for global variables. E.g.: const int len = 10; int array[len]; generates the warning on: clang -c x.c x.c:2:5: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant] int array[len]; ^ Apparently only the MacOS fork generates warning for folded constants inside a function. E.g.: int a(int *x); int b(void) { const int len = 10; int array[len]; return a*array); } does not return error even forcing -Wgnu-folding-constant on clang upstream. Current code triggers warning on the following lines due to the size of the array being computed from a const variable: jtag/drivers/xds110.c:354 unsigned char data[max_data + 1]; flash/nor/dw-spi.c:950 uint8_t buffer[buffer_size]; flash/nor/dw-spi.c:980 uint8_t buffer[buffer_size]; flash/nor/dw-spi.c:1034 uint8_t buffer[buffer_size]; flash/nor/dw-spi.c:1065 uint8_t buffer[buffer_size]; flash/nor/jtagspi.c:364 uint8_t ..., write_buffer[max], ...; flash/nor/stmqspi.c:778 char ..., output[(2 + max + 256) * 3 + 8]; flash/nor/xcf.c:392 uint8_t reference[L]; target/target.c:3303 char output[line_bytecnt * 4 + 1]; target/semihosting_common.c:1787 char buf[buf_len]; target/smp.c:59 char hex_buffer[len * 2 + 1]; target/smp.c:60 uint8_t buffer[len]; target/cortex_m.c:296 uint32_t r_vals[n_r32]; target/cortex_m.c:297 uint32_t dhcsr[n_r32]; target/x86_32_common.c:1337 char output[line_bytecnt * 4 + 1]; target/riscv/riscv.c:2377 uint8_t buffer[length]; target/xtensa/xtensa.c:536 uint8_t ops_padded[max_oplen]; While some of the const variable above could be replaced by macros, for the majority of them I don't see such need, and the use of const looks to me correct. Silent the warning adding the clang flag -Wno-gnu-folding-constant. The flag is not recognized by GCC, but it's silently ignored. Change-Id: I1d452af115355bc4949b1616648fe6544cc48318 Reported-by: Frank Zeyda <[email protected]> Signed-off-by: Antonio Borneo <[email protected]> diff --git a/configure.ac b/configure.ac index c452cf5d3d..5bb76fe004 100644 --- a/configure.ac +++ b/configure.ac @@ -763,6 +763,7 @@ AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).]) GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow" AS_IF([test "x${gcc_wextra}" = "xyes"], [ GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter" + GCC_WARNINGS="${GCC_WARNINGS} -Wno-gnu-folding-constant" GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast" GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align" GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls" --
