From be0dc7fbb8c0c1ead7eeeb9aefea6c081beeacdc Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 22 Jan 2022 21:07:21 +0100 Subject: [PATCH] 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. Pick-to: 6.3 6.2 5.15 Change-Id: I33480aabe1c5233d1caddf9404f475ca9fcb8eaf Reviewed-by: Fabian Kosmale Reviewed-by: Thiago Macieira --- qmake/library/qmakeparser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp index 52e4187dbbe..a4671bc6924 100644 --- a/qmake/library/qmakeparser.cpp +++ b/qmake/library/qmakeparser.cpp @@ -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)