aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2018-01-30 18:34:11 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2018-02-22 10:43:40 +0000
commit15c9e08d81177e5afdcd94745201c61206aba774 (patch)
treed7ead0436e5f5bd7008f3dbe3311519f7fc2ce15 /sources/shiboken2
parent2004278e04081b445686712a42698480bfce33e1 (diff)
Reduce number of warnings when running shiboken on a custom module
Running shiboken on a custom XML file (like the scriptableapplication example) would show tons of warnings about not being able to find certain types or enums or other things inside Qt modules. For scriptableapplication that was the case, because the wrappedclasses.h file would only include the <QMainWindow> header file, and not the rest of QtWidgets / QtGui headers, which means that shiboken found types declared in XML files, but could not find the actual declarations inside the preprocessed header file. This change adds some additional conditions so that warnings are not printed when a typesystem file is loaded with the generate="no" attribute, because no C++ code will actually be generated for types defined inside such a typesystem file. Task-number: PYSIDE-587 Change-Id: I1f166483c2f343796e08d3142e5e296c4ee43f27 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken2')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index 38000785f..b0bbdcc5e 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -177,7 +177,7 @@ static QString msgNoFunctionForModification(const QString &signature, const QStr
if (f)
str << ", ";
str << allFunctions.at(f)->minimalSignature();
- }
+ }
} else {
str << " Possible candidates: " << possibleSignatures.join(QLatin1String(", "));
}
@@ -197,6 +197,10 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
continue;
const ComplexTypeEntry* centry = static_cast<const ComplexTypeEntry*>(entry);
+
+ if (!(centry->codeGeneration() & TypeEntry::GenerateTargetLang))
+ continue;
+
FunctionModificationList modifications = centry->functionModifications();
for (const FunctionModification &modification : qAsConst(modifications)) {
@@ -585,6 +589,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
&& !entry->isContainer()
&& !entry->isCustom()
&& !entry->isVariant()
+ && (entry->generateCode() & TypeEntry::GenerateTargetLang)
&& !AbstractMetaClass::findClass(m_metaClasses, entry->qualifiedCppName())) {
qCWarning(lcShiboken).noquote().nospace()
<< QStringLiteral("type '%1' is specified in typesystem, but not defined. This could potentially lead to compilation errors.")
@@ -606,7 +611,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
.arg(signature);
}
}
- } else if (entry->isEnum()) {
+ } else if (entry->isEnum() && (entry->generateCode() & TypeEntry::GenerateTargetLang)) {
const QString name = ((EnumTypeEntry*) entry)->targetLangQualifier();
AbstractMetaClass *cls = AbstractMetaClass::findClass(m_metaClasses, name);
@@ -1079,10 +1084,13 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(EnumModelItem enumIte
return 0;
}
- if (!typeEntry || !typeEntry->isEnum()) {
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("enum '%1' does not have a type entry or is not an enum")
+ if ((!typeEntry || !typeEntry->isEnum())) {
+ if (!m_currentClass ||
+ (m_currentClass->typeEntry()->codeGeneration() & TypeEntry::GenerateTargetLang)) {
+ qCWarning(lcShiboken).noquote().nospace()
+ << QStringLiteral("enum '%1' does not have a type entry or is not an enum")
.arg(qualifiedName);
+ }
m_rejectedEnums.insert(qualifiedName, AbstractMetaBuilder::NotInTypeSystem);
return 0;
}
@@ -1434,9 +1442,11 @@ AbstractMetaField *AbstractMetaBuilderPrivate::traverseField(VariableModelItem f
if (!metaType || !ok) {
const QString type = TypeInfo::resolveType(fieldType, currentScope()).qualifiedName().join(colonColon());
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("skipping field '%1::%2' with unmatched type '%3'")
- .arg(m_currentClass->name(), fieldName, type);
+ if (m_currentClass->typeEntry()->codeGeneration() & TypeEntry::GenerateTargetLang) {
+ qCWarning(lcShiboken).noquote().nospace()
+ << QStringLiteral("skipping field '%1::%2' with unmatched type '%3'")
+ .arg(m_currentClass->name(), fieldName, type);
+ }
delete metaField;
return 0;
}