Fix error messages on error when loading gdt

This commit is contained in:
Jan 2021-03-28 13:07:14 +02:00
parent 41b4fb8c9a
commit 49f19d95c2
2 changed files with 9 additions and 5 deletions

View File

@ -397,7 +397,7 @@ class Linker::Impl
const auto gdtFile = gdtSearchPath->Open(i->second->m_value + ".gdt"); const auto gdtFile = gdtSearchPath->Open(i->second->m_value + ".gdt");
if (!gdtFile.IsOpen()) if (!gdtFile.IsOpen())
{ {
std::cout << "Failed to open file for gdt \"" << i->second << "\"" << std::endl; std::cout << "Failed to open file for gdt \"" << i->second->m_value << "\"" << std::endl;
return false; return false;
} }

View File

@ -126,15 +126,12 @@ bool GdtReader::ReadProperties(GdtEntry& entry)
if (!ReadStringContent(propertyKey)) if (!ReadStringContent(propertyKey))
return false; return false;
if (PeekChar() != '"') if (PeekChar() != '"' || !ReadStringContent(propertyValue))
{ {
PrintError("Expected value string"); PrintError("Expected value string");
return false; return false;
} }
if (!ReadStringContent(propertyValue))
return false;
entry.m_properties.emplace(std::move(propertyKey), std::move(propertyValue)); entry.m_properties.emplace(std::move(propertyKey), std::move(propertyValue));
} }
@ -207,7 +204,10 @@ bool GdtReader::Read(Gdt& gdt)
{ {
NextChar(); NextChar();
if (!ReadStringContent(entry.m_gdf_name)) if (!ReadStringContent(entry.m_gdf_name))
{
PrintError("Expected gdf name string");
return false; return false;
}
if (NextChar() != ')') if (NextChar() != ')')
{ {
PrintError("Expected closing parenthesis"); PrintError("Expected closing parenthesis");
@ -219,7 +219,10 @@ bool GdtReader::Read(Gdt& gdt)
NextChar(); NextChar();
std::string parentName; std::string parentName;
if (!ReadStringContent(parentName)) if (!ReadStringContent(parentName))
{
PrintError("Expected parent name string");
return false; return false;
}
if (NextChar() != ']') if (NextChar() != ']')
{ {
PrintError("Expected closing square brackets"); PrintError("Expected closing square brackets");
@ -238,6 +241,7 @@ bool GdtReader::Read(Gdt& gdt)
} }
else else
{ {
PrintError("Expected gdf or parent opening");
return false; return false;
} }