diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-11 20:08:10 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-11 20:08:10 +0100 |
commit | 430801b1307b4c820885f161d0b003011c892d77 (patch) | |
tree | 64ce860849ada5c0aa00989532da6639004fe6aa /src | |
parent | 6af7742c35ecdf2831908443ca0e04bf23317a96 (diff) |
Add ctor namespace cfg:: constants and get rid of temporary 'using namespace ctor'
Diffstat (limited to 'src')
-rw-r--r-- | src/bootstrap.cc | 6 | ||||
-rw-r--r-- | src/build.cc | 2 | ||||
-rw-r--r-- | src/configure.cc | 2 | ||||
-rw-r--r-- | src/ctor.h | 2 | ||||
-rw-r--r-- | src/externals_manual.cc | 2 | ||||
-rw-r--r-- | src/libctor.cc | 4 | ||||
-rw-r--r-- | src/rebuild.cc | 12 | ||||
-rw-r--r-- | src/task.cc | 10 | ||||
-rw-r--r-- | src/task_ar.cc | 6 | ||||
-rw-r--r-- | src/task_cc.cc | 2 | ||||
-rw-r--r-- | src/task_fn.cc | 2 | ||||
-rw-r--r-- | src/task_ld.cc | 2 | ||||
-rw-r--r-- | src/task_so.cc | 2 | ||||
-rw-r--r-- | src/tasks.cc | 2 | ||||
-rw-r--r-- | src/tools.cc | 6 | ||||
-rw-r--r-- | src/unittest.cc | 2 | ||||
-rw-r--r-- | src/util.cc | 2 |
17 files changed, 18 insertions, 48 deletions
diff --git a/src/bootstrap.cc b/src/bootstrap.cc index 1fb3807..f091849 100644 --- a/src/bootstrap.cc +++ b/src/bootstrap.cc @@ -35,13 +35,13 @@ bool ctor::configuration::has(const std::string& key) const const std::string& ctor::configuration::get(const std::string& key, const std::string& default_value) const { - if(key == cfg::host_cxx && std::getenv("CXX")) + if(key == ctor::cfg::host_cxx && std::getenv("CXX")) { static std::string s = std::getenv("CXX"); return s; } - if(key == cfg::builddir && std::getenv("BUILDDIR")) + if(key == ctor::cfg::builddir && std::getenv("BUILDDIR")) { static std::string s = std::getenv("BUILDDIR"); return s; @@ -62,7 +62,7 @@ int main(int argc, char* argv[]) ctor::settings settings{}; const auto& c = ctor::get_configuration(); - settings.builddir = c.get(cfg::builddir, settings.builddir); + settings.builddir = c.get(ctor::cfg::builddir, settings.builddir); settings.parallel_processes = std::max(1u, std::thread::hardware_concurrency() * 2 - 1); settings.verbose = 0; diff --git a/src/build.cc b/src/build.cc index 1fe494b..ad30719 100644 --- a/src/build.cc +++ b/src/build.cc @@ -13,8 +13,6 @@ #include "ctor.h" -using namespace ctor; - using namespace std::chrono_literals; int build(const ctor::settings& settings, diff --git a/src/configure.cc b/src/configure.cc index 76103c6..f91f0d9 100644 --- a/src/configure.cc +++ b/src/configure.cc @@ -16,8 +16,6 @@ #include "rebuild.h" #include "externals.h" -using namespace ctor; - std::filesystem::path configurationFile("configuration.cc"); std::filesystem::path configHeaderFile("config.h"); @@ -155,4 +155,4 @@ struct configuration const ctor::configuration& get_configuration(); -} // namespace ctor:: +} // ctor:: diff --git a/src/externals_manual.cc b/src/externals_manual.cc index 84cb422..d6b519b 100644 --- a/src/externals_manual.cc +++ b/src/externals_manual.cc @@ -10,8 +10,6 @@ #include "util.h" #include "tools.h" -using namespace ctor; - extern std::map<std::string, std::string> external_includedir; extern std::map<std::string, std::string> external_libdir; diff --git a/src/libctor.cc b/src/libctor.cc index 69d35cf..21792e1 100644 --- a/src/libctor.cc +++ b/src/libctor.cc @@ -26,14 +26,12 @@ #include "build.h" #include "unittest.h" -using namespace ctor; - int main(int argc, char* argv[]) { ctor::settings settings{}; const auto& c = ctor::get_configuration(); - settings.builddir = c.get(cfg::builddir, settings.builddir); + settings.builddir = c.get(ctor::cfg::builddir, settings.builddir); settings.parallel_processes = std::max(1u, std::thread::hardware_concurrency()) * 2 - 1; diff --git a/src/rebuild.cc b/src/rebuild.cc index 3033a46..0d610b5 100644 --- a/src/rebuild.cc +++ b/src/rebuild.cc @@ -17,8 +17,6 @@ #include "tools.h" #include "util.h" -using namespace ctor; - std::array<BuildConfigurationEntry, 1024> configFiles; std::size_t numConfigFiles{0}; @@ -50,7 +48,7 @@ int reg(ctor::build_configurations (*cb)(const ctor::settings&), return 0; } -} // namespace ctor:: +} // ctor:: int reg(const char* location) { @@ -171,17 +169,17 @@ bool recompileCheck(const ctor::settings& global_settings, int argc, char* argv[ append(config.flags.cxxflags, getOption(tool_chain, opt::cpp_std, "c++20")); const auto& c = ctor::get_configuration(); - if(c.has(cfg::ctor_includedir)) + if(c.has(ctor::cfg::ctor_includedir)) { append(config.flags.cxxflags, getOption(tool_chain, opt::include_path, - c.get(cfg::ctor_includedir))); + c.get(ctor::cfg::ctor_includedir))); } - if(c.has(cfg::ctor_libdir)) + if(c.has(ctor::cfg::ctor_libdir)) { append(config.flags.ldflags, getOption(tool_chain, opt::library_path, - c.get(cfg::ctor_libdir))); + c.get(ctor::cfg::ctor_libdir))); } append(config.flags.ldflags, getOption(tool_chain, opt::link, "ctor")); append(config.flags.ldflags, getOption(tool_chain, opt::threads)); diff --git a/src/task.cc b/src/task.cc index 27e6c44..817ee3a 100644 --- a/src/task.cc +++ b/src/task.cc @@ -6,8 +6,6 @@ #include <unistd.h> #include <iostream> -using namespace ctor; - Task::Task(const ctor::build_configuration& config, const ctor::settings& settings, const std::string& sourceDir) : config(config) @@ -138,17 +136,17 @@ std::string Task::compiler() const switch(outputSystem()) { case ctor::output_system::host: - return c.get(cfg::host_cc, "/usr/bin/gcc"); + return c.get(ctor::cfg::host_cc, "/usr/bin/gcc"); case ctor::output_system::build: - return c.get(cfg::build_cc, "/usr/bin/gcc"); + return c.get(ctor::cfg::build_cc, "/usr/bin/gcc"); } case ctor::language::cpp: switch(outputSystem()) { case ctor::output_system::host: - return c.get(cfg::host_cxx, "/usr/bin/g++"); + return c.get(ctor::cfg::host_cxx, "/usr/bin/g++"); case ctor::output_system::build: - return c.get(cfg::build_cxx, "/usr/bin/g++"); + return c.get(ctor::cfg::build_cxx, "/usr/bin/g++"); } default: std::cerr << "Unknown CC target type\n"; diff --git a/src/task_ar.cc b/src/task_ar.cc index 89bbc40..edd60ae 100644 --- a/src/task_ar.cc +++ b/src/task_ar.cc @@ -10,8 +10,6 @@ #include "execute.h" #include "util.h" -using namespace ctor; - TaskAR::TaskAR(const ctor::build_configuration& config, const ctor::settings& settings, const std::string& target, @@ -102,10 +100,10 @@ int TaskAR::runInner() switch(outputSystem()) { case ctor::output_system::host: - tool = c.get(cfg::host_ar, "/usr/bin/ar"); + tool = c.get(ctor::cfg::host_ar, "/usr/bin/ar"); break; case ctor::output_system::build: - tool = c.get(cfg::build_ar, "/usr/bin/ar"); + tool = c.get(ctor::cfg::build_ar, "/usr/bin/ar"); break; } diff --git a/src/task_cc.cc b/src/task_cc.cc index a8caba0..7f69998 100644 --- a/src/task_cc.cc +++ b/src/task_cc.cc @@ -12,8 +12,6 @@ #include "util.h" #include "tools.h" -using namespace ctor; - TaskCC::TaskCC(const ctor::build_configuration& config, const ctor::settings& settings, const std::string& sourceDir, const ctor::source& source) : Task(config, settings, sourceDir) diff --git a/src/task_fn.cc b/src/task_fn.cc index 7757d7c..b11ff15 100644 --- a/src/task_fn.cc +++ b/src/task_fn.cc @@ -11,8 +11,6 @@ #include "execute.h" #include "util.h" -using namespace ctor; - TaskFn::TaskFn(const ctor::build_configuration& config, const ctor::settings& settings, const std::string& sourceDir, const ctor::source& source) : Task(config, settings, sourceDir) diff --git a/src/task_ld.cc b/src/task_ld.cc index 5e1f8c6..916f3ff 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -11,8 +11,6 @@ #include "util.h" #include "tools.h" -using namespace ctor; - TaskLD::TaskLD(const ctor::build_configuration& config, const ctor::settings& settings, const std::string& target, diff --git a/src/task_so.cc b/src/task_so.cc index 15df61f..0340ff1 100644 --- a/src/task_so.cc +++ b/src/task_so.cc @@ -11,8 +11,6 @@ #include "util.h" #include "tools.h" -using namespace ctor; - TaskSO::TaskSO(const ctor::build_configuration& config, const ctor::settings& settings, const std::string& target, diff --git a/src/tasks.cc b/src/tasks.cc index d10b83f..67bed2b 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -19,8 +19,6 @@ #include "rebuild.h" #include "configure.h" -using namespace ctor; - const std::deque<Target>& getTargets(const ctor::settings& settings, bool resolve_externals) { diff --git a/src/tools.cc b/src/tools.cc index 9e7102e..4aaa515 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -8,8 +8,6 @@ #include <cassert> -using namespace ctor; - ToolChain getToolChain(ctor::output_system system) { const auto& c = ctor::get_configuration(); @@ -17,10 +15,10 @@ ToolChain getToolChain(ctor::output_system system) switch(system) { case ctor::output_system::host: - compiler = c.get(cfg::host_cxx, "g++"); + compiler = c.get(ctor::cfg::host_cxx, "g++"); break; case ctor::output_system::build: - compiler = c.get(cfg::build_cxx, "g++"); + compiler = c.get(ctor::cfg::build_cxx, "g++"); break; } diff --git a/src/unittest.cc b/src/unittest.cc index 9aceb52..237b2e3 100644 --- a/src/unittest.cc +++ b/src/unittest.cc @@ -8,8 +8,6 @@ #include "execute.h" #include "task.h" -using namespace ctor; - int runUnitTests(std::set<std::shared_ptr<Task>>& tasks, const ctor::settings& settings) { diff --git a/src/util.cc b/src/util.cc index f25b7eb..ee56ede 100644 --- a/src/util.cc +++ b/src/util.cc @@ -6,8 +6,6 @@ #include <iostream> #include <fstream> -using namespace ctor; - std::string readFile(const std::string& fileName) { std::ifstream ifs(fileName.c_str(), |