From 591f51f3d3becf0ff940516010d406bbeec94cf2 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 15 Mar 2020 21:03:09 -0700 Subject: [PATCH] replace noreturn attribute with standard C++ version Signed-off-by: Rosen Penev --- src/CommandLine.cxx | 4 ++-- src/db/plugins/ProxyDatabasePlugin.cxx | 1 + src/lib/dbus/Error.hxx | 2 +- src/system/FatalError.cxx | 2 +- src/system/FatalError.hxx | 10 +++++----- src/unix/Daemon.hxx | 2 ++ src/util/Alloc.cxx | 2 +- src/util/Compiler.h | 2 -- src/util/Exception.hxx | 4 ++-- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx index 9e9244711..f076cfbf6 100644 --- a/src/CommandLine.cxx +++ b/src/CommandLine.cxx @@ -106,7 +106,7 @@ static constexpr OptionDef option_defs[] = { static constexpr Domain cmdline_domain("cmdline"); -gcc_noreturn +[[noreturn]] static void version() { printf("Music Player Daemon " VERSION " (%s)" @@ -272,7 +272,7 @@ static void PrintOption(const OptionDef &opt) opt.GetDescription()); } -gcc_noreturn +[[noreturn]] static void help() { printf("Usage:\n" diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx index 44e1bee0a..703cf88af 100644 --- a/src/db/plugins/ProxyDatabasePlugin.cxx +++ b/src/db/plugins/ProxyDatabasePlugin.cxx @@ -277,6 +277,7 @@ Convert(TagType tag_type) noexcept return MPD_TAG_COUNT; } +[[noreturn]] static void ThrowError(struct mpd_connection *connection) { diff --git a/src/lib/dbus/Error.hxx b/src/lib/dbus/Error.hxx index 9f1deb8f2..6a5e84f04 100644 --- a/src/lib/dbus/Error.hxx +++ b/src/lib/dbus/Error.hxx @@ -71,7 +71,7 @@ public: return error.message; } - gcc_noreturn + [[noreturn]] void Throw(const char *prefix) const; void CheckThrow(const char *prefix) const; }; diff --git a/src/system/FatalError.cxx b/src/system/FatalError.cxx index f3e8b6e0c..0fc5df8b8 100644 --- a/src/system/FatalError.cxx +++ b/src/system/FatalError.cxx @@ -36,7 +36,7 @@ static constexpr Domain fatal_error_domain("fatal_error"); -gcc_noreturn +[[noreturn]] static void Abort() { diff --git a/src/system/FatalError.hxx b/src/system/FatalError.hxx index 26cdcb189..43554d71d 100644 --- a/src/system/FatalError.hxx +++ b/src/system/FatalError.hxx @@ -29,11 +29,11 @@ /** * Log the specified message and abort the process. */ -gcc_noreturn +[[noreturn]] void FatalError(const char *msg); -gcc_noreturn +[[noreturn]] void FormatFatalError(const char *fmt, ...); @@ -42,19 +42,19 @@ FormatFatalError(const char *fmt, ...); * fail. Prints the given message, the system error message (from * errno or GetLastError()) and abort the process. */ -gcc_noreturn +[[noreturn]] void FatalSystemError(const char *msg); #ifdef _WIN32 -gcc_noreturn +[[noreturn]] void FatalSystemError(const char *msg, DWORD code); #endif -gcc_noreturn +[[noreturn]] void FormatFatalSystemError(const char *fmt, ...); diff --git a/src/unix/Daemon.hxx b/src/unix/Daemon.hxx index fca1cb2fb..dd34faac2 100644 --- a/src/unix/Daemon.hxx +++ b/src/unix/Daemon.hxx @@ -45,10 +45,12 @@ daemonize_finish() * pid file. */ #ifndef _WIN32 +[[noreturn]] void daemonize_kill(); #else #include +[[noreturn]] static inline void daemonize_kill() { diff --git a/src/util/Alloc.cxx b/src/util/Alloc.cxx index de62051f8..c610a68df 100644 --- a/src/util/Alloc.cxx +++ b/src/util/Alloc.cxx @@ -25,7 +25,7 @@ #include #include -gcc_noreturn +[[noreturn]] static void oom() { diff --git a/src/util/Compiler.h b/src/util/Compiler.h index 899851cad..6371fc20f 100644 --- a/src/util/Compiler.h +++ b/src/util/Compiler.h @@ -71,7 +71,6 @@ #define gcc_deprecated __attribute__((deprecated)) #define gcc_may_alias __attribute__((may_alias)) #define gcc_malloc __attribute__((malloc)) -#define gcc_noreturn __attribute__((noreturn)) #define gcc_packed __attribute__((packed)) #define gcc_printf(a,b) __attribute__((format(printf, a, b))) #define gcc_pure __attribute__((pure)) @@ -101,7 +100,6 @@ #define gcc_deprecated #define gcc_may_alias #define gcc_malloc -#define gcc_noreturn #define gcc_packed #define gcc_printf(a,b) #define gcc_pure diff --git a/src/util/Exception.hxx b/src/util/Exception.hxx index 9f5bb4952..6aa94f153 100644 --- a/src/util/Exception.hxx +++ b/src/util/Exception.hxx @@ -42,14 +42,14 @@ * the std::exception_ptr itself. */ template -gcc_noreturn +[[noreturn]] inline void ThrowException(T &&t) { throw std::forward(t); } -gcc_noreturn +[[noreturn]] inline void ThrowException(std::exception_ptr ep) {