QMake: replace a Q_ASSERT() with a Q_UNREACHABLE()

In release mode, the Q_ASSERT() is a no-op, and Clang rightfully
pointed out that, in that case, the bool ok variable will be used
uninitialized.

Fix by using Q_UNREACHABLE(), which has an effect in both debug and
release builds.

Change-Id: I33480aabe1c5233d1caddf9404f475ca9fcb8eaf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit be0dc7fbb8c0c1ead7eeeb9aefea6c081beeacdc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-01-22 21:07:21 +01:00 committed by Qt Cherry-pick Bot
parent 2ba00de3d5
commit e952677c3c

View File

@ -1549,7 +1549,8 @@ static bool getBlock(const ushort *tokens, int limit, int &offset, QString *outS
ok = getSubBlock(tokens, limit, offset, outStr, indent, "block");
break;
default:
Q_ASSERT(!"unhandled token");
// unhandled token
Q_UNREACHABLE();
}
}
if (!ok)