summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-12-09 14:55:46 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-12-10 11:02:06 +0100
commit376959250c99701468900b08de91484713c1f850 (patch)
treed148093b2d4f14231c077fc0a76ec65df5006e7f /src
parentce0b76731042412a0fa5a5f633fc48a52f79ef81 (diff)
Workaround bogus compiler warning
gcc 9.x (but not 10.x) issues a bogus warning when strlen is used on a string literal; disable the warning for those versions. Upstream bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91490 Change-Id: I7a2a4d0f6ddafcafcd9fcc62fc41ad5d78e61627 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/text/qbytearray.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index 13bd178ab6..e16d888d62 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -80,7 +80,16 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT char *qstrdup(const char *);
inline size_t qstrlen(const char *str)
-{ return str ? strlen(str) : 0; }
+{
+ QT_WARNING_PUSH
+#if defined(Q_CC_GNU) && Q_CC_GNU >= 900 && Q_CC_GNU < 1000
+ // spurious compiler warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91490#c6)
+ // when Q_DECLARE_METATYPE_TEMPLATE_1ARG is used
+ QT_WARNING_DISABLE_GCC("-Wstringop-overflow")
+#endif
+ return str ? strlen(str) : 0;
+ QT_WARNING_POP
+}
inline size_t qstrnlen(const char *str, size_t maxlen)
{