Re: [hatari-devel] Warnings with Windows build

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


Am Sun, 21 Aug 2022 09:38:58 +0200
schrieb Christian Zietz <czietz@xxxxxxx>:

> 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.

I agree, it's a completely bad warning. I would agree that something should
be done if we'd use %lld directly, but we're using the portable PRId64
macro here, and if MiNGW does not get its own macros right, it's rather a
problem on the MinGW side as far as I can tell.

By the way, the problem also occurred earlier already with Fedora:

 https://git.tuxfamily.org/hatari/hatari.git/commit/?id=89ce85e772bc5ccd1ddb4

Back then, I already had a look at this and decided to *not* trying to bend
Hatari around this weirdness but rather to ignore it.

 Thomas



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