9baf1d5256
The old code attempted to detect the overflow of the requestCode variable, but because it didn't do anything about it except warn, it still ran into the overflow, and, since the variable is signed, into UB. That means that a clever compiler will just eliminate the warning as dead code because it can backtrack and see that the condition guarding it is never true, because otherwise UB happens. Fix that problem by using a uint counter (unsigned overflow is defined to wrap) and only convert to int after the check. Also fix two inefficiencies with the old code: 1. We don't need a mutex just to up a counter in a thread-safe way. Upping a shared counter is the prototypical use-case for relaxed atomics, so use that. That also solves the problem of the non-POD static object at function scope (QMutex) that forced compilers to emit thread-safe static initialization code. 2. We had a static variable whose initial value isn't 0, which means it can't be in stored in the BSS, but only in the DATA segment. Do the trivial transformation of subtracting the offset so the variable starts at 0. The offset can be added afterwards. Pick-to: 6.2 Change-Id: I3560df21d6b4e4201cb6772237780cc8b400631d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> |
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
conanfile.py | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
LICENSE.FDL | ||
LICENSE.GPL2 | ||
LICENSE.GPL3 | ||
LICENSE.GPL3-EXCEPT | ||
LICENSE.LGPL3 | ||
LICENSE.LGPLv3 | ||
LICENSE.QT-LICENSE-AGREEMENT | ||
qt_cmdline.cmake | ||
sync.profile |