diff options
author | Jonathan Liu <net147@gmail.com> | 2013-04-25 21:00:24 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-08 03:16:35 +0200 |
commit | 157596b1c2c0fb47067ff0438ec490a94048996e (patch) | |
tree | b4c3a1454eb8e2d6a5ab266ce70bed3126ba9036 /src | |
parent | 02679d93c4455d8d2f74002574a87801269fde56 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qlogging.h | 20 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 8 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index a6f244698d..2b798f9ea0 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -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 ; diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index ac49bdcdf6..d8aaa929dc 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -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 ; |