[hatari-devel] printf for 64 bit value and %PRId64/ %I64d

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


Hi

it seems that with recent version of mingw/gcc that I'm using there's now an error when using the portable %PRId64 macro to print 64 bit integer and crosscompiling under linux to do a Windows build :


/home/npomarede/src/win/src/gemdos.c: In function 'restore_file_handle_info': /home/npomarede/src/win/src/gemdos.c:891:24: warning: unknown conversion type character 'l' in format [-Wformat=] 891 | Log_Printf(LOG_WARN, "GEMDOS '%s' handle %d cannot be restored, seek to saved offset %"PRId64" failed for: %s\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/npomarede/src/win/src/gemdos.c:42:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/inttypes.h:33:18: note: format string is defined here
   33 | #define PRId64 "lld"
      |                  ^

One possible fix for this is to do :

#define PRId64 "I64d"

only when compiling for windows (as %I64d seems to be more supported under Windows)

Any other idea how to fix this in the most clean/secure way ?

Nicolas



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