summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-06-03 10:31:23 -0700
committerThiago Macieira <thiago.macieira@intel.com>2017-06-07 15:54:03 +0000
commitbc93ee060abcd746cbed906a51f2379e3da6f379 (patch)
tree35100831372b05acc38e4e3d73100d2160982c8e /src/widgets/kernel
parent0265a23bb02b68534bb3c86514cc93bc45a7444f (diff)
Help GCC understand that variable is never used unintialized
qformlayout.cpp:1982:14: error: ‘role’ may be used uninitialized in this function [-Werror=maybe-uninitialized] The variable role is never used uninitialized because the access is protected by the check for row != -1. The only condition under which QFormLayout::getItemPosition will leave role unset is if it sets row to -1. Since row == -1 ←→ col == -1 ←→ storageIndex == -1, we can simply change the variable that we check here and the warning goes away. Change-Id: Ia3e896da908f42939148fffd14c4ace6e40a808e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qformlayout.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index c66a6d5673..868ac17b6f 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -1907,7 +1907,7 @@ void QFormLayout::getItemPosition(int index, int *rowPtr, ItemRole *rolePtr) con
if (rowPtr)
*rowPtr = row;
- if (rolePtr && col != -1) {
+ if (rolePtr && row != -1) {
const bool spanning = col == 1 && d->m_matrix(row, col)->fullRow;
if (spanning) {
*rolePtr = SpanningRole;