Skip to content

Commit 5f95e98

Browse files
committed
Remove unused CLI helpers and fix replay sign conversions
2 parents 0f5698d + d61a532 commit 5f95e98

8 files changed

Lines changed: 9 additions & 143 deletions

File tree

src/ErrorHandler.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
#include <vix/cli/errors/ErrorPipeline.hpp>
2121
#include <vix/cli/errors/RawLogDetectors.hpp>
2222
#include <vix/cli/errors/build/BuildErrorDetectors.hpp>
23-
#include <vix/utils/Env.hpp>
2423

2524
#include <algorithm>
26-
#include <cstring>
2725
#include <iostream>
2826
#include <sstream>
2927
#include <string>
@@ -54,25 +52,6 @@ namespace
5452
<< "\n";
5553
}
5654

57-
vix::cli::build::BuildDiagnostic make_build_diagnostic(
58-
const vix::cli::errors::CompilerError &err,
59-
const std::string &contextMessage)
60-
{
61-
vix::cli::build::BuildDiagnostic diagnostic;
62-
63-
diagnostic.title = contextMessage.empty()
64-
? "Build failed"
65-
: contextMessage;
66-
67-
diagnostic.error = err.message;
68-
69-
diagnostic.location.file = err.file;
70-
diagnostic.location.line = static_cast<std::size_t>(err.line);
71-
diagnostic.location.column = static_cast<std::size_t>(err.column);
72-
73-
return diagnostic;
74-
}
75-
7655
std::vector<std::string> read_code_frame_lines(
7756
const fs::path &file,
7857
std::size_t line,
@@ -223,17 +202,6 @@ namespace
223202
return true;
224203
}
225204

226-
bool hints_verbose_enabled() noexcept
227-
{
228-
const char *level = vix::utils::vix_getenv("VIX_LOG_LEVEL");
229-
230-
if (!level || !*level)
231-
return false;
232-
233-
return std::strcmp(level, "debug") == 0 ||
234-
std::strcmp(level, "trace") == 0;
235-
}
236-
237205
std::size_t line_start(std::string_view text, std::size_t pos)
238206
{
239207
if (pos == std::string_view::npos)

src/build/BuildNinja.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,6 @@ namespace vix::cli::build
253253
return rule;
254254
}
255255

256-
static void append_paths(
257-
std::vector<fs::path> &out,
258-
const fs::path &base,
259-
const std::string &text)
260-
{
261-
const auto tokens = tokenize_ninja_paths(text);
262-
const auto paths = resolve_path_tokens(base, tokens);
263-
264-
out.insert(out.end(), paths.begin(), paths.end());
265-
}
266-
267256
static std::optional<NinjaEdge> parse_build_edge(
268257
const std::vector<std::string> &lines,
269258
std::size_t &index,

src/build/BuildStyle.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
#include <cctype>
2020
#include <iostream>
21+
#include <optional>
2122
#include <regex>
2223
#include <sstream>
2324
#include <system_error>
2425
#include <vector>
25-
#include <optional>
2626

2727
#include <vix/cli/Style.hpp>
2828

@@ -39,27 +39,6 @@ namespace vix::cli::build
3939

4040
namespace
4141
{
42-
static std::string trim_copy(const std::string &value)
43-
{
44-
std::size_t begin = 0;
45-
46-
while (begin < value.size() &&
47-
std::isspace(static_cast<unsigned char>(value[begin])))
48-
{
49-
++begin;
50-
}
51-
52-
std::size_t end = value.size();
53-
54-
while (end > begin &&
55-
std::isspace(static_cast<unsigned char>(value[end - 1])))
56-
{
57-
--end;
58-
}
59-
60-
return value.substr(begin, end - begin);
61-
}
62-
6342
static bool is_absolute_or_relative_path_like(const std::string &value)
6443
{
6544
if (value.empty())

src/build/ObjectCache.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,6 @@ namespace vix::cli::build
316316
return !ec;
317317
}
318318

319-
static std::string manifest_path_for_key(
320-
const fs::path &root,
321-
const std::string &key)
322-
{
323-
return (root / key / "manifest.json").string();
324-
}
325-
326319
static std::uint64_t hash_file_content(const fs::path &path)
327320
{
328321
std::ifstream in(path, std::ios::binary);

src/cmake/CMakeBuild.cpp

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -545,58 +545,6 @@ namespace vix::cli::build
545545
currentProgressLine.clear();
546546
};
547547

548-
auto is_failed_line = [](const std::string &line) -> bool
549-
{
550-
return line.rfind("FAILED:", 0) == 0;
551-
};
552-
553-
auto looks_like_live_error_line = [&](const std::string &line) -> bool
554-
{
555-
if (line.empty())
556-
return false;
557-
558-
if (is_failed_line(line))
559-
return true;
560-
561-
if (line.rfind("ninja:", 0) == 0)
562-
return true;
563-
564-
if (line.find(": error:") != std::string::npos)
565-
return true;
566-
567-
if (line.find(" error: ") != std::string::npos)
568-
return true;
569-
570-
if (line.find("fatal error:") != std::string::npos)
571-
return true;
572-
573-
if (line.find("undefined reference to") != std::string::npos)
574-
return true;
575-
576-
if (line.find("collect2: error:") != std::string::npos)
577-
return true;
578-
579-
if (line.find("ld: error:") != std::string::npos)
580-
return true;
581-
582-
if (line.find("CMake Error") != std::string::npos)
583-
return true;
584-
585-
if (line.rfind("-->", 0) == 0)
586-
return true;
587-
588-
if (line == "code:")
589-
return true;
590-
591-
if (line.rfind("hint:", 0) == 0)
592-
return true;
593-
594-
if (line.rfind("at:", 0) == 0)
595-
return true;
596-
597-
return false;
598-
};
599-
600548
auto should_echo_line = [&](const std::string &line) -> bool
601549
{
602550
if (quiet)

src/commands/replay/ReplayId.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ namespace vix::commands::replay
107107

108108
std::uint64_t hash = offset;
109109

110-
for (unsigned char c : value)
110+
for (char ch : value)
111111
{
112+
const auto c = static_cast<unsigned char>(ch);
113+
112114
hash ^= static_cast<std::uint64_t>(c);
113115
hash *= prime;
114116
}

src/commands/replay/ReplayPaths.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ namespace vix::commands::replay
9090
if (id.empty())
9191
return false;
9292

93-
for (unsigned char c : id)
93+
for (char ch : id)
9494
{
95+
const auto c = static_cast<unsigned char>(ch);
96+
9597
const bool ok =
9698
std::isalnum(c) != 0 ||
97-
c == '-' ||
98-
c == '_';
99+
ch == '-' ||
100+
ch == '_';
99101

100102
if (!ok)
101103
return false;

src/commands/replay/ReplayPrinter.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ using namespace vix::cli::style;
2626

2727
namespace vix::commands::replay
2828
{
29-
3029
namespace
3130
{
32-
3331
/**
3432
* @brief Return a color for a replay status.
3533
*
@@ -124,18 +122,6 @@ namespace vix::commands::replay
124122
out << value << "\n";
125123
}
126124

127-
/**
128-
* @brief Return the first non-empty string.
129-
*
130-
* @param first First value.
131-
* @param second Fallback value.
132-
* @return first if non-empty, otherwise second.
133-
*/
134-
std::string non_empty_or(const std::string &first, const std::string &second)
135-
{
136-
return first.empty() ? second : first;
137-
}
138-
139125
/**
140126
* @brief Split a text into lines.
141127
*
@@ -156,7 +142,6 @@ namespace vix::commands::replay
156142

157143
return lines;
158144
}
159-
160145
} // namespace
161146

162147
void print_replay_header(std::ostream &out, const ReplayRecord &record)

0 commit comments

Comments
 (0)