From 72a24e28c90dee48bcb03ef2836ac78491e1f25e Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Tue, 15 Oct 2024 14:16:25 +0200 Subject: [PATCH 1/3] [Core] Mark cms::Exception and edm::Exception functions that throw exceptions as noreturn --- FWCore/Utilities/interface/EDMException.h | 16 ++++++++-------- FWCore/Utilities/interface/Exception.h | 4 ++-- FWCore/Utilities/interface/ExceptionCollector.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/FWCore/Utilities/interface/EDMException.h b/FWCore/Utilities/interface/EDMException.h index ac02488f47df7..17e9ae394344f 100644 --- a/FWCore/Utilities/interface/EDMException.h +++ b/FWCore/Utilities/interface/EDMException.h @@ -103,18 +103,18 @@ namespace edm { static const std::string& codeToString(Code); - static void throwThis(Code category, - char const* message0 = "", - char const* message1 = "", - char const* message2 = "", - char const* message3 = "", - char const* message4 = ""); - static void throwThis(Code category, char const* message0, int intVal, char const* message2 = ""); + [[noreturn]] static void throwThis(Code category, + char const* message0 = "", + char const* message1 = "", + char const* message2 = "", + char const* message3 = "", + char const* message4 = ""); + [[noreturn]] static void throwThis(Code category, char const* message0, int intVal, char const* message2 = ""); Exception* clone() const override; private: - void rethrow() override; + [[noreturn]] void rethrow() override; int returnCode_() const override; Code category_; diff --git a/FWCore/Utilities/interface/Exception.h b/FWCore/Utilities/interface/Exception.h index e9e9ca502c614..deffb7a5c8efb 100644 --- a/FWCore/Utilities/interface/Exception.h +++ b/FWCore/Utilities/interface/Exception.h @@ -80,7 +80,7 @@ namespace cms { std::list const& additionalInfo() const; int returnCode() const; - void raise() { rethrow(); } + [[noreturn]] void raise() { rethrow(); } void append(Exception const& another); void append(std::string const& more_information); @@ -132,7 +132,7 @@ namespace cms { private: void init(std::string const& message); - virtual void rethrow(); + [[noreturn]] virtual void rethrow(); virtual int returnCode_() const; // data members diff --git a/FWCore/Utilities/interface/ExceptionCollector.h b/FWCore/Utilities/interface/ExceptionCollector.h index 2b018f1530495..c351a8c33639b 100644 --- a/FWCore/Utilities/interface/ExceptionCollector.h +++ b/FWCore/Utilities/interface/ExceptionCollector.h @@ -35,7 +35,7 @@ namespace edm { ExceptionCollector(std::string const& initialMessage); ~ExceptionCollector(); bool hasThrown() const; - void rethrow() const; + [[noreturn]] void rethrow() const; void call(std::function); void addException(cms::Exception const& exception); From 1637e96339168f5237472a371cccf275ecf45ee3 Mon Sep 17 00:00:00 2001 From: iarspider Date: Tue, 15 Oct 2024 13:00:05 -0700 Subject: [PATCH 2/3] Update Exception.h --- FWCore/Utilities/interface/Exception.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FWCore/Utilities/interface/Exception.h b/FWCore/Utilities/interface/Exception.h index deffb7a5c8efb..957e5fb180107 100644 --- a/FWCore/Utilities/interface/Exception.h +++ b/FWCore/Utilities/interface/Exception.h @@ -80,7 +80,7 @@ namespace cms { std::list const& additionalInfo() const; int returnCode() const; - [[noreturn]] void raise() { rethrow(); } + void raise() { rethrow(); } void append(Exception const& another); void append(std::string const& more_information); From 17fb372012f7bab955370a3d3a4870db7e89d1c8 Mon Sep 17 00:00:00 2001 From: iarspider Date: Wed, 16 Oct 2024 14:36:10 -0700 Subject: [PATCH 3/3] Update ExceptionCollector.h --- FWCore/Utilities/interface/ExceptionCollector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FWCore/Utilities/interface/ExceptionCollector.h b/FWCore/Utilities/interface/ExceptionCollector.h index c351a8c33639b..2b018f1530495 100644 --- a/FWCore/Utilities/interface/ExceptionCollector.h +++ b/FWCore/Utilities/interface/ExceptionCollector.h @@ -35,7 +35,7 @@ namespace edm { ExceptionCollector(std::string const& initialMessage); ~ExceptionCollector(); bool hasThrown() const; - [[noreturn]] void rethrow() const; + void rethrow() const; void call(std::function); void addException(cms::Exception const& exception);