Skip to content

Commit 1c6bb27

Browse files
authored
Add a few missing calls to std::exit on error (KhronosGroup#395)
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 <[email protected]>
1 parent d5301a8 commit 1c6bb27

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/buildHeaders/jsonToSpirv.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,10 @@ void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders)
528528
for (const auto& printingClass : printingClasses) {
529529
if (printingClass["tag"].asString().size() > 0)
530530
tags.insert(printingClass["tag"].asString()); // just for error checking
531-
else
531+
else {
532532
std::cerr << "Error: each instruction_printing_class requires a non-empty \"tag\"" << std::endl;
533+
std::exit(1);
534+
}
533535
if (buildingHeaders || printingClass["tag"].asString() != "@exclude") {
534536
InstructionPrintingClasses.push_back({printingClass["tag"].asString(),
535537
printingClass["heading"].asString()});
@@ -545,13 +547,15 @@ void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders)
545547
if (printingClass.size() == 0) {
546548
std::cerr << "Error: " << inst["opname"].asString()
547549
<< " requires a non-empty printing \"class\" tag" << std::endl;
550+
std::exit(1);
548551
}
549552
if (!buildingHeaders && printingClass == "@exclude")
550553
continue;
551554
if (tags.find(printingClass) == tags.end()) {
552555
std::cerr << "Error: " << inst["opname"].asString()
553556
<< " requires a \"class\" declared as a \"tag\" in \"instruction printing_class\""
554557
<< std::endl;
558+
std::exit(1);
555559
}
556560
const auto opcode = inst["opcode"].asUInt();
557561
const std::string name = inst["opname"].asString();

0 commit comments

Comments
 (0)