ca8fefca85
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> |
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
LICENSES | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
qt_cmdline.cmake |