From 56330a54ad29665d2d2f04d2af53c75ebe17d1dd Mon Sep 17 00:00:00 2001 From: Thomas Lindner Date: Sat, 7 Jan 2023 09:12:47 +0100 Subject: [PATCH] mark compilerError as noreturn --- bootstrap/error.hh | 2 +- bootstrap/typecheck.cc | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/bootstrap/error.hh b/bootstrap/error.hh index c72eac6..661c176 100644 --- a/bootstrap/error.hh +++ b/bootstrap/error.hh @@ -17,7 +17,7 @@ class ErrorListener : public antlr4::BaseErrorListener { bool hasError(); - void compilerError(const std::string &file, size_t line); + [[noreturn]] void compilerError(const std::string &file, size_t line); void duplicateFunction(antlr4::Token *token, const std::string &name); void shadowedVariable(antlr4::Token *token, const std::string &name); void syntaxError(antlr4::Recognizer *recognizer, diff --git a/bootstrap/typecheck.cc b/bootstrap/typecheck.cc index 8f10b08..ab81f8c 100644 --- a/bootstrap/typecheck.cc +++ b/bootstrap/typecheck.cc @@ -63,7 +63,6 @@ std::any TypeCheckVisitor::visitType(xlangParser::TypeContext *ctx) { } // unreachable errorlistener.compilerError(__FILE__, __LINE__); - return {}; } std::any TypeCheckVisitor::visitBlock(xlangParser::BlockContext *ctx) { @@ -97,7 +96,6 @@ std::any TypeCheckVisitor::visitStatement(xlangParser::StatementContext *ctx) { } // unreachable errorlistener.compilerError(__FILE__, __LINE__); - return {}; } if (auto condition = ctx->condition()) { auto type = std::any_cast(visitCondition(condition)); @@ -131,7 +129,6 @@ std::any TypeCheckVisitor::visitValue(xlangParser::ValueContext *ctx) { } // unreachable errorlistener.compilerError(__FILE__, __LINE__); - return {}; } #define CHECKOPERATOR(visitLeft, left, visitRight, right, expected) \ @@ -257,7 +254,6 @@ std::any TypeCheckVisitor::visitVariable(xlangParser::VariableContext *ctx) { } // unreachable errorlistener.compilerError(__FILE__, __LINE__); - return {}; } } // namespace xlang