summaryrefslogtreecommitdiffstats
path: root/src/tools/uic/cpp/cppwriteinitialization.h
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2023-09-05 09:52:31 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2023-09-06 19:24:40 +0200
commitca8fefca858e34bf09a7d691413fb9994e745b22 (patch)
tree52e82d8db64abbefda7b24daaf04c11d62b0bf8b /src/tools/uic/cpp/cppwriteinitialization.h
parent0bd1fc006097e481d8b92ee1c5246ffa1ae9379f (diff)
QCoreApplication::requestPermission: refactor "dead" code
An assert that checks in debug mode is morally equivalent to an assumption/contract in release mode. Rechecking that an assumption is true is pointless (it's true by definition), so the code for the case the check fails is effectively "dead". Right now Q_ASSERT(x) doesn't turn into Q_ASSUME(x) because some compilers still have poor codegen (and basically emit a check, even in release mode). With C++23's [[assume(x)]] we may reconsider that. As soon as we do it, this code is no longer theoretically dead but practically dead. Refactor the code so that the check is done unconditionally, and if it fails, we assert (in debug mode). In release, we protect users from a broken backend (which may cause an endless loop of user code re-requesting the same permission, so it's worth avoiding it). Change-Id: If0e70e7d88a585ce16ec4838ba7be747652d8155 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/tools/uic/cpp/cppwriteinitialization.h')
0 files changed, 0 insertions, 0 deletions