Re: [hatari-devel] My cross-compiling experience

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


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



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