summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-13 23:18:06 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-19 07:18:49 +0200
commit47ebd2ae5e40f5d1228edd3a35d0272dcf545585 (patch)
treec215b98cb4d04872d0241106fad99783181ac3da /src
parent77e7140fb6198535e7e3a0413185709c94ebccde (diff)
downloadqtwayland-47ebd2ae5e40f5d1228edd3a35d0272dcf545585.tar.gz
Port to new Q_UNREACHABLE_RETURN()
This is a semantic patch using ClangTidyTransformator to convert sequences of Q_UNREACHABLE() + return into Q_UNREACHABLE_RETURN(), newly added to qtbase. const std::string unr = "unr", val = "val", ret = "ret"; auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(", ifBound(val, cat(node(val)), cat("")), ")"); auto ignoringSwitchCases = [](auto stmt) { return anyOf(stmt, switchCase(subStmt(stmt))); }; makeRule(stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)), nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))), {changeTo(node(unr), cat(makeUnreachableReturn, ";")), // TODO: why is the ; lost w/o this? changeTo(node(ret), cat(""))}, cat("use ", makeUnreachableReturn)); a.k.a qt-use-unreachable-return. subStmt() and nextStmt() are non-standard matchers. Change-Id: I3855b2dc8523db1ea860f72ad9818738162495c6 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylandinputcontext.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp
index cb94005b..e67311a1 100644
--- a/src/client/qwaylandinputcontext.cpp
+++ b/src/client/qwaylandinputcontext.cpp
@@ -288,8 +288,7 @@ bool QWaylandInputContext::filterEvent(const QEvent *event)
case XKB_COMPOSE_NOTHING:
return false;
default:
- Q_UNREACHABLE();
- return false;
+ Q_UNREACHABLE_RETURN(false);
}
}