-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 4.1.0-beta1
-
None
-
Ubuntu 16.04, GCC 6.0.1
Thanks to the Apple bug CVE-2014-1266, GCC 6 now checks for misleading indentations.
It found a few:
1)
../../../../qt-creator/src/libs/cplusplus/LookupContext.cpp ../../../../qt-creator/src/libs/cplusplus/LookupContext.cpp: In member function ‘QList<CPlusPlus::LookupItem> CPlusPlus::LookupContext::lookup(const CPlusPlus::Name*, CPlusPlus::Scope*) const’: ../../../../qt-creator/src/libs/cplusplus/LookupContext.cpp:512:13: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (ClassOrNamespace *binding = bindings()->lookupType(scope)) ^~ ../../../../qt-creator/src/libs/cplusplus/LookupContext.cpp:515:17: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ if (! candidates.isEmpty()) ^~
Scrolling up a bit we can observe that these same checks are performed a few more times but this is the only one that is out of the scope of the first
if (ClassOrNamespace *binding = bindings()->lookupType(scope))
This one seems to be a real bug(unless the check was intended to be different from the rest).
2)
../../../../qt-creator/src/libs/qmljs/qmljsinterpreter.cpp: In member function ‘virtual void QmlJS::CppComponentValue::processMembers(QmlJS::MemberProcessor*) const’: ../../../../qt-creator/src/libs/qmljs/qmljsinterpreter.cpp:332:9: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] else ^~~~ ../../../../qt-creator/src/libs/qmljs/qmljsinterpreter.cpp:334:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘else’ processor->processProperty(propertyName, valueForCppName(prop.typeName()), ^~~~~~~~~
"processor->processProperty" - seems to be ok, wrong indentation.
3)
../../../../qt-creator/src/plugins/qtsupport/baseqtversion.cpp: In member function ‘QString QtSupport::BaseQtVersion::findQtBinary(QtSupport::BaseQtVersion::Binaries) const’: ../../../../qt-creator/src/plugins/qtsupport/baseqtversion.cpp:925:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (HostOsInfo::isMacHost()) ^~ ../../../../qt-creator/src/plugins/qtsupport/baseqtversion.cpp:927:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ possibleCommands << HostOsInfo::withExecutableSuffix(QLatin1String("linguist")); ^~~~~~~~~~~~~~~~
Following previous patterns(I am not familiar with the codebase), this seems to miss "else".
4)
../../../../qt-creator/src/plugins/clearcase/clearcaseplugin.cpp: In member function ‘void ClearCase::Internal::ClearCasePlugin::ccUpdate(const QString&, const QStringList&)’: ../../../../qt-creator/src/plugins/clearcase/clearcaseplugin.cpp:1335:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (!relativePaths.isEmpty()) ^~ ../../../../qt-creator/src/plugins/clearcase/clearcaseplugin.cpp:1337:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ const ClearCaseResponse response = ^~~~~
Seems to be ok, wrong indentation
5)
../../../../qt-creator/src/plugins/modeleditor/modeleditor.cpp: In member function ‘void ModelEditor::Internal::ModelEditor::addToNavigationHistory(const qmt::MDiagram*)’: ../../../../qt-creator/src/plugins/modeleditor/modeleditor.cpp:1213:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (Core::EditorManager::currentEditor() == this) ^~ ../../../../qt-creator/src/plugins/modeleditor/modeleditor.cpp:1215:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ Core::EditorManager::addCurrentPositionToNavigationHistory(saveState(diagram)); ^~~~
Seems to be a bug
6)
../../../../qt-creator/src/plugins/subversion/subversionplugin.cpp: In member function ‘void Subversion::Internal::SubversionPlugin::svnUpdate(const QString&, const QString&)’: ../../../../qt-creator/src/plugins/subversion/subversionplugin.cpp:751:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (!relativePath.isEmpty()) ^~ ../../../../qt-creator/src/plugins/subversion/subversionplugin.cpp:753:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ const SubversionResponse response ^~~~~
Same issue as with "ClearCaseResponse", wrong indentation
7)
../../../../qt-creator/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp: In member function ‘void QmlDesigner::PropertyEditorView::changeValue(const QString&)’: ../../../../qt-creator/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp:192:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (qmlObjectNode.modelNode().metaInfo().isValid() && qmlObjectNode.modelNode().metaInfo().hasProperty(propertyName)) ^~ ../../../../qt-creator/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp:202:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ if (castedValue.type() == QVariant::Color) { ^~
Not sure about this one... Of course, wrong indentation...