Skip to content

Commit

Permalink
Add a few missing calls to std::exit on error (KhronosGroup#395)
Browse files Browse the repository at this point in the history
Errors were printed but did not stop processing and as a result the
related issues were not caught by CI checks.


Change-Id: I030c7ffe23a4730106a19e212895bef03b6ca456

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
  • Loading branch information
kpet authored Dec 6, 2023
1 parent d5301a8 commit 1c6bb27
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/buildHeaders/jsonToSpirv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,10 @@ void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders)
for (const auto& printingClass : printingClasses) {
if (printingClass["tag"].asString().size() > 0)
tags.insert(printingClass["tag"].asString()); // just for error checking
else
else {
std::cerr << "Error: each instruction_printing_class requires a non-empty \"tag\"" << std::endl;
std::exit(1);
}
if (buildingHeaders || printingClass["tag"].asString() != "@exclude") {
InstructionPrintingClasses.push_back({printingClass["tag"].asString(),
printingClass["heading"].asString()});
Expand All @@ -545,13 +547,15 @@ void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders)
if (printingClass.size() == 0) {
std::cerr << "Error: " << inst["opname"].asString()
<< " requires a non-empty printing \"class\" tag" << std::endl;
std::exit(1);
}
if (!buildingHeaders && printingClass == "@exclude")
continue;
if (tags.find(printingClass) == tags.end()) {
std::cerr << "Error: " << inst["opname"].asString()
<< " requires a \"class\" declared as a \"tag\" in \"instruction printing_class\""
<< std::endl;
std::exit(1);
}
const auto opcode = inst["opcode"].asUInt();
const std::string name = inst["opname"].asString();
Expand Down

0 comments on commit 1c6bb27

Please sign in to comment.