mirror of https://github.com/qt/qtbase.git
QHash: fix -Werror=maybe-uninitialized (GCC 11.2)
The compiler doesn't understand understand that the only way ok can be
true is for qstrntoll() to have been executed.
qhash.cpp:158:9: error: ‘seed’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
158 | if (seed) {
| ^~
Help poor GCC by initializing the variable unconditionally.
Amends cc5cc3225d
.
Change-Id: Ic8387e0add2291d994f7f4d96c4bc614b2a8aa99
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
d10b910e39
commit
021134195e
|
@ -149,7 +149,7 @@ private:
|
|||
const char *seedstr = getenv("QT_HASH_SEED");
|
||||
const char *endptr = nullptr;
|
||||
bool ok = false;
|
||||
int seed;
|
||||
int seed = 0;
|
||||
if (seedstr)
|
||||
seed = qstrntoll(seedstr, strlen(seedstr), &endptr, 10, &ok);
|
||||
if (ok && endptr != seedstr + strlen(seedstr))
|
||||
|
|
Loading…
Reference in New Issue