Re: [hatari-devel] Warnings with Windows build |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Warnings with Windows build
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Sun, 21 Aug 2022 09:16:15 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1661073379; bh=l4p3EXoRI/NW0gJPdom/nBcDpGcfIut9Vo1FFkYu4+k=; h=Date:From:To:Subject:From; b=MCHsmpTGP9fsQ/TtJR4fY39qvlxhIuZRO5CvAAH13UoNzGuezMRi2DLyHKodNVdZl /knLiMdXWl0TQiTIE9674+6XCxAJt6aRshZF6HL6R1AVSXxcpbzGKm1kpReNzxjakW Nmtl/ederi/IrBsenoFnGRqEG4dFsN75yCQztDXnrC9W4mJ1FaWc2s/Hpnw0lrmflN 0wAOQTYVOHJ87M2RMisYLJfjyru/AAZnBMU+gc4+7v5laWJFYjp92DRrFFivkcLqQZ MjdQhFp7pL69xekZLUSRj2jKeS3jAxgFGdw5/fyt69y/p7boM6Op4ufbQRIDF071UX DAGg+l+PH8Dkg==
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