>From 8f2c21c5aac47e81c3abd2e911199cf48cd47918 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 20 Mar 2017 18:17:18 +0100 Subject: [PATCH 1/2] Use [[noreturn]] attribute in declarations, not definitions This fixes multiple clang "function declared '[[noreturn]]' after its first declaration" errors. --- alert.cpp | 2 -- alert.hpp | 3 +++ alert_cli.cpp | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/alert.cpp b/alert.cpp index 6a06970..b7548c1 100644 --- a/alert.cpp +++ b/alert.cpp @@ -267,13 +267,11 @@ void test_alarum() alarum() << "Test alarum()" << LMI_FLUSH; } -[[noreturn]] void test_standard_exception() { throw std::runtime_error("Test a standard exception."); } -[[noreturn]] void test_arbitrary_exception() { throw "Test an arbitrary exception."; diff --git a/alert.hpp b/alert.hpp index 01bc65c..7ad9bc1 100644 --- a/alert.hpp +++ b/alert.hpp @@ -174,6 +174,7 @@ void LMI_SO safely_show_message(std::string const&); void status_alert (std::string const&); void warning_alert (std::string const&); void hobsons_choice_alert (std::string const&); +[[noreturn]] void alarum_alert (std::string const&); /// Implement this function for each platform, in a manner that should @@ -243,7 +244,9 @@ void LMI_SO test_status(); void LMI_SO test_warning(); void LMI_SO test_hobsons_choice(); void LMI_SO test_alarum(); +[[noreturn]] void LMI_SO test_standard_exception(); +[[noreturn]] void LMI_SO test_arbitrary_exception(); void LMI_SO test_catastrophe_report(); diff --git a/alert_cli.cpp b/alert_cli.cpp index c64f60e..39c4076 100644 --- a/alert_cli.cpp +++ b/alert_cli.cpp @@ -96,7 +96,6 @@ void hobsons_choice_alert(std::string const& s) } } -[[noreturn]] void alarum_alert(std::string const& s) { throw std::runtime_error(s); -- 2.8.0.rc1