aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
Diffstat (limited to 'generator')
-rw-r--r--generator/cppgenerator.cpp11
-rw-r--r--generator/headergenerator.cpp32
2 files changed, 19 insertions, 24 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index 1beda78f7..5b94d2ce8 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -3941,11 +3941,9 @@ void CppGenerator::finishGeneration()
s << INDENT << "}" << endl << endl;
}
- if (getMaxTypeIndex()) {
- s << INDENT << "// Create an array of wrapper types for the current module." << endl;
- s << INDENT << "static PyTypeObject* cppApi[" << "SBK_" << moduleName() << "_IDX_COUNT" << "];" << endl;
- s << INDENT << cppApiVariableName() << " = cppApi;" << endl << endl;
- }
+ s << INDENT << "// Create an array of wrapper types for the current module." << endl;
+ s << INDENT << "static PyTypeObject* cppApi[" << "SBK_" << moduleName() << "_IDX_COUNT" << "];" << endl;
+ s << INDENT << cppApiVariableName() << " = cppApi;" << endl << endl;
s << INDENT << "PyObject* module = Shiboken::Module::create(\"" << moduleName() << "\", ";
s << moduleName() << "_methods);" << endl << endl;
@@ -3992,8 +3990,7 @@ void CppGenerator::finishGeneration()
foreach (QByteArray type, typeResolvers)
s << INDENT << typeResolverString(type) << ';' << endl;
- if (getMaxTypeIndex())
- s << endl << INDENT << "Shiboken::Module::registerTypes(module, " << cppApiVariableName() << ");" << endl;
+ s << endl << INDENT << "Shiboken::Module::registerTypes(module, " << cppApiVariableName() << ");" << endl;
s << endl << INDENT << "if (PyErr_Occurred()) {" << endl;
{
diff --git a/generator/headergenerator.cpp b/generator/headergenerator.cpp
index fb6ff49ef..0fd137ea8 100644
--- a/generator/headergenerator.cpp
+++ b/generator/headergenerator.cpp
@@ -346,24 +346,22 @@ void HeaderGenerator::finishGeneration()
QTextStream protEnumsSurrogates(&protectedEnumSurrogates);
Indentation indent(INDENT);
- AbstractMetaEnumList globalEnums = this->globalEnums();
- if (getMaxTypeIndex()) {
- macrosStream << "// Type indices" << endl;
- foreach (const AbstractMetaClass* metaClass, classes()) {
- writeTypeIndexDefine(macrosStream, metaClass);
- lookForEnumsInClassesNotToBeGenerated(globalEnums, metaClass);
- }
- foreach (const AbstractMetaEnum* metaEnum, globalEnums)
- writeTypeIndexDefineLine(macrosStream, metaEnum->typeEntry());
- macrosStream << "#define ";
- macrosStream.setFieldWidth(60);
- macrosStream << "SBK_"+moduleName()+"_IDX_COUNT";
- macrosStream.setFieldWidth(0);
- macrosStream << ' ' << getMaxTypeIndex() << endl << endl;
- macrosStream << "// This variable stores all python types exported by this module" << endl;
- macrosStream << "extern PyTypeObject** " << cppApiVariableName() << ';' << endl << endl;
- }
+ macrosStream << "// Type indices" << endl;
+ AbstractMetaEnumList globalEnums = this->globalEnums();
+ foreach (const AbstractMetaClass* metaClass, classes()) {
+ writeTypeIndexDefine(macrosStream, metaClass);
+ lookForEnumsInClassesNotToBeGenerated(globalEnums, metaClass);
+ }
+ foreach (const AbstractMetaEnum* metaEnum, globalEnums)
+ writeTypeIndexDefineLine(macrosStream, metaEnum->typeEntry());
+ macrosStream << "#define ";
+ macrosStream.setFieldWidth(60);
+ macrosStream << "SBK_"+moduleName()+"_IDX_COUNT";
+ macrosStream.setFieldWidth(0);
+ macrosStream << ' ' << getMaxTypeIndex() << endl << endl;
+ macrosStream << "// This variable stores all python types exported by this module" << endl;
+ macrosStream << "extern PyTypeObject** " << cppApiVariableName() << ';' << endl << endl;
macrosStream << "// Macros for type check" << endl;
foreach (const AbstractMetaEnum* cppEnum, globalEnums) {