From ff6960a2afa303604a8bd23603e8dbfbbcc16e77 Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 13 Jun 2026 18:15:32 +0300 Subject: [PATCH] Fix -Werror build: drop dead variables, honor nodiscard Surfaced by a -DVOID_WARNINGS_AS_ERRORS=ON build now that Json/Ini are pulled into SHARED module TUs (Log, Fsm, Plugin, Configuration): - Json::Detail::parse_number: removed the unused is_float tracking var. - Ini::from_string: (void)-cast the nodiscard parse() result. - Fsm::Machine::dispatch_event: removed the dead `source` variable (the transition already carries its source state). Module targets now compile clean under -Wall -Wextra -Wpedantic -Werror; 967 tests green, ASan+UBSan clean. Co-Authored-By: Claude Fable 5 --- include/Void/Data/Ini.hpp | 2 +- include/Void/Data/Json.hpp | 5 ++--- src/Fsm/Machine.cpp | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/Void/Data/Ini.hpp b/include/Void/Data/Ini.hpp index f2c5bb0..7266284 100644 --- a/include/Void/Data/Ini.hpp +++ b/include/Void/Data/Ini.hpp @@ -91,7 +91,7 @@ public: [[nodiscard]] static IniFile from_string(std::string_view text) { IniFile f; - parse(f, text); + (void)parse(f, text); return f; } diff --git a/include/Void/Data/Json.hpp b/include/Void/Data/Json.hpp index 13c1fe9..e5550a8 100644 --- a/include/Void/Data/Json.hpp +++ b/include/Void/Data/Json.hpp @@ -220,10 +220,9 @@ struct Parser if (peek() == '-') advance(); if (peek() == '0') { advance(); } else { while (peek() >= '1' && peek() <= '9') advance(); while (peek() >= '0' && peek() <= '9') advance(); } - bool is_float = false; - if (peek() == '.') { is_float = true; advance(); while (peek() >= '0' && peek() <= '9') advance(); } + if (peek() == '.') { advance(); while (peek() >= '0' && peek() <= '9') advance(); } if (peek() == 'e' || peek() == 'E') { - is_float = true; advance(); + advance(); if (peek() == '+' || peek() == '-') advance(); while (peek() >= '0' && peek() <= '9') advance(); } diff --git a/src/Fsm/Machine.cpp b/src/Fsm/Machine.cpp index 42a8058..e12e75d 100644 --- a/src/Fsm/Machine.cpp +++ b/src/Fsm/Machine.cpp @@ -403,7 +403,6 @@ namespace Void::Fsm } const MachineDef::TransitionDef* chosen = nullptr; - StateId source = leaf; for (StateId cur = leaf; cur != kInvalidState && chosen == nullptr; cur = def.state(cur).parent) { for (const auto index : def.transitions_from(cur)) { @@ -415,7 +414,6 @@ namespace Void::Fsm continue; } chosen = &t; - source = cur; break; } if (chosen == nullptr) {