Fix a number of compiler warnings

Change-Id: I3e71bffb2099d896742a6fca77febe20e2076464
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2021-07-12 12:03:26 +02:00
parent 1936006a91
commit 264fa85f50
9 changed files with 13 additions and 7 deletions

View File

@@ -120,7 +120,11 @@ static clang::format::FormatStyle qtcStyle()
style.ExperimentalAutoDetectBinPacking = false;
style.FixNamespaceComments = true;
style.ForEachMacros = {"forever", "foreach", "Q_FOREACH", "BOOST_FOREACH"};
#if LLVM_VERSION_MAJOR >= 12
style.IncludeStyle.IncludeCategories = {{"^<Q.*", 200, 200, true}};
#else
style.IncludeStyle.IncludeCategories = {{"^<Q.*", 200, 200}};
#endif
style.IncludeStyle.IncludeIsMainRegex = "(Test)?$";
style.IndentCaseLabels = false;
style.IndentWidth = 4;

View File

@@ -334,7 +334,7 @@ auto removeAndExtractTemplate(QString type)
QString templateParameter;
int counter = 0;
int start = 0;
int templateStart;
int templateStart = 0;
for (int i = 0; i < type.length(); ++i) {
auto c = type[i];
if (c == '<') {

View File

@@ -1665,8 +1665,8 @@ bool BreakHandler::contextMenuEvent(const ItemViewEvent &ev)
: locationsEnabled ? tr("Disable Location") : tr("Enable Location"),
!selectedLocations.isEmpty() && handlesIndividualLocations,
[this, selectedLocations, locationsEnabled] {
for (const SubBreakpoint &sbp : selectedLocations)
requestSubBreakpointEnabling(sbp, !locationsEnabled);
for (SubBreakpointItem * const sbp : selectedLocations)
requestSubBreakpointEnabling(QPointer(sbp), !locationsEnabled);
}
);

View File

@@ -186,7 +186,7 @@ QList<FilePath> DesktopDevice::directoryEntries(const FilePath &filePath,
{
QTC_CHECK(!filePath.needsDevice());
const QDir dir(filePath.path());
const QFileInfoList entryInfoList = dir.entryInfoList(nameFilters, filters);
const QFileInfoList entryInfoList = dir.entryInfoList(nameFilters, filters, sort);
return Utils::transform(entryInfoList, &FilePath::fromFileInfo);
}

View File

@@ -357,6 +357,7 @@ QByteArray IDevice::fileContents(const FilePath &filePath, qint64 limit, qint64
{
Q_UNUSED(filePath);
Q_UNUSED(limit);
Q_UNUSED(offset);
QTC_CHECK(false);
return {};
}

View File

@@ -631,7 +631,7 @@ void AlignDistribute::distributeSpacing(Dimension dimension,
QTC_ASSERT(!modelNode.isRootNode(), continue);
if (QmlItemNode::isValidQmlItemNode(modelNode)) {
QmlItemNode qmlItemNode(modelNode);
qreal parentPos;
qreal parentPos = 0;
QByteArray propertyName;
switch (dimension) {
case Dimension::X: {

View File

@@ -573,7 +573,7 @@ public:
friend bool operator==(const ImportView &first, const ImportView &second)
{
return first.name == second.name
&& first.version == second.version & first.sourceId == second.sourceId;
&& first.version == second.version && first.sourceId == second.sourceId;
}
public:

View File

@@ -270,7 +270,7 @@ void SettingsPageWidget::apply()
DesignerSettingsKey::ENABLE_TIMELINEVIEW
};
for (const QByteArray &key : restartNecessaryKeys) {
for (const char * const key : restartNecessaryKeys) {
if (currentSettings.value(key) != newSettings.value(key)) {
QMessageBox::information(Core::ICore::dialogParent(), tr("Restart Required"),
tr("The made changes will take effect after a "

View File

@@ -162,6 +162,7 @@ QList<ToolChain *> WebAssemblyToolChainFactory::autoDetect(
const IDevice::Ptr &device)
{
Q_UNUSED(alreadyKnown)
Q_UNUSED(device)
const FilePath sdk = WebAssemblyEmSdk::registeredEmSdk();
if (!WebAssemblyEmSdk::isValid(sdk))