diff --git a/src/Expr.h b/src/Expr.h index 95c1167abe..f341f5a9c4 100644 --- a/src/Expr.h +++ b/src/Expr.h @@ -218,9 +218,10 @@ protected: // TYPE_ERROR. void ExprError(const char msg[]); - void RuntimeError(const std::string& msg) const; - - void RuntimeErrorWithCallStack(const std::string& msg) const; + // These two functions both call Reporter::RuntimeError or Reporter::ExprRuntimeError, + // both of which are marked as [[noreturn]]. + [[noreturn]] void RuntimeError(const std::string& msg) const; + [[noreturn]] void RuntimeErrorWithCallStack(const std::string& msg) const; BroExprTag tag; IntrusivePtr type; diff --git a/src/Reporter.h b/src/Reporter.h index cdb0bc13e9..97f1759963 100644 --- a/src/Reporter.h +++ b/src/Reporter.h @@ -74,11 +74,11 @@ public: // Report a runtime error in evaluating a Bro script expression. This // function will not return but raise an InterpreterException. - void ExprRuntimeError(const Expr* expr, const char* fmt, ...) __attribute__((format(printf, 3, 4))); + [[noreturn]] void ExprRuntimeError(const Expr* expr, const char* fmt, ...) __attribute__((format(printf, 3, 4))); // Report a runtime error in evaluating a Bro script expression. This // function will not return but raise an InterpreterException. - void RuntimeError(const Location* location, const char* fmt, ...) __attribute__((format(printf, 3, 4))); + [[noreturn]] void RuntimeError(const Location* location, const char* fmt, ...) __attribute__((format(printf, 3, 4))); // Report a traffic weirdness, i.e., an unexpected protocol situation // that may lead to incorrectly processing a connnection.