Disable spurious warning with gcc 9.3

gcc 9.3 gives a warning when compiling with -O2:
‘strlen’ argument missing terminating nul [-Werror=stringop-overflow=]

This seems to be caused by a gcc bug that is not present in gcc 8
and fixed in gcc 10:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91490

Change-Id: Ice3c18efb7a41097521ecee22d060f175083c579
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
bb10
Paul Olav Tvete 2020-10-07 19:42:31 +02:00
parent 22b72a6f7a
commit cb1004f94a
1 changed files with 5 additions and 0 deletions

View File

@ -135,6 +135,10 @@ constexpr StaticString<Sum> staticString(const char (&s)[I], const char (&...sx)
QT_WARNING_POP
} // namespace QtPrivate
QT_WARNING_PUSH
#if defined(Q_CC_GNU) && __GNUC__ == 9
QT_WARNING_DISABLE_GCC("-Wstringop-overflow")
#endif
template<typename T, int SizeString, int SizeOffsets>
class QOffsetStringArray
{
@ -169,6 +173,7 @@ private:
QtPrivate::StaticString<SizeString> m_string;
const T m_offsets[SizeOffsets];
};
QT_WARNING_POP
template<typename T, int N, int ... Ox>
constexpr QOffsetStringArray<T, N, sizeof ... (Ox)> qOffsetStringArray(