From 52f2345657f1fefc26c707fc529a66f065499fef Mon Sep 17 00:00:00 2001 From: Shuo Chen Date: Tue, 23 Oct 2018 07:11:14 +0000 Subject: [PATCH] Replace "throw ()" with noexcept. Generated by clang-tidy modernize-use-noexcept --- .clang-tidy | 2 +- muduo/base/Exception.cc | 6 +++--- muduo/base/Exception.h | 6 +++--- muduo/base/Mutex.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 76bc6a9af..28b5a0da0 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,6 +1,6 @@ --- # Only run a few checks for now. -Checks: 'modernize-use-equals-default' +Checks: 'modernize-use-noexcept' WarningsAsErrors: '' HeaderFilterRegex: '' AnalyzeTemporaryDtors: false diff --git a/muduo/base/Exception.cc b/muduo/base/Exception.cc index c11eb7b6b..500cb1ad5 100644 --- a/muduo/base/Exception.cc +++ b/muduo/base/Exception.cc @@ -23,14 +23,14 @@ Exception::Exception(const string& msg) fillStackTrace(); } -Exception::~Exception() throw () = default; +Exception::~Exception() noexcept = default; -const char* Exception::what() const throw() +const char* Exception::what() const noexcept { return message_.c_str(); } -const char* Exception::stackTrace() const throw() +const char* Exception::stackTrace() const noexcept { return stack_.c_str(); } diff --git a/muduo/base/Exception.h b/muduo/base/Exception.h index 49b7fec61..eb18935c3 100644 --- a/muduo/base/Exception.h +++ b/muduo/base/Exception.h @@ -17,9 +17,9 @@ class Exception : public std::exception public: explicit Exception(const char* what); explicit Exception(const string& what); - ~Exception() throw() override; - const char* what() const throw() override; - const char* stackTrace() const throw(); + ~Exception() noexcept override; + const char* what() const noexcept override; + const char* stackTrace() const noexcept; private: void fillStackTrace(); diff --git a/muduo/base/Mutex.h b/muduo/base/Mutex.h index b20bec69e..0485c37d5 100644 --- a/muduo/base/Mutex.h +++ b/muduo/base/Mutex.h @@ -89,7 +89,7 @@ extern void __assert_perror_fail (int errnum, const char *file, unsigned int line, const char *function) - __THROW __attribute__ ((__noreturn__)); + noexcept __attribute__ ((__noreturn__)); __END_DECLS #endif