summaryrefslogtreecommitdiff
path: root/src/rebuild.cc
diff options
context:
space:
mode:
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);