diff --git a/src/GUI/MessageBox.cxx b/src/GUI/MessageBox.cxx index cb0000a25..1d8e5742f 100644 --- a/src/GUI/MessageBox.cxx +++ b/src/GUI/MessageBox.cxx @@ -4,6 +4,8 @@ #include +#include + #include "MessageBox.hxx" #include
@@ -146,16 +148,16 @@ MessageBoxResult modalMessageBox(const std::string& caption, #endif } -MessageBoxResult fatalMessageBox(const std::string& caption, - const std::string& msg, - const std::string& moreText) +[[noreturn]] void fatalMessageBox(const std::string& caption, + const std::string& msg, + const std::string& moreText) { #if defined(SG_WINDOWS) - return win32MessageBox(caption, msg, moreText); + win32MessageBox(caption, msg, moreText); #elif defined(SG_MAC) - return cocoaFatalMessage(msg, moreText); + cocoaFatalMessage(msg, moreText); #elif defined(HAVE_QT) - return QtMessageBox(caption, msg, moreText, true); + QtMessageBox(caption, msg, moreText, true); #else std::string s = "FATAL: "+ msg; if (!moreText.empty()) { @@ -169,8 +171,9 @@ MessageBoxResult fatalMessageBox(const std::string& caption, dlg->setStringValue("text/label", s ); _gui->showDialog("popup"); } - return MSG_BOX_OK; #endif + + std::abort(); } } // of namespace flightgear diff --git a/src/GUI/MessageBox.hxx b/src/GUI/MessageBox.hxx index 505b8ccfb..0811ceef0 100644 --- a/src/GUI/MessageBox.hxx +++ b/src/GUI/MessageBox.hxx @@ -6,7 +6,7 @@ namespace flightgear { -enum MessageBoxResult +enum MessageBoxResult { MSG_BOX_OK, MSG_BOX_YES, @@ -17,10 +17,10 @@ MessageBoxResult modalMessageBox(const std::string& caption, const std::string& msg, const std::string& moreText = std::string()); -MessageBoxResult fatalMessageBox(const std::string& caption, +[[noreturn]] void fatalMessageBox(const std::string& caption, const std::string& msg, const std::string& moreText = std::string()); - + } // of namespace flightgear #endif // of FG_GUI_MESSAGE_BOX_HXX diff --git a/tests/testStubs.cxx b/tests/testStubs.cxx index 4a08148fb..1f8a3e702 100644 --- a/tests/testStubs.cxx +++ b/tests/testStubs.cxx @@ -1,4 +1,5 @@ #include +#include #include #include @@ -112,11 +113,11 @@ namespace flightgear return MSG_BOX_OK; } - MessageBoxResult fatalMessageBox(const std::string& caption, + [[noreturn]] void fatalMessageBox(const std::string& caption, const std::string& msg, const std::string& moreText) { - return MSG_BOX_OK; + std::abort(); } }