Mercurial > hg > dmlib
diff src/dmlib.h @ 2385:5ffc48a0bebe
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.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 09 Jan 2020 18:51:22 +0200 |
parents | 43e39d9ec42f |
children | 835b231d8083 |
line wrap: on
line diff
--- 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);