commit 877a227b565f1569563011402f05f43b0e73acc9
Author: Scott Kostyshak <[email protected]>
Date: Sat Jul 5 19:43:30 2025 +0200
Fix more warnings from -Wmissing-noreturn
This fix required a couple of changes:
1. A chunk of declarations was moved above a class definition.
See here for why:
https://stackoverflow.com/a/79474684/1376404
2. The lyx_exit() dummy definitions are modified to include "abort();"
This makes it so the compiler doesn't complain about these
variants being marked as "noreturn" and actually returning.
---
src/LyX.h | 24 +++++++++++++++---------
src/client/client.cpp | 2 +-
src/support/tests/dummy_functions.cpp | 2 +-
src/tests/dummy_functions.cpp | 2 +-
src/tex2lyx/dummy_impl.cpp | 2 +-
5 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/src/LyX.h b/src/LyX.h
index d6664e3439..8e409be2d8 100644
--- a/src/LyX.h
+++ b/src/LyX.h
@@ -61,6 +61,21 @@ namespace frontend {
class Application;
}
+
+/// This chunk is above the LyX class so that
+/// we can use the [[noreturn]] property.
+/// (https://stackoverflow.com/a/79474684/1376404)
+///
+/// in the case of failure
+void emergencyCleanup();
+/// Try to exit LyX properly.
+/// \p exit_code is 0 by default, if a non zero value is passed,
+/// emergencyCleanup() will be called before exiting.
+[[noreturn]] void lyx_exit(int exit_code);
+/// Execute batch commands if available.
+void execBatchCommands();
+
+
/// initial startup
class LyX {
friend class LyXConsoleApp;
@@ -161,15 +176,6 @@ private:
};
-/// in the case of failure
-void emergencyCleanup();
-/// Try to exit LyX properly.
-/// \p exit_code is 0 by default, if a non zero value is passed,
-/// emergencyCleanup() will be called before exiting.
-void lyx_exit(int exit_code);
-/// Execute batch commands if available.
-void execBatchCommands();
-
///
FuncStatus getStatus(FuncRequest const & action);
diff --git a/src/client/client.cpp b/src/client/client.cpp
index a9be2d5785..70a6125a3e 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -73,7 +73,7 @@ LyXRC lyxrc;
// Keep the linker happy on Windows
void lyx_exit(int)
-{}
+{abort();}
// Dummy language support
Messages const & getGuiMessages()
diff --git a/src/support/tests/dummy_functions.cpp
b/src/support/tests/dummy_functions.cpp
index b7e27ed70b..8f7e39774a 100644
--- a/src/support/tests/dummy_functions.cpp
+++ b/src/support/tests/dummy_functions.cpp
@@ -14,7 +14,7 @@ namespace lyx {
LyXRC lyxrc;
// Keep the linker happy on Windows
- void lyx_exit(int) {}
+ void lyx_exit(int) {abort();}
// Dummy language support
Messages const & getGuiMessages()
diff --git a/src/tests/dummy_functions.cpp b/src/tests/dummy_functions.cpp
index 190a44f645..f32d377e12 100644
--- a/src/tests/dummy_functions.cpp
+++ b/src/tests/dummy_functions.cpp
@@ -18,7 +18,7 @@ bool verbose = false;
LyXRC lyxrc;
// Keep the linker happy on Windows
-void lyx_exit(int) {}
+void lyx_exit(int) {abort();}
// Dummy language support
Messages const & getGuiMessages()
diff --git a/src/tex2lyx/dummy_impl.cpp b/src/tex2lyx/dummy_impl.cpp
index 5170f7898f..fa3aef2628 100644
--- a/src/tex2lyx/dummy_impl.cpp
+++ b/src/tex2lyx/dummy_impl.cpp
@@ -104,7 +104,7 @@ string alignmentToCSS(LyXAlignment)
//
void lyx_exit(int)
-{}
+{abort();}
namespace xml {
docstring StartTag::writeTag() const { return docstring(); }
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs