From 321f25af1ba33d8409cd294b4f50d0d3e79cf3bd Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 14 Jan 2023 12:05:23 +0100 Subject: Add ar_flag support for ar tool, replacing hardcoded values. --- src/tools.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/tools.cc') diff --git a/src/tools.cc b/src/tools.cc index 476386b..28d3903 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -80,6 +80,10 @@ std::ostream& operator<<(std::ostream& stream, const ctor::ar_opt& opt) // Adding to this enum should also imply adding to the unit-tests below switch(opt) { + case ctor::ar_opt::replace: stream << "ctor::ar_opt::replace"; break; + case ctor::ar_opt::add_index: stream << "ctor::ar_opt::add_index"; break; + case ctor::ar_opt::create: stream << "ctor::ar_opt::create"; break; + case ctor::ar_opt::output: stream << "ctor::ar_opt::output"; break; case ctor::ar_opt::custom: stream << "ctor::ar_opt::custom"; break; } @@ -174,6 +178,11 @@ ctor::ld_flag ld_option(const std::string& flag) return { ctor::ld_opt::custom, flag }; } +ctor::ar_flag ar_option(const std::string& flag) +{ + return { ctor::ar_opt::custom, flag }; +} + std::vector cxx_option(ctor::cxx_opt opt, const std::string& arg) { switch(opt) @@ -280,6 +289,14 @@ std::vector ar_option(ctor::ar_opt opt, const std::string& arg) { switch(opt) { + case ctor::ar_opt::replace: + return {"-r"}; + case ctor::ar_opt::add_index: + return {"-s"}; + case ctor::ar_opt::create: + return {"-c"}; + case ctor::ar_opt::output: + return {arg}; case ctor::ar_opt::custom: return {arg}; } @@ -494,6 +511,7 @@ ctor::ar_flag ar_option(const std::string& flag, ctor::toolchain toolchain) { case ctor::toolchain::gcc: case ctor::toolchain::clang: + return gcc::ar_option(flag); case ctor::toolchain::any: case ctor::toolchain::none: break; -- cgit v1.2.3