# HG changeset patch # User Matti Hamalainen # Date 1578588682 -7200 # Node ID 5ffc48a0bebefd04bbb403823542e5c030b8c92e # Parent 36edd316184a896b1d5d74c019b3ee71b2a44b2e Conditionally define DM_ATTR_PRINTF_FMT(xstart, xend) instead of using __attribute__ ((__format__ (__printf__, (xstart), (xend)))) directly. Wrap it in an #ifdef check for __MINGW64__ as there are some annoying issues on that side, which we just suppress now. diff -r 36edd316184a -r 5ffc48a0bebe src/dmlib.h --- a/src/dmlib.h Thu Jan 09 15:20:23 2020 +0200 +++ b/src/dmlib.h Thu Jan 09 18:51:22 2020 +0200 @@ -45,6 +45,14 @@ #endif +// Kludge, as MinGW64 cross-compiler does not like certain printf() format specifiers +#if defined(__MINGW64__) +# define DM_ATTR_PRINTF_FMT(xstart, xend) +#else +# define DM_ATTR_PRINTF_FMT(xstart, xend) __attribute__ ((__format__ (__printf__, (xstart), (xend)))) +#endif + + // Do we have a valid arch? // If so, set some printf specifiers #if DM_ARCH == 32 @@ -374,16 +382,16 @@ void dmMsgVA(int level, const char *fmt, va_list ap); void dmMsg(int level, const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); + DM_ATTR_PRINTF_FMT(2, 3); void dmPrintVA(int level, const char *fmt, va_list ap); void dmPrint(int level, const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); + DM_ATTR_PRINTF_FMT(2, 3); int dmErrorVA(const int error, const char *fmt, va_list); int dmError(const int error, const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); + DM_ATTR_PRINTF_FMT(2, 3); void dmErrorMsg(const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); + DM_ATTR_PRINTF_FMT(1, 2); int dmGetErrno(); const char *dmErrorStr(const int error); diff -r 36edd316184a -r 5ffc48a0bebe src/dmres.h --- a/src/dmres.h Thu Jan 09 15:20:23 2020 +0200 +++ b/src/dmres.h Thu Jan 09 18:51:22 2020 +0200 @@ -173,7 +173,7 @@ int dmfputs(const char *str, DMResource *fh); int dmvfprintf(DMResource *fh, const char *fmt, va_list ap); int dmfprintf(DMResource *fh, const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); + DM_ATTR_PRINTF_FMT(2, 3); // Helper functions for endianess based reading etc BOOL dmf_read_str(DMResource *fh, void *ptr, const size_t len); diff -r 36edd316184a -r 5ffc48a0bebe src/dmtext.h --- a/src/dmtext.h Thu Jan 09 15:20:23 2020 +0200 +++ b/src/dmtext.h Thu Jan 09 18:51:22 2020 +0200 @@ -69,7 +69,7 @@ const BOOL condensed, const int mode, const int xc, const int yc, const char *fmt, va_list ap); void dmDrawBMText(SDL_Surface *screen, const DMBitmapFont *font, const BOOL condensed, const int mode, const int xc, const int yc, const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 7, 8))); + DM_ATTR_PRINTF_FMT(7, 8); static inline void dmInitializeGetBMGlyphSurface(SDL_Surface *surf, DMBitmapFont *font) diff -r 36edd316184a -r 5ffc48a0bebe tools/lib64util.c --- a/tools/lib64util.c Thu Jan 09 15:20:23 2020 +0200 +++ b/tools/lib64util.c Thu Jan 09 18:51:22 2020 +0200 @@ -110,7 +110,7 @@ } -__attribute__ ((__format__ (__printf__, 4, 5))) +DM_ATTR_PRINTF_FMT(4, 5) static void dmC64ImageDumpLine(FILE *fh, const char *indent, const char *field, const char *fmt, ...) { va_list ap; diff -r 36edd316184a -r 5ffc48a0bebe tools/libgutil.h --- a/tools/libgutil.h Thu Jan 09 15:20:23 2020 +0200 +++ b/tools/libgutil.h Thu Jan 09 18:51:22 2020 +0200 @@ -23,7 +23,7 @@ void dmDrawBMTextConstQ(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt); void dmDrawBMTextVAQ(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, va_list ap); void dmDrawBMTextQ(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 6, 7))); + DM_ATTR_PRINTF_FMT(6, 7); #ifdef __cplusplus