Re: [hatari-devel] Warnings with Windows build

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


Am Sun, 21 Aug 2022 11:03:37 +0200
schrieb Christian Zietz <czietz@xxxxxxx>:

> Thomas Huth schrieb:
> 
> > 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.  
> 
> I cannot agree. MinGW *does* in fact get its own macros right. Neither...
> 
> printf("%lld", (uint64_t)x);
> 
> ... nor...
> 
> printf("%" PRId64, (uint64_t)x);
> 
> ... causes a warning. This is all handled correctly by MinGW.
> 
> I can only point (for the *third* time) towards the link that I posted.
> If you define you *own* function (like Hatari does) using
> "__attribute__((__format__ (printf [...]", gcc cannot safely know
> whether you might actually call a MSVCRT version of printf() that does
> not support "%lld", like on Windows XP.

Well, if the compiler is unsure, it should not enable that warning by
default with "-Wall". Maybe with "-Wextra", but certainly not with "-Wall".

I tried to workaround the problem when I saw it back then with Fedora 34,
but that only caused other issues (sorry, I don't remember the details), so
I certainly won't be trying to fix that now again. Also consider that the
warning is gone with later versions of MinGW again, so that's really an
indication that they were on the wrong track here. If the warning bugs you,
then simply switch it off in your CFLAGS.

 Thomas



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