mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-31 01:24:19 +02:00
mkclass: Fix compiler warnings in auto-generated code
This commit is contained in:
parent
50b2d0ca72
commit
bd20951acd
@ -355,7 +355,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||||||
m_Impl << "\t" << "int real_id = id - " << klass.Parent << "::TypeInstance->GetFieldCount();" << std::endl
|
m_Impl << "\t" << "int real_id = id - " << klass.Parent << "::TypeInstance->GetFieldCount();" << std::endl
|
||||||
<< "\t" << "if (real_id < 0) { return " << klass.Parent << "::TypeInstance->GetFieldInfo(id); }" << std::endl;
|
<< "\t" << "if (real_id < 0) { return " << klass.Parent << "::TypeInstance->GetFieldInfo(id); }" << std::endl;
|
||||||
|
|
||||||
if (klass.Fields.size() > 0) {
|
if (!klass.Fields.empty()) {
|
||||||
m_Impl << "\t" << "switch (";
|
m_Impl << "\t" << "switch (";
|
||||||
|
|
||||||
if (!klass.Parent.empty())
|
if (!klass.Parent.empty())
|
||||||
@ -387,7 +387,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||||||
|
|
||||||
m_Impl << "\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl;
|
m_Impl << "\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl;
|
||||||
|
|
||||||
if (klass.Fields.size() > 0)
|
if (!klass.Fields.empty())
|
||||||
m_Impl << "\t" << "}" << std::endl;
|
m_Impl << "\t" << "}" << std::endl;
|
||||||
|
|
||||||
m_Impl << "}" << std::endl << std::endl;
|
m_Impl << "}" << std::endl << std::endl;
|
||||||
@ -437,6 +437,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||||||
m_Impl << "\t" << "int real_id = fieldId - " << klass.Parent << "::TypeInstance->GetFieldCount(); " << std::endl
|
m_Impl << "\t" << "int real_id = fieldId - " << klass.Parent << "::TypeInstance->GetFieldCount(); " << std::endl
|
||||||
<< "\t" << "if (real_id < 0) { " << klass.Parent << "::TypeInstance->RegisterAttributeHandler(fieldId, callback); return; }" << std::endl;
|
<< "\t" << "if (real_id < 0) { " << klass.Parent << "::TypeInstance->RegisterAttributeHandler(fieldId, callback); return; }" << std::endl;
|
||||||
|
|
||||||
|
if (!klass.Fields.empty()) {
|
||||||
m_Impl << "\t" << "switch (";
|
m_Impl << "\t" << "switch (";
|
||||||
|
|
||||||
if (!klass.Parent.empty())
|
if (!klass.Parent.empty())
|
||||||
@ -455,8 +456,12 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_Impl << "\t\t" << "default:" << std::endl
|
m_Impl << "\t\t" << "default:" << std::endl
|
||||||
<< "\t\t\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl
|
<< "\t\t";
|
||||||
<< "\t" << "}" << std::endl;
|
}
|
||||||
|
m_Impl << "\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl;
|
||||||
|
|
||||||
|
if (!klass.Fields.empty())
|
||||||
|
m_Impl << "\t" << "}" << std::endl;
|
||||||
|
|
||||||
m_Impl << "}" << std::endl << std::endl;
|
m_Impl << "}" << std::endl << std::endl;
|
||||||
|
|
||||||
@ -749,6 +754,16 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||||||
m_Impl << "\t" << "int real_id = id - " << klass.Parent << "::TypeInstance->GetFieldCount(); " << std::endl
|
m_Impl << "\t" << "int real_id = id - " << klass.Parent << "::TypeInstance->GetFieldCount(); " << std::endl
|
||||||
<< "\t" << "if (real_id < 0) { return " << klass.Parent << "::NavigateField(id); }" << std::endl;
|
<< "\t" << "if (real_id < 0) { return " << klass.Parent << "::NavigateField(id); }" << std::endl;
|
||||||
|
|
||||||
|
bool haveNavigationFields = false;
|
||||||
|
|
||||||
|
for (const Field& field : klass.Fields) {
|
||||||
|
if (field.Attributes & FANavigation) {
|
||||||
|
haveNavigationFields = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (haveNavigationFields) {
|
||||||
m_Impl << "\t" << "switch (";
|
m_Impl << "\t" << "switch (";
|
||||||
|
|
||||||
if (!klass.Parent.empty())
|
if (!klass.Parent.empty())
|
||||||
@ -769,8 +784,13 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_Impl << "\t\t" << "default:" << std::endl
|
m_Impl << "\t\t" << "default:" << std::endl
|
||||||
<< "\t\t\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl
|
<< "\t\t";
|
||||||
<< "\t" << "}" << std::endl;
|
}
|
||||||
|
|
||||||
|
m_Impl << "\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl;
|
||||||
|
|
||||||
|
if (haveNavigationFields)
|
||||||
|
m_Impl << "\t" << "}" << std::endl;
|
||||||
|
|
||||||
m_Impl << "}" << std::endl << std::endl;
|
m_Impl << "}" << std::endl << std::endl;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user