aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/pyside6/PySide6/QtCore/typesystem_core_common.xml25
-rw-r--r--sources/pyside6/doc/tutorials/basictutorial/qrcfiles.rst5
-rw-r--r--sources/shiboken6/tests/samplebinding/typesystem_sample.xml6
-rw-r--r--sources/shiboken6_generator/ApiExtractor/abstractmetabuilder.cpp214
-rw-r--r--sources/shiboken6_generator/ApiExtractor/abstractmetabuilder_p.h15
-rw-r--r--sources/shiboken6_generator/ApiExtractor/abstractmetafunction.cpp25
-rw-r--r--sources/shiboken6_generator/ApiExtractor/abstractmetalang.cpp1
7 files changed, 164 insertions, 127 deletions
diff --git a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml
index acf9202cb..e4b39ed0a 100644
--- a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml
+++ b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml
@@ -2101,17 +2101,14 @@
<!-- ### These overloads must be removed accept strings with \x00 in their contents -->
<modify-function signature="append(const char*)" remove="all"/>
<modify-function signature="prepend(const char*)" remove="all"/>
- <modify-function signature="operator==(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator==(QByteArray,const char*)" remove="all"/>
- <modify-function signature="operator>(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator>(QByteArray,const char*)" remove="all"/>
- <modify-function signature="operator>=(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator>=(QByteArray,const char*)" remove="all"/>
- <modify-function signature="operator&lt;(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator&lt;=(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator&lt;=(QByteArray,const char*)" remove="all"/>
- <modify-function signature="operator!=(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator!=(QByteArray,const char*)" remove="all"/>
+ <modify-function signature="operator==(const char*)const" remove="all"/>
+ <modify-function signature="operator>(const char*)const" remove="all"/>
+ <modify-function signature="operator>(const char*)const" remove="all"/>
+ <modify-function signature="operator>=(const char*)const" remove="all"/>
+ <modify-function signature="operator>=(const char*)const" remove="all"/>
+ <modify-function signature="operator&lt;(const char*)const" remove="all"/>
+ <modify-function signature="operator&lt;=(const char*)const" remove="all"/>
+ <modify-function signature="operator!=(const char*)const" remove="all"/>
<modify-function signature="operator+=(const char*)" remove="all"/>
<modify-function signature="operator+(QByteArray,const char*)" remove="all"/>
<modify-function signature="operator+(const char*,QByteArray)" remove="all"/>
@@ -2190,12 +2187,6 @@
<modify-function signature="number(qulonglong,int)" remove="all"/>
<modify-function signature="operator+=(const char*)" remove="all"/>
<modify-function signature="operator+(char,QByteArray)" remove="all"/>
- <modify-function signature="operator==(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator!=(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator&lt;(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator&lt;=(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator>(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator>=(const char*,QByteArray)" remove="all"/>
<!-- Those types have the same representation in Python, an overload
would be useless and cause overflow errors. -->
<modify-function signature="setNum(uint,int)" remove="all"/>
diff --git a/sources/pyside6/doc/tutorials/basictutorial/qrcfiles.rst b/sources/pyside6/doc/tutorials/basictutorial/qrcfiles.rst
index b6861f920..2666f854f 100644
--- a/sources/pyside6/doc/tutorials/basictutorial/qrcfiles.rst
+++ b/sources/pyside6/doc/tutorials/basictutorial/qrcfiles.rst
@@ -75,6 +75,11 @@ To use the generated file, add the following import at the top of your main Pyth
import rc_icons
+.. note:: The tool uses `Zstandard` as a compression algorithm, which at its default
+ compression level (implementation-defined) may produce results that are
+ not usable on other platforms. To ensure the files are usable on all
+ platforms, the compression level should be reduced or `zlib` should
+ be chosen as compression algorithm (see ``pyside6-rcc --help``).
Changes in the code
===================
diff --git a/sources/shiboken6/tests/samplebinding/typesystem_sample.xml b/sources/shiboken6/tests/samplebinding/typesystem_sample.xml
index 305448b93..55309ab04 100644
--- a/sources/shiboken6/tests/samplebinding/typesystem_sample.xml
+++ b/sources/shiboken6/tests/samplebinding/typesystem_sample.xml
@@ -1900,10 +1900,8 @@
<!-- Functions removed to proper deal with strings containing zeroes -->
<modify-function signature="append(const char*)" remove="all" />
<modify-function signature="append(const char*,int)" remove="all" />
- <modify-function signature="operator==(const char*,ByteArray)" remove="all" />
- <modify-function signature="operator==(ByteArray,const char*)" remove="all" />
- <modify-function signature="operator!=(const char*,ByteArray)" remove="all" />
- <modify-function signature="operator!=(ByteArray,const char*)" remove="all" />
+ <modify-function signature="operator==(const char*)const" remove="all" />
+ <modify-function signature="operator!=(const char*)const" remove="all" />
<modify-function signature="operator+(ByteArray,const char*)" remove="all" />
<modify-function signature="operator+(const char*,ByteArray)" remove="all" />
<modify-function signature="operator+=(const char*)" remove="all" />
diff --git a/sources/shiboken6_generator/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6_generator/ApiExtractor/abstractmetabuilder.cpp
index deb6acbec..2413cc1ad 100644
--- a/sources/shiboken6_generator/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken6_generator/ApiExtractor/abstractmetabuilder.cpp
@@ -160,6 +160,14 @@ const QMultiHash<QString, QString> &AbstractMetaBuilder::typedefTargetToName() c
return d->m_typedefTargetToName;
}
+static inline bool warnAboutConstMismatch(const AbstractMetaFunctionCPtr &function,
+ const QString &signature)
+{
+ return function->isConstant() && !signature.startsWith(u'^') && signature.endsWith(u')')
+ // An operator synthesized from a free operator?
+ && !(function->isOperatorOverload() && signature.contains(u','));
+}
+
// Check whether a function modification can be found in a class, else
// warn with candidates.
static void checkModification(const FunctionModification &modification,
@@ -176,7 +184,7 @@ static void checkModification(const FunctionModification &modification,
const QString &signature = modification.signature();
auto it = std::find_if(functions.cbegin(), functions.cend(), modificationPredicate);
if (it != functions.cend()) {
- if ((*it)->isConstant() && signature.endsWith(u')')) // Warn about missing const
+ if (warnAboutConstMismatch(*it, signature))
qCWarning(lcShiboken, "%s", qPrintable(msgModificationConstMismatch(*it, signature)));
return;
}
@@ -348,6 +356,8 @@ void AbstractMetaBuilderPrivate::traverseFreeOperatorFunction(const FunctionMode
flags.setFlag(InternalFunctionFlag::OperatorClassArgumentByValue);
}
metaFunction->setFlags(flags);
+ if (metaFunction->isComparisonOperator())
+ metaFunction->setConstant(true);
metaFunction->setAccess(Access::Public);
AbstractMetaClass::addFunction(baseoperandClass, metaFunction);
ReportHandler::addGeneralMessage(msgSynthesizedFunction(metaFunction, item));
@@ -1273,7 +1283,10 @@ void AbstractMetaBuilderPrivate::traverseScopeMembers(const ScopeModelItem &item
{
// Classes/Namespace members
traverseFields(item, metaClass);
- traverseFunctions(item, metaClass);
+ if (item->kind() == _CodeModelItem::Kind_Class)
+ traverseClassFunctions(item, metaClass);
+ else
+ traverseNameSpaceFunctions(item, metaClass);
// Inner classes
const ClassList &innerClasses = item->classes();
@@ -1442,113 +1455,126 @@ void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(const Abstrac
metaFunction->setType(metaType);
}
-AbstractMetaFunctionList
- AbstractMetaBuilderPrivate::classFunctionList(const ScopeModelItem &scopeItem,
- AbstractMetaClass::Attributes *constructorAttributes,
- const AbstractMetaClassPtr &currentClass)
+void AbstractMetaBuilderPrivate::traverseNameSpaceFunctions(const ScopeModelItem& scopeItem,
+ const AbstractMetaClassPtr &currentClass)
+
{
- *constructorAttributes = {};
- AbstractMetaFunctionList result;
+ Q_ASSERT(currentClass);
+ AbstractMetaFunctionList functions;
const FunctionList &scopeFunctionList = scopeItem->functions();
- result.reserve(scopeFunctionList.size());
- const bool isNamespace = currentClass->isNamespace();
+ functions.reserve(scopeFunctionList.size());
for (const FunctionModelItem &function : scopeFunctionList) {
- if (isNamespace && function->isOperator()) {
+ if (function->isOperator()) {
traverseFreeOperatorFunction(function, currentClass);
- } else if (function->isSpaceshipOperator() && !function->isDeleted()) {
- if (currentClass) {
- AbstractMetaClass::addSynthesizedComparisonOperators(currentClass,
- InternalFunctionFlag::OperatorCpp20Spaceship);
- }
} else if (auto metaFunction = traverseFunction(function, currentClass)) {
- result.append(metaFunction);
- } else if (!function->isDeleted() && function->functionType() == CodeModel::Constructor) {
- // traverseFunction() failed: mark rejected constructors
- auto arguments = function->arguments();
- *constructorAttributes |= AbstractMetaClass::HasRejectedConstructor;
- if (arguments.isEmpty() || arguments.constFirst()->defaultValue())
- *constructorAttributes |= AbstractMetaClass::HasRejectedDefaultConstructor;
+ metaFunction->setCppAttribute(FunctionAttribute::Static);
+ functions.append(metaFunction);
+ AbstractMetaClass::addFunction(currentClass, metaFunction);
+ applyFunctionModifications(metaFunction);
}
}
- return result;
+ fillAddedFunctions(currentClass);
}
-void AbstractMetaBuilderPrivate::traverseFunctions(const ScopeModelItem& scopeItem,
- const AbstractMetaClassPtr &metaClass)
+void AbstractMetaBuilderPrivate::traverseClassFunction(const AbstractMetaFunctionPtr &metaFunction,
+ const AbstractMetaClassPtr &metaClass)
{
- AbstractMetaClass::Attributes constructorAttributes;
- const AbstractMetaFunctionList functions =
- classFunctionList(scopeItem, &constructorAttributes, metaClass);
- metaClass->setAttributes(metaClass->attributes() | constructorAttributes);
-
- for (const auto &metaFunction : functions) {
- if (metaClass->isNamespace())
- metaFunction->setCppAttribute(FunctionAttribute::Static);
-
- const auto propertyFunction = metaClass->searchPropertyFunction(metaFunction->name());
- if (propertyFunction.index >= 0) {
- QPropertySpec prop = metaClass->propertySpecs().at(propertyFunction.index);
- switch (propertyFunction.function) {
- case AbstractMetaClass::PropertyFunction::Read:
- // Property reader must be in the form "<type> name()"
- if (!metaFunction->isSignal()
- && prop.typeEntry() == metaFunction->type().typeEntry()
- && metaFunction->arguments().isEmpty()) {
- *metaFunction += AbstractMetaFunction::PropertyReader;
- metaFunction->setPropertySpecIndex(propertyFunction.index);
- }
- break;
- case AbstractMetaClass::PropertyFunction::Write:
- // Property setter must be in the form "void name(<type>)"
- // Make sure the function was created with all arguments; some
- // argument can be missing during the parsing because of errors
- // in the typesystem.
- if (metaFunction->isVoid() && metaFunction->arguments().size() == 1
- && (prop.typeEntry() == metaFunction->arguments().at(0).type().typeEntry())) {
- *metaFunction += AbstractMetaFunction::PropertyWriter;
- metaFunction->setPropertySpecIndex(propertyFunction.index);
- }
- break;
- case AbstractMetaClass::PropertyFunction::Reset:
- // Property resetter must be in the form "void name()"
- if (metaFunction->isVoid() && metaFunction->arguments().isEmpty()) {
- *metaFunction += AbstractMetaFunction::PropertyResetter;
- metaFunction->setPropertySpecIndex(propertyFunction.index);
- }
- break;
- case AbstractMetaClass::PropertyFunction::Notify:
- if (metaFunction->isSignal()) {
- *metaFunction += AbstractMetaFunction::PropertyNotify;
- metaFunction->setPropertySpecIndex(propertyFunction.index);
- }
+ const auto propertyFunction = metaClass->searchPropertyFunction(metaFunction->name());
+ if (propertyFunction.index >= 0) {
+ QPropertySpec prop = metaClass->propertySpecs().at(propertyFunction.index);
+ switch (propertyFunction.function) {
+ case AbstractMetaClass::PropertyFunction::Read:
+ // Property reader must be in the form "<type> name()"
+ if (!metaFunction->isSignal()
+ && prop.typeEntry() == metaFunction->type().typeEntry()
+ && metaFunction->arguments().isEmpty()) {
+ *metaFunction += AbstractMetaFunction::PropertyReader;
+ metaFunction->setPropertySpecIndex(propertyFunction.index);
+ }
+ break;
+ case AbstractMetaClass::PropertyFunction::Write:
+ // Property setter must be in the form "void name(<type>)"
+ // Make sure the function was created with all arguments; some
+ // argument can be missing during the parsing because of errors
+ // in the typesystem.
+ if (metaFunction->isVoid() && metaFunction->arguments().size() == 1
+ && (prop.typeEntry() == metaFunction->arguments().at(0).type().typeEntry())) {
+ *metaFunction += AbstractMetaFunction::PropertyWriter;
+ metaFunction->setPropertySpecIndex(propertyFunction.index);
+ }
+ break;
+ case AbstractMetaClass::PropertyFunction::Reset:
+ // Property resetter must be in the form "void name()"
+ if (metaFunction->isVoid() && metaFunction->arguments().isEmpty()) {
+ *metaFunction += AbstractMetaFunction::PropertyResetter;
+ metaFunction->setPropertySpecIndex(propertyFunction.index);
+ }
+ break;
+ case AbstractMetaClass::PropertyFunction::Notify:
+ if (metaFunction->isSignal()) {
+ *metaFunction += AbstractMetaFunction::PropertyNotify;
+ metaFunction->setPropertySpecIndex(propertyFunction.index);
}
}
+ }
- if (metaFunction->functionType() == AbstractMetaFunction::ConstructorFunction
- && metaFunction->isPrivate()) {
- metaClass->setHasPrivateConstructor(true);
- }
- if (metaFunction->isConstructor() && !metaFunction->isPrivate()) // Including Copy CT
- metaClass->setHasNonPrivateConstructor(true);
+ if (metaFunction->isPrivate() && metaFunction->functionType() == AbstractMetaFunction::ConstructorFunction) {
+ metaClass->setHasPrivateConstructor(true);
+ return;
+ }
- if (!metaFunction->isDestructor()
- && !(metaFunction->isPrivate() && metaFunction->functionType() == AbstractMetaFunction::ConstructorFunction)) {
+ if (metaFunction->isConstructor() && !metaFunction->isPrivate()) // Including Copy CT
+ metaClass->setHasNonPrivateConstructor(true);
- if (metaFunction->isSignal() && metaClass->hasSignal(metaFunction.get()))
- ReportHandler::addGeneralMessage(msgSignalOverloaded(metaClass, metaFunction.get()));
+ if (metaFunction->isDestructor()) {
+ metaClass->setHasPrivateDestructor(metaFunction->isPrivate());
+ metaClass->setHasProtectedDestructor(metaFunction->isProtected());
+ metaClass->setHasVirtualDestructor(metaFunction->isVirtual());
+ return;
+ }
- if (metaFunction->isConversionOperator())
- fixReturnTypeOfConversionOperator(metaFunction);
+ if (metaFunction->isSignal() && metaClass->hasSignal(metaFunction.get()))
+ ReportHandler::addGeneralMessage(msgSignalOverloaded(metaClass, metaFunction.get()));
- AbstractMetaClass::addFunction(metaClass, metaFunction);
- applyFunctionModifications(metaFunction);
- } else if (metaFunction->isDestructor()) {
- metaClass->setHasPrivateDestructor(metaFunction->isPrivate());
- metaClass->setHasProtectedDestructor(metaFunction->isProtected());
- metaClass->setHasVirtualDestructor(metaFunction->isVirtual());
+ if (metaFunction->isConversionOperator())
+ fixReturnTypeOfConversionOperator(metaFunction);
+
+ AbstractMetaClass::addFunction(metaClass, metaFunction);
+ applyFunctionModifications(metaFunction);
+}
+
+void AbstractMetaBuilderPrivate::traverseClassFunction(const ScopeModelItem& scopeItem,
+ const FunctionModelItem &function,
+ const AbstractMetaFunctionPtr &metaFunction,
+ const AbstractMetaClassPtr &metaClass) const
+{
+ Q_UNUSED(scopeItem)
+ Q_UNUSED(function)
+ traverseClassFunction(metaFunction, metaClass);
+}
+
+void AbstractMetaBuilderPrivate::traverseClassFunctions(const ScopeModelItem& scopeItem,
+ const AbstractMetaClassPtr &metaClass)
+{
+ Q_ASSERT(metaClass);
+ AbstractMetaClass::Attributes constructorAttributes;
+ for (const FunctionModelItem &function : scopeItem->functions()) {
+ if (function->isSpaceshipOperator() && !function->isDeleted()) {
+ AbstractMetaClass::addSynthesizedComparisonOperators(metaClass,
+ InternalFunctionFlag::OperatorCpp20Spaceship);
+ } else if (auto metaFunction = traverseFunction(function, metaClass)) {
+ traverseClassFunction(scopeItem, function, metaFunction, metaClass);
+ } else if (!function->isDeleted() && function->functionType() == CodeModel::Constructor) {
+ // traverseFunction() failed: mark rejected constructors
+ auto arguments = function->arguments();
+ constructorAttributes |= AbstractMetaClass::HasRejectedConstructor;
+ if (arguments.isEmpty() || arguments.constFirst()->defaultValue())
+ constructorAttributes |= AbstractMetaClass::HasRejectedDefaultConstructor;
}
}
+ metaClass->setAttributes(metaClass->attributes() | constructorAttributes);
+
fillAddedFunctions(metaClass);
}
@@ -1803,12 +1829,10 @@ AbstractMetaFunctionPtr
// Check if it's a reverse operator
if (metaArguments[1].type().typeEntry() == metaClass->typeEntry()) {
metaFunction->setReverseOperator(true);
- // we need to call these two function to cache the old signature (with two args)
- // we do this buggy behaviour to comply with the original apiextractor buggy behaviour.
- metaFunction->signature();
- metaFunction->minimalSignature();
- metaArguments.removeLast();
- metaFunction->setArguments(metaArguments);
+ // Cache the old signature (with two args) for modifications
+ QString minimalSignature = metaFunction->minimalSignature();
+ metaFunction->takeArgument(1);
+ metaFunction->setUnresolvedSignatures({minimalSignature});
} else {
qCWarning(lcShiboken) << "Operator overload can have two arguments only if it's a reverse operator!";
}
diff --git a/sources/shiboken6_generator/ApiExtractor/abstractmetabuilder_p.h b/sources/shiboken6_generator/ApiExtractor/abstractmetabuilder_p.h
index 5dc934934..b503f4b33 100644
--- a/sources/shiboken6_generator/ApiExtractor/abstractmetabuilder_p.h
+++ b/sources/shiboken6_generator/ApiExtractor/abstractmetabuilder_p.h
@@ -102,11 +102,16 @@ public:
std::optional<AbstractMetaEnum>
traverseTypedefedEnum(const FileModelItem &dom, const TypeDefModelItem &typeDefItem,
const AbstractMetaClassPtr &enclosing);
- AbstractMetaFunctionList classFunctionList(const ScopeModelItem &scopeItem,
- AbstractMetaClass::Attributes *constructorAttributes,
- const AbstractMetaClassPtr &currentClass);
- void traverseFunctions(const ScopeModelItem& item,
- const AbstractMetaClassPtr &parent);
+ void traverseClassFunction(const ScopeModelItem& scopeItem,
+ const FunctionModelItem &function,
+ const AbstractMetaFunctionPtr &metaFunction,
+ const AbstractMetaClassPtr &metaClass) const;
+ static void traverseClassFunction(const AbstractMetaFunctionPtr &metaFunction,
+ const AbstractMetaClassPtr &metaClass);
+ void traverseNameSpaceFunctions(const ScopeModelItem& scopeItem,
+ const AbstractMetaClassPtr &metaClass);
+ void traverseClassFunctions(const ScopeModelItem& item,
+ const AbstractMetaClassPtr &parent);
static void applyFunctionModifications(const AbstractMetaFunctionPtr &func);
void traverseFields(const ScopeModelItem &item, const AbstractMetaClassPtr &parent);
bool traverseStreamOperator(const FunctionModelItem &functionItem,
diff --git a/sources/shiboken6_generator/ApiExtractor/abstractmetafunction.cpp b/sources/shiboken6_generator/ApiExtractor/abstractmetafunction.cpp
index 6157738a6..f63a923de 100644
--- a/sources/shiboken6_generator/ApiExtractor/abstractmetafunction.cpp
+++ b/sources/shiboken6_generator/ApiExtractor/abstractmetafunction.cpp
@@ -53,7 +53,7 @@ public:
{
}
- void fixArgumentIndexes();
+ void signatureChanged();
QString signature() const;
QString formatMinimalSignature() const;
@@ -104,10 +104,12 @@ public:
TypeSystem::ExceptionHandling m_exceptionHandlingModification = TypeSystem::ExceptionHandling::Unspecified;
};
-void AbstractMetaFunctionPrivate::fixArgumentIndexes()
+void AbstractMetaFunctionPrivate::signatureChanged()
{
for (qsizetype i = 0, size = m_arguments.size(); i < size; ++i)
m_arguments[i].setArgumentIndex(i);
+ m_cachedMinimalSignature.clear();
+ m_cachedSignature.clear();
}
AbstractMetaFunction::AbstractMetaFunction(const QString &name) :
@@ -579,7 +581,10 @@ bool AbstractMetaFunction::isConstant() const
void AbstractMetaFunction::setConstant(bool constant)
{
- d->m_constant = constant;
+ if (d->m_constant != constant) {
+ d->m_constant = constant;
+ d->signatureChanged();
+ }
}
bool AbstractMetaFunction::isUserAdded() const
@@ -727,6 +732,7 @@ AbstractMetaArgumentList &AbstractMetaFunction::arguments()
void AbstractMetaFunction::setArguments(const AbstractMetaArgumentList &arguments)
{
d->m_arguments = arguments;
+ d->signatureChanged();
}
void AbstractMetaFunction::setArgumentName(qsizetype a, const QString &name)
@@ -737,6 +743,7 @@ void AbstractMetaFunction::setArgumentName(qsizetype a, const QString &name)
void AbstractMetaFunction::addArgument(const AbstractMetaArgument &argument)
{
d->m_arguments << argument;
+ d->signatureChanged();
}
AbstractMetaArgument AbstractMetaFunction::takeArgument(qsizetype a)
@@ -744,15 +751,17 @@ AbstractMetaArgument AbstractMetaFunction::takeArgument(qsizetype a)
AbstractMetaArgument result;
if (a >= 0 && a < d->m_arguments.size()) {
result = d->m_arguments.takeAt(a);
- d->fixArgumentIndexes();
+ d->signatureChanged();
}
return result;
}
void AbstractMetaFunction::reverseArguments()
{
- std::reverse(d->m_arguments.begin(), d->m_arguments.end());
- d->fixArgumentIndexes();
+ if (d->m_arguments.size() > 1) {
+ std::reverse(d->m_arguments.begin(), d->m_arguments.end());
+ d->signatureChanged();
+ }
}
static bool modifiedDeprecated(const FunctionModification &mod)
@@ -1062,6 +1071,10 @@ QString AbstractMetaFunctionPrivate::signatureComment(const AbstractMetaFunction
if (!q->isVoid())
str << "->" << (q->isTypeModified() ? q->modifiedTypeName() : q->type().minimalSignature());
+ if (q->isUserAdded())
+ str << " [user added]";
+ else if (q->isUserDeclared())
+ str << " [user declared]";
if (q->isOperatorOverload()) {
if (QString opDescr = msgSynthesizedOperatorDescription(q); !opDescr.isEmpty())
str << ' ' << opDescr;
diff --git a/sources/shiboken6_generator/ApiExtractor/abstractmetalang.cpp b/sources/shiboken6_generator/ApiExtractor/abstractmetalang.cpp
index 35abbcdc0..837ce0d1a 100644
--- a/sources/shiboken6_generator/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken6_generator/ApiExtractor/abstractmetalang.cpp
@@ -945,6 +945,7 @@ void AbstractMetaClass::addSynthesizedComparisonOperators(const AbstractMetaClas
Access::Public, arguments,
returnType, c);
f->setFlags(f->flags() | flags);
+ f->setConstant(true);
AbstractMetaFunctionCPtr newFunction(f);
c->d->addFunction(newFunction);
ReportHandler::addGeneralMessage(msgSynthesizedFunction(newFunction));