From 181fa70b7ba06c92c3c0fdc4c70081b14e4b1bdf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 16 Jan 2018 15:45:10 +0100 Subject: shiboken: Fix some clazy warnings - Mixing const/non-const iterators - Do not use operator[] on temporaries of type QVector - Remove unused nontrivial variables - Add Q_FALLTHROUGH() - Potential detach in range-based for Change-Id: I89391fdda616f119eadd7de529eb6cee69343f85 Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Alexandru Croitor --- sources/shiboken2/ApiExtractor/typesystem.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'sources/shiboken2/ApiExtractor/typesystem.cpp') diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp index c6f723e4d..8564da3c4 100644 --- a/sources/shiboken2/ApiExtractor/typesystem.cpp +++ b/sources/shiboken2/ApiExtractor/typesystem.cpp @@ -373,6 +373,7 @@ bool Handler::endElement(const QStringRef &localName) m_current->parent->entry->setCodeSnips(snips); break; } + Q_FALLTHROUGH(); case StackElement::NativeToTarget: case StackElement::AddConversion: m_contextStack.top()->codeSnips.last().addTemplateInstance(m_current->value.templateInstance); @@ -756,20 +757,20 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts break; case StackElement::ValueTypeEntry: attributes.insert(QLatin1String("default-constructor"), QString()); - // fall throooough + Q_FALLTHROUGH(); case StackElement::ObjectTypeEntry: attributes.insert(QLatin1String("force-abstract"), QLatin1String("no")); attributes.insert(QLatin1String("deprecated"), QLatin1String("no")); attributes.insert(QLatin1String("hash-function"), QString()); attributes.insert(QLatin1String("stream"), QLatin1String("no")); - // fall throooough + Q_FALLTHROUGH(); case StackElement::InterfaceTypeEntry: attributes[QLatin1String("default-superclass")] = m_defaultSuperclass; attributes.insert(QLatin1String("polymorphic-id-expression"), QString()); attributes.insert(QLatin1String("delete-in-main-thread"), QLatin1String("no")); attributes.insert(QLatin1String("held-type"), QString()); attributes.insert(QLatin1String("copyable"), QString()); - // fall through + Q_FALLTHROUGH(); case StackElement::NamespaceTypeEntry: attributes.insert(QLatin1String("target-lang-name"), QString()); attributes[QLatin1String("package")] = m_defaultPackage; @@ -968,7 +969,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts itype->setOrigin(otype); element->entry = otype; } - // fall through + Q_FALLTHROUGH(); case StackElement::ValueTypeEntry: { if (!element->entry) { ValueTypeEntry* typeEntry = new ValueTypeEntry(name, since); @@ -978,12 +979,12 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts element->entry = typeEntry; } - // fall through + Q_FALLTHROUGH(); case StackElement::NamespaceTypeEntry: if (!element->entry) element->entry = new NamespaceTypeEntry(name, since); - // fall through + Q_FALLTHROUGH(); case StackElement::ObjectTypeEntry: if (!element->entry) element->entry = new ObjectTypeEntry(name, since); @@ -1334,13 +1335,12 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts } } break; - case StackElement::RejectEnumValue: { + case StackElement::RejectEnumValue: if (!m_currentEnum) { m_error = QLatin1String(" node must be used inside a node"); return false; } - QString name = attributes[nameAttribute()]; - } break; + break; case StackElement::ReplaceType: { if (topElement.type != StackElement::ModifyArgument) { m_error = QLatin1String("Type replacement can only be specified for argument modifications"); @@ -2495,7 +2495,7 @@ AddedFunction::AddedFunction(QString signature, QString returnType, double vr) : break; } // is const? - m_isConst = signature.right(signatureLength - endPos).contains(QLatin1String("const")); + m_isConst = signature.rightRef(signatureLength - endPos).contains(QLatin1String("const")); } } -- cgit v1.2.3