diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2024-12-11 19:15:18 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2024-12-11 21:48:37 +0100 |
commit | e166206702c8dbd3162452cf26f368e856ac0138 (patch) | |
tree | e4e659fc91b0a47f04755b6298b8085370aefc8d /src/libctor.cc | |
parent | 936fb83eec4038a48e6e42f9f5d93677dc216ab4 (diff) |
More clang-tidy fixes and increase warning level (and fix them)
Diffstat (limited to 'src/libctor.cc')
-rw-r--r-- | src/libctor.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libctor.cc b/src/libctor.cc index 9be14b2..b1fbaea 100644 --- a/src/libctor.cc +++ b/src/libctor.cc @@ -15,6 +15,7 @@ #include <deque> #include <fstream> #include <cstdlib> +#include <span> #include <getoptpp/getoptpp.hpp> @@ -27,6 +28,8 @@ int main(int argc, char* argv[]) { + auto args = std::span(argv, static_cast<std::size_t>(argc)); + ctor::settings settings{}; const auto& c = ctor::get_configuration(); @@ -34,12 +37,12 @@ int main(int argc, char* argv[]) settings.parallel_processes = std::max(1u, std::thread::hardware_concurrency()) * 2 - 1; - if(argc > 1 && std::string(argv[1]) == "configure") + if(args.size() > 1 && std::string(args[1]) == "configure") { return configure(settings, argc, argv); } - if(argc > 1 && std::string(argv[1]) == "reconfigure") + if(args.size() > 1 && std::string(args[1]) == "reconfigure") { return reconfigure(settings, argc, argv); } @@ -64,7 +67,8 @@ int main(int argc, char* argv[]) [&]() { try { - settings.parallel_processes = std::stoi(optarg); + settings.parallel_processes = + static_cast<std::size_t>(std::stoi(optarg)); } catch(...) { @@ -156,7 +160,7 @@ int main(int argc, char* argv[]) opt.add("help", no_argument, 'h', "Print this help text.", [&]() { - std::cout << "Usage: " << argv[0] << " [options] [target] ...\n"; + std::cout << "Usage: " << args[0] << " [options] [target] ...\n"; std::cout << R"_( where target can be either: configure - run configuration step (cannot be used with other targets). @@ -270,7 +274,6 @@ Options: if(print_configure_db) { no_default_build = true; - const auto& c = ctor::get_configuration(); for(const auto& config : c.tools) { std::cout << config.first << ": " << config.second << "\n"; |