summaryrefslogtreecommitdiff
path: root/src/rebuild.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2024-12-11 19:15:18 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2024-12-11 21:48:37 +0100
commite166206702c8dbd3162452cf26f368e856ac0138 (patch)
treee4e659fc91b0a47f04755b6298b8085370aefc8d /src/rebuild.cc
parent936fb83eec4038a48e6e42f9f5d93677dc216ab4 (diff)
More clang-tidy fixes and increase warning level (and fix them)
Diffstat (limited to 'src/rebuild.cc')
-rw-r--r--src/rebuild.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/rebuild.cc b/src/rebuild.cc
index c176744..1db5e83 100644
--- a/src/rebuild.cc
+++ b/src/rebuild.cc
@@ -8,6 +8,7 @@
#include <algorithm>
#include <source_location>
#include <cstring>
+#include <span>
#include "configure.h"
#include "ctor.h"
@@ -105,7 +106,7 @@ int unreg(const char* location)
}
}
- return found;
+ return static_cast<int>(found);
}
std::array<ExternalConfigurationEntry, 1024> externalConfigFiles;
@@ -150,6 +151,8 @@ bool contains(const std::vector<ctor::source>& sources, const std::string& file)
bool recompileCheck(const ctor::settings& global_settings, int argc, char* argv[],
bool relaunch_allowed)
{
+ auto args_span = std::span(argv, static_cast<std::size_t>(argc));
+
using namespace std::string_literals;
if(global_settings.verbose > 1)
@@ -187,7 +190,7 @@ bool recompileCheck(const ctor::settings& global_settings, int argc, char* argv[
{
std::filesystem::path buildfile = settings.builddir;
- std::filesystem::path currentfile = argv[0];
+ std::filesystem::path currentfile = args_span[0];
config.target = std::filesystem::relative(currentfile, buildfile).string();
}
@@ -267,11 +270,12 @@ bool recompileCheck(const ctor::settings& global_settings, int argc, char* argv[
{
args.emplace_back("--no-rerun");
}
- for(int i = 1; i < argc; ++i)
+ for(std::size_t i = 1; i < args_span.size(); ++i)
{
- args.emplace_back(argv[i]);
+ args.emplace_back(args_span[i]);
}
- auto ret = execute(settings, argv[0], args);
+
+ auto ret = execute(settings, args_span[0], args);
//if(ret != 0)
{
exit(ret);