Skip to content

Commit 3a2482d

Browse files
committed
BUG: Logic bug in contenating strings.
PythonQt/generator/main.cpp:98:60: warning: adding 'bool' to a string does not append to the string [-Wstring-plus-int] QString reason = "The QTDIR environment variable " + qtdir.isEmpty() ? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ PythonQt/generator/main.cpp:98:60: note: use array indexing to silence this warning QString reason = "The QTDIR environment variable " + qtdir.isEmpty() ? ^ & [ ] PythonQt/generator/main.cpp:98:78: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Wparentheses] QString reason = "The QTDIR environment variable " + qtdir.isEmpty() ? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ PythonQt/generator/main.cpp:98:78: note: place parentheses around the '+' expression to silence this warning QString reason = "The QTDIR environment variable " + qtdir.isEmpty() ? ^ ( ) PythonQt/generator/main.cpp:98:78: note: place parentheses around the '?:' expression to evaluate it first QString reason = "The QTDIR environment variable " + qtdir.isEmpty() ?
1 parent a9c14ab commit 3a2482d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

generator/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ namespace
9595
QString qtdir = getenv("QTDIR");
9696
if (qtdir.isEmpty() || !QDir(qtdir).exists(qtdir))
9797
{
98-
QString reason = "The QTDIR environment variable " + qtdir.isEmpty() ?
99-
"is not set. " : "points to a non-existing directory. ";
98+
const QString prefix = "The QTDIR environment variable " ;
99+
const QString reason = qtdir.isEmpty()
100+
? prefix + "is not set. "
101+
: prefix + "points to a non-existing directory. ";
100102
#if defined(Q_OS_MAC)
101103
qWarning() << reason << "Assuming standard binary install using frameworks.";
102104
QString frameworkDir = "/Library/Frameworks";

0 commit comments

Comments
 (0)