Re: [hatari-devel] My cross-compiling experience |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] My cross-compiling experience
- From: Christian Zietz <czietz@xxxxxxx>
- Date: Sat, 2 May 2020 13:34:05 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1588419246; bh=GPUZGJy0pvTRX7Rm5C4+gE+xugRmO6kNQYIq2afDMo0=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=ZeFh4DoqOxJ39fjuw8ijJUA/CgzoJR2wRWcYqVDGYOWTHHzGsQ0r0wZKjzUqErXM6 y4azjkRHfEZ+lTmeJ2vwHqvFQGzTLS5E9xdETaM0Sg5AScZFDRvCYIv4vqm838/n6N DI9bhedjgQSuyVSfIk6jDFSukz8jZtN+LIvKBxE4=
Thorsten Otto schrieb:
> Yes, that are typical problems when building programs for mingw, not
> only when cross-compiling. I get lots of such warnings also when
> building the m68k-atari-mint cross-compiler for mingw. The native msvcrt
> on windows expects %I64 modifier for long long types, while typically on
> linux %ll is used.
Although this doesn't seem to apply to current (Windows 10) versions of
MSVCRT, anymore. Because (using Windows Subsystem for Linux again)...
czietz@Notebook:~$ cat foo.c
#include <stdio.h>
volatile long long int bar = 424242424242LL;
int main(void) {
printf("%lld\n", bar);
return 0;
}
czietz@Notebook:~$ x86_64-w64-mingw32-gcc -Wformat -O -o foo.exe foo.c
foo.c: In function ‘main’:
foo.c:6:12: warning: unknown conversion type character ‘l’ in format
[-Wformat=]
printf("%lld\n", bar);
^
foo.c:6:9: warning: too many arguments for format [-Wformat-extra-args]
printf("%lld\n", bar);
^~~~~~~~
foo.c:6:12: warning: unknown conversion type character ‘l’ in format
[-Wformat=]
printf("%lld\n", bar);
^
foo.c:6:9: warning: too many arguments for format [-Wformat-extra-args]
printf("%lld\n", bar);
^~~~~~~~
czietz@Notebook:~$ ./foo.exe
424242424242
Even though mingw gcc warns about it, for me this works as expected. I
confirmed (by disassembly) that MSVCRT printf is in fact called with
"%lld" as format string. Therefore, I expect no issues from the warning
during Hatari's compilation, either.
A portable solution would be to use format specifiers from inttypes.h,
like in ikbd.c.
Regards
Christian
--
Christian Zietz - CHZ-Soft - czietz@xxxxxxx
WWW: https://www.chzsoft.de/
PGP/GnuPG-Key-ID: 0x52CB97F66DA025CA / 0x6DA025CA