Specify gnu_printf for message formatting with MinGW

The custom printf formatter Qt ships supports e.g. %lld, which is part
of gnu_printf, but not ms_printf. This fixes a lot of MinGW warnings.

Change-Id: Iff600f20ac23ecb88c4b569d2e668f5d4af6ef27
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Jonathan Liu 2013-04-25 21:00:24 +10:00 committed by The Qt Project
parent 02679d93c4
commit 157596b1c2
2 changed files with 28 additions and 0 deletions

View File

@ -94,22 +94,38 @@ public:
void debug(const char *msg, ...) const
#if defined(Q_CC_GNU) && !defined(__INSURE__)
# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
__attribute__ ((format (gnu_printf, 2, 3)))
# else
__attribute__ ((format (printf, 2, 3)))
# endif
#endif
;
void noDebug(const char *, ...) const
#if defined(Q_CC_GNU) && !defined(__INSURE__)
# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
__attribute__ ((format (gnu_printf, 2, 3)))
# else
__attribute__ ((format (printf, 2, 3)))
# endif
#endif
{}
void warning(const char *msg, ...) const
#if defined(Q_CC_GNU) && !defined(__INSURE__)
# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
__attribute__ ((format (gnu_printf, 2, 3)))
# else
__attribute__ ((format (printf, 2, 3)))
# endif
#endif
;
void critical(const char *msg, ...) const
#if defined(Q_CC_GNU) && !defined(__INSURE__)
# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
__attribute__ ((format (gnu_printf, 2, 3)))
# else
__attribute__ ((format (printf, 2, 3)))
# endif
#endif
;
@ -118,7 +134,11 @@ public:
#endif
void fatal(const char *msg, ...) const Q_DECL_NOTHROW
#if defined(Q_CC_GNU) && !defined(__INSURE__)
# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
__attribute__ ((format (gnu_printf, 2, 3)))
# else
__attribute__ ((format (printf, 2, 3)))
# endif
#endif
;

View File

@ -298,12 +298,20 @@ public:
QString &vsprintf(const char *format, va_list ap)
#if defined(Q_CC_GNU) && !defined(__INSURE__)
# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
__attribute__ ((format (gnu_printf, 2, 0)))
# else
__attribute__ ((format (printf, 2, 0)))
# endif
#endif
;
QString &sprintf(const char *format, ...)
#if defined(Q_CC_GNU) && !defined(__INSURE__)
# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
__attribute__ ((format (gnu_printf, 2, 3)))
# else
__attribute__ ((format (printf, 2, 3)))
# endif
#endif
;