Files
openocd/src/helper/log.c
Marc Schink b80f554fd9 helper/log: Fix build issue on MSYS2 and Cygwin
On MSYS2 (native) and Cygwin, the mallinfo struct uses 'size_t' instead
of 'int', which leads to a compile-time error with the current code.

Update the preprocessor logic so that Cygwin and MSYS2 builds use
the 'size_t' format specifier.

Checkpatch-ignore: COMMIT_LOG_LONG_LINE

Build error on MSYS2:

../src/helper/log.c: In function 'get_free_memory_space':
../src/helper/log.c:78:45: error: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
   78 |                 snprintf(s, MEM_STR_LEN, " %d", info.fordblks);
      |                                            ~^   ~~~~~~~~~~~~~
      |                                             |       |
      |                                             int     size_t {aka long unsigned int}
      |                                            %ld

Change-Id: I18d772facba6426ab627fb45a6d50bfc19ec9c05
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9479
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2026-04-06 16:49:47 +00:00

13 KiB