[hatari-devel] Warnings with Windows build

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hello,

after updating my Windows cross-compiling environment to Debian 11
("bullseye") with x86_64-w64-mingw32-gcc 10, I get some warnings related
to the "%lld" format specifier, when used in user-defined functions. For
example:

/home/czietz/hatari/src/ide.c: In function ‘bdrv_open’:
/home/czietz/hatari/src/ide.c:617:27: warning: unknown conversion type character ‘l’ in format [-Wformat=]
  617 |   Log_AlertDlg(LOG_ERROR, "IDE disk image size (%"PRId64" bytes) is "
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/czietz/hatari/src/ide.c:16:
/usr/share/mingw-w64/include/inttypes.h:33:18: note: format string is defined here
   33 | #define PRId64 "lld"
      |                  ^
/home/czietz/hatari/src/ide.c:617:27: warning: too many arguments for format [-Wformat-extra-args]
  617 |   Log_AlertDlg(LOG_ERROR, "IDE disk image size (%"PRId64" bytes) is "
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~
The reason for the warning is explained here:
https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/

Note that it actually *works* fine, since -- as stated above -- the
Windows C runtime does in fact know about "%lld" in all currently
supported Windows versions. Therefore, this is a superfluous warning, imho..

The workaround described above (__MINGW_PRINTF_FORMAT macro) will of
course fail when building for other platforms. I don't know whether the
Hatari developers like to build another macro on top of it.

Regards
Christian
--
Christian Zietz  -  CHZ-Soft  -  czietz@xxxxxxx
WWW: https://www.chzsoft.de/
PGP/GnuPG-Key-ID: 0x52CB97F66DA025CA / 0x6DA025CA



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/