Explain an usage of volatile

It's to work around QTBUG-45307.

Change-Id: Ib6076223013e5b1ccfa6ec25e2d040daaa2f19dd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
bb10
Giuseppe D'Angelo 2019-10-04 11:00:07 +02:00
parent 780137d585
commit 22891dd897
1 changed files with 5 additions and 0 deletions

View File

@ -728,6 +728,11 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
#ifndef QT_BUILD_QMAKE_BOOTSTRAP
if (!fromConf) {
// "volatile" here is a hack to prevent compilers from doing a
// compile-time strlen() on "path". The issue is that Qt installers
// will binary-patch the Qt installation paths -- in such scenarios, Qt
// will be built with a dummy path, thus the compile-time result of
// strlen is meaningless.
const char * volatile path = 0;
if (loc == PrefixPath) {
path = getPrefix(