From 1484d74c1dfd24cfe5b6f13f76d58ff395e4d253 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 10 Jan 2023 16:00:36 +0100 Subject: Put ctor.h contents in ctor namespace. --- ctor.cc | 4 ++-- src/bootstrap.cc | 10 ++++++---- src/build.cc | 2 ++ src/build.h | 8 +++++--- src/configure.cc | 11 +++++++---- src/configure.h | 6 ++++-- src/ctor.h | 4 ++++ src/externals_manual.cc | 2 ++ src/externals_manual.h | 7 +++++-- src/libctor.cc | 2 ++ src/rebuild.cc | 6 ++++++ src/rebuild.h | 6 +++--- src/task.cc | 2 ++ src/task.h | 22 ++++++++++------------ src/task_ar.cc | 2 ++ src/task_ar.h | 11 ++++------- src/task_cc.cc | 2 ++ src/task_cc.h | 15 ++++++--------- src/task_fn.cc | 2 ++ src/task_fn.h | 13 +++++-------- src/task_ld.cc | 2 ++ src/task_ld.h | 11 ++++------- src/task_so.cc | 2 ++ src/task_so.h | 11 ++++------- src/tasks.cc | 2 ++ src/tasks.h | 13 +++++-------- src/tools.cc | 2 ++ src/tools.h | 2 +- src/unittest.cc | 2 ++ src/unittest.h | 5 ++++- src/util.cc | 2 ++ src/util.h | 2 +- test/ctor.cc | 12 ++++++------ test/source_type_test.cc | 31 +++++++++++++++++-------------- test/tasks_test.cc | 2 ++ test/tools_test.cc | 4 ++++ 36 files changed, 141 insertions(+), 101 deletions(-) diff --git a/ctor.cc b/ctor.cc index 7f936c6..6fe4084 100644 --- a/ctor.cc +++ b/ctor.cc @@ -5,12 +5,12 @@ namespace { -BuildConfigurations ctorConfigs(const Settings& settings) +ctor::BuildConfigurations ctorConfigs(const ctor::Settings& settings) { return { { - .type = TargetType::StaticLibrary, + .type = ctor::TargetType::StaticLibrary, .target = "libctor.a", .sources = { "src/build.cc", diff --git a/src/bootstrap.cc b/src/bootstrap.cc index d473689..3a73cc6 100644 --- a/src/bootstrap.cc +++ b/src/bootstrap.cc @@ -22,8 +22,9 @@ std::filesystem::path configurationFile("configuration.cc"); std::filesystem::path configHeaderFile("config.h"); -const Configuration default_configuration{}; -const Configuration& configuration() +namespace ctor { +const ctor::Configuration default_configuration{}; +const ctor::Configuration& configuration() { return default_configuration; } @@ -50,6 +51,7 @@ const std::string& getConfiguration(const std::string& key, return defaultValue; } +} // namespace ctor:: int main(int argc, char* argv[]) { @@ -60,9 +62,9 @@ int main(int argc, char* argv[]) return 1; } - Settings settings{}; + ctor::Settings settings{}; - settings.builddir = getConfiguration(cfg::builddir, settings.builddir); + settings.builddir = ctor::getConfiguration(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 5ea1a13..ab520d2 100644 --- a/src/build.cc +++ b/src/build.cc @@ -13,6 +13,8 @@ #include "ctor.h" +using namespace ctor; + using namespace std::chrono_literals; int build(const Settings& settings, diff --git a/src/build.h b/src/build.h index caf7a68..97bcfc6 100644 --- a/src/build.h +++ b/src/build.h @@ -10,23 +10,25 @@ #include "task.h" #include "tasks.h" +namespace ctor { struct Settings; +} // namespace ctor:: //! Dry-run returns number of dirty tasks but otherwise does nothing. -int build(const Settings& settings, +int build(const ctor::Settings& settings, const std::string& name, const std::set>& tasks, const std::set>& all_tasks, bool dryrun = false); //! Dry-run returns number of dirty tasks but otherwise does nothing. -int build(const Settings& settings, +int build(const ctor::Settings& settings, const std::string& name, const std::set>& all_tasks, bool dryrun = false); //! Dry-run returns number of dirty tasks but otherwise does nothing. -int build(const Settings& settings, +int build(const ctor::Settings& settings, const std::string& name, const std::vector& targets, const std::set>& all_tasks, diff --git a/src/configure.cc b/src/configure.cc index 25403f7..28049ae 100644 --- a/src/configure.cc +++ b/src/configure.cc @@ -16,25 +16,25 @@ #include "rebuild.h" #include "externals.h" +using namespace ctor; + std::filesystem::path configurationFile("configuration.cc"); std::filesystem::path configHeaderFile("config.h"); std::map external_includedir; std::map external_libdir; +namespace ctor { const Configuration default_configuration{}; const Configuration& __attribute__((weak)) configuration() { return default_configuration; } -namespace ctor -{ std::optional includedir; std::optional libdir; std::optional builddir; std::map conf_values; -} bool hasConfiguration(const std::string& key) { @@ -93,6 +93,7 @@ const std::string& getConfiguration(const std::string& key, return defaultValue; } +} // namespace ctor:: std::string locate(const std::string& arch, const std::string& app) { @@ -419,6 +420,7 @@ int regenerateCache(Settings& settings, { std::ofstream istr(configurationFile); istr << "#include \n\n"; + istr << "namespace ctor {\n"; istr << "const Configuration& configuration()\n"; istr << "{\n"; istr << " static Configuration cfg =\n"; @@ -528,7 +530,8 @@ int regenerateCache(Settings& settings, istr << " },\n"; istr << " };\n"; istr << " return cfg;\n"; - istr << "}\n\n"; + istr << "}\n"; + istr << "} // namespace ctor::\n\n"; } { diff --git a/src/configure.h b/src/configure.h index 16499d6..cc20707 100644 --- a/src/configure.h +++ b/src/configure.h @@ -8,10 +8,12 @@ #include #include +namespace ctor { struct Settings; +} // namespace ctor:: extern std::filesystem::path configurationFile;; extern std::filesystem::path configHeaderFile; -int configure(const Settings& settings, int argc, char* argv[]); -int reconfigure(const Settings& settings, int argc, char* argv[]); +int configure(const ctor::Settings& settings, int argc, char* argv[]); +int reconfigure(const ctor::Settings& settings, int argc, char* argv[]); diff --git a/src/ctor.h b/src/ctor.h index 96e1115..9770c09 100644 --- a/src/ctor.h +++ b/src/ctor.h @@ -11,6 +11,8 @@ #include #include +namespace ctor { + enum class TargetType { Auto, // Default - deduce from target name and sources extensions @@ -152,3 +154,5 @@ const Configuration& configuration(); bool hasConfiguration(const std::string& key); const std::string& getConfiguration(const std::string& key, const std::string& defaultValue = {}); + +} // namespace ctor:: diff --git a/src/externals_manual.cc b/src/externals_manual.cc index 3f00698..4c1c540 100644 --- a/src/externals_manual.cc +++ b/src/externals_manual.cc @@ -10,6 +10,8 @@ #include "util.h" #include "tools.h" +using namespace ctor; + extern std::map external_includedir; extern std::map external_libdir; diff --git a/src/externals_manual.h b/src/externals_manual.h index 7bd968d..422f279 100644 --- a/src/externals_manual.h +++ b/src/externals_manual.h @@ -3,10 +3,13 @@ // See accompanying file LICENSE for details. #pragma once +namespace ctor { struct Settings; struct ExternalConfiguration; struct ExternalManual; struct Flags; +} // namespace ctor:: -int resolv(const Settings& settings, const ExternalConfiguration& name, - const ExternalManual& ext, Flags& flags); +int resolv(const ctor::Settings& settings, + const ctor::ExternalConfiguration& name, + const ctor::ExternalManual& ext, ctor::Flags& flags); diff --git a/src/libctor.cc b/src/libctor.cc index 45fc94d..83002db 100644 --- a/src/libctor.cc +++ b/src/libctor.cc @@ -26,6 +26,8 @@ #include "build.h" #include "unittest.h" +using namespace ctor; + int main(int argc, char* argv[]) { Settings settings{}; diff --git a/src/rebuild.cc b/src/rebuild.cc index 7155984..c40a18c 100644 --- a/src/rebuild.cc +++ b/src/rebuild.cc @@ -17,9 +17,12 @@ #include "tools.h" #include "util.h" +using namespace ctor; + std::array configFiles; std::size_t numConfigFiles{0}; +namespace ctor { int reg(BuildConfigurations (*cb)(const Settings&), const std::source_location location) { @@ -47,6 +50,7 @@ int reg(BuildConfigurations (*cb)(const Settings&), return 0; } +} // namespace ctor:: int reg(const char* location) { @@ -109,6 +113,7 @@ int unreg(const char* location) std::array externalConfigFiles; std::size_t numExternalConfigFiles{0}; +namespace ctor { int reg(ExternalConfigurations (*cb)(const Settings&), const std::source_location location) { @@ -126,6 +131,7 @@ int reg(ExternalConfigurations (*cb)(const Settings&), return 0; } +} // namespace ctor:: namespace { diff --git a/src/rebuild.h b/src/rebuild.h index 284aeb2..6d0f6a8 100644 --- a/src/rebuild.h +++ b/src/rebuild.h @@ -11,13 +11,13 @@ struct BuildConfigurationEntry { const char* file; - BuildConfigurations (*cb)(const Settings&); + ctor::BuildConfigurations (*cb)(const ctor::Settings&); }; struct ExternalConfigurationEntry { const char* file; - ExternalConfigurations (*cb)(const Settings&); + ctor::ExternalConfigurations (*cb)(const ctor::Settings&); }; extern std::array configFiles; @@ -30,5 +30,5 @@ int reg(const char* location); int unreg(const char* location); //! Returns true of recompilation was needed. -bool recompileCheck(const Settings& settings, int argc, char* argv[], +bool recompileCheck(const ctor::Settings& settings, int argc, char* argv[], bool relaunch_allowed = true); diff --git a/src/task.cc b/src/task.cc index fb50765..5e3bbb8 100644 --- a/src/task.cc +++ b/src/task.cc @@ -6,6 +6,8 @@ #include #include +using namespace ctor; + Task::Task(const BuildConfiguration& config, const Settings& settings, const std::string& sourceDir) : config(config) diff --git a/src/task.h b/src/task.h index 4efbfff..b4f37a5 100644 --- a/src/task.h +++ b/src/task.h @@ -21,12 +21,10 @@ enum class State Error, }; -struct Settings; - class Task { public: - Task(const BuildConfiguration& config, const Settings& settings, + Task(const ctor::BuildConfiguration& config, const ctor::Settings& settings, const std::string& sourceDir); virtual ~Task() = default; @@ -59,11 +57,11 @@ public: //! Returns a reference to the originating build config. //! Note: the build config of a derived task will be that of its parent //! (target) task. - const BuildConfiguration& buildConfig() const; + const ctor::BuildConfiguration& buildConfig() const; - TargetType targetType() const; - Language sourceLanguage() const; - OutputSystem outputSystem() const; + ctor::TargetType targetType() const; + ctor::Language sourceLanguage() const; + ctor::OutputSystem outputSystem() const; std::string compiler() const; std::set> getDependsTasks(); @@ -77,10 +75,10 @@ protected: std::vector dependsStr; std::set> dependsTasks; - const BuildConfiguration& config; - TargetType target_type{TargetType::Auto}; - Language source_language{Language::Auto}; - OutputSystem output_system{OutputSystem::Host}; - const Settings& settings; + const ctor::BuildConfiguration& config; + ctor::TargetType target_type{ctor::TargetType::Auto}; + ctor::Language source_language{ctor::Language::Auto}; + ctor::OutputSystem output_system{ctor::OutputSystem::Host}; + const ctor::Settings& settings; std::string sourceDir; }; diff --git a/src/task_ar.cc b/src/task_ar.cc index 39a8c6d..024755f 100644 --- a/src/task_ar.cc +++ b/src/task_ar.cc @@ -10,6 +10,8 @@ #include "execute.h" #include "util.h" +using namespace ctor; + TaskAR::TaskAR(const BuildConfiguration& config, const Settings& settings, const std::string& target, diff --git a/src/task_ar.h b/src/task_ar.h index c76a852..9e8ca8b 100644 --- a/src/task_ar.h +++ b/src/task_ar.h @@ -10,15 +10,12 @@ #include #include -struct BuildConfiguration; -struct Settings; - class TaskAR : public Task { public: - TaskAR(const BuildConfiguration& config, - const Settings& settings, + TaskAR(const ctor::BuildConfiguration& config, + const ctor::Settings& settings, const std::string& target, const std::vector& objects, const std::string& sourceDir); @@ -44,7 +41,7 @@ private: std::filesystem::path _targetFile; std::filesystem::path flagsFile; - const BuildConfiguration& config; - const Settings& settings; + const ctor::BuildConfiguration& config; + const ctor::Settings& settings; std::string sourceDir; }; diff --git a/src/task_cc.cc b/src/task_cc.cc index 29aeefb..9ec3e01 100644 --- a/src/task_cc.cc +++ b/src/task_cc.cc @@ -12,6 +12,8 @@ #include "util.h" #include "tools.h" +using namespace ctor; + TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings, const std::string& sourceDir, const Source& source) : Task(config, settings, sourceDir) diff --git a/src/task_cc.h b/src/task_cc.h index 0a0d96a..cdde84b 100644 --- a/src/task_cc.h +++ b/src/task_cc.h @@ -10,16 +10,13 @@ #include #include -struct BuildConfiguration; -struct Settings; - class TaskCC : public Task { public: - TaskCC(const BuildConfiguration& config, - const Settings& settings, - const std::string& sourceDir, const Source& source); + TaskCC(const ctor::BuildConfiguration& config, + const ctor::Settings& settings, + const std::string& sourceDir, const ctor::Source& source); virtual ~TaskCC() = default; int registerDepTasksInner(const std::set>& tasks) override; @@ -51,8 +48,8 @@ protected: std::filesystem::path depsFile; std::filesystem::path flagsFile; - const BuildConfiguration& config; - const Settings& settings; + const ctor::BuildConfiguration& config; + const ctor::Settings& settings; std::filesystem::path sourceDir; - const Source& _source; + const ctor::Source& _source; }; diff --git a/src/task_fn.cc b/src/task_fn.cc index b8932de..f633704 100644 --- a/src/task_fn.cc +++ b/src/task_fn.cc @@ -11,6 +11,8 @@ #include "execute.h" #include "util.h" +using namespace ctor; + TaskFn::TaskFn(const BuildConfiguration& config, const Settings& settings, const std::string& sourceDir, const Source& source) : Task(config, settings, sourceDir) diff --git a/src/task_fn.h b/src/task_fn.h index e350395..654241c 100644 --- a/src/task_fn.h +++ b/src/task_fn.h @@ -10,16 +10,13 @@ #include #include -struct BuildConfiguration; -struct Settings; - class TaskFn : public Task { public: - TaskFn(const BuildConfiguration& config, - const Settings& settings, - const std::string& sourceDir, const Source& source); + TaskFn(const ctor::BuildConfiguration& config, + const ctor::Settings& settings, + const std::string& sourceDir, const ctor::Source& source); virtual ~TaskFn() = default; bool dirtyInner() override; @@ -41,7 +38,7 @@ protected: std::filesystem::path sourceFile; std::filesystem::path _targetFile; - const BuildConfiguration& config; - const Settings& settings; + const ctor::BuildConfiguration& config; + const ctor::Settings& settings; std::filesystem::path sourceDir; }; diff --git a/src/task_ld.cc b/src/task_ld.cc index 5c27d3f..acd733b 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -11,6 +11,8 @@ #include "util.h" #include "tools.h" +using namespace ctor; + TaskLD::TaskLD(const BuildConfiguration& config, const Settings& settings, const std::string& target, diff --git a/src/task_ld.h b/src/task_ld.h index 8625075..8667d65 100644 --- a/src/task_ld.h +++ b/src/task_ld.h @@ -10,15 +10,12 @@ #include #include -struct BuildConfiguration; -struct Settings; - class TaskLD : public Task { public: - TaskLD(const BuildConfiguration& config, - const Settings& settings, + TaskLD(const ctor::BuildConfiguration& config, + const ctor::Settings& settings, const std::string& target, const std::vector& objects, const std::string& _sourceDir); @@ -44,7 +41,7 @@ private: std::filesystem::path _targetFile; std::filesystem::path flagsFile; - const BuildConfiguration& config; - const Settings& settings; + const ctor::BuildConfiguration& config; + const ctor::Settings& settings; std::string sourceDir; }; diff --git a/src/task_so.cc b/src/task_so.cc index ed4bd18..fc5ef4a 100644 --- a/src/task_so.cc +++ b/src/task_so.cc @@ -11,6 +11,8 @@ #include "util.h" #include "tools.h" +using namespace ctor; + TaskSO::TaskSO(const BuildConfiguration& config, const Settings& settings, const std::string& target, diff --git a/src/task_so.h b/src/task_so.h index fe5d2fd..a751226 100644 --- a/src/task_so.h +++ b/src/task_so.h @@ -10,15 +10,12 @@ #include #include -struct BuildConfiguration; -struct Settings; - class TaskSO : public Task { public: - TaskSO(const BuildConfiguration& config, - const Settings& settings, + TaskSO(const ctor::BuildConfiguration& config, + const ctor::Settings& settings, const std::string& target, const std::vector& objects, const std::string& sourceDir); @@ -44,7 +41,7 @@ private: std::filesystem::path _targetFile; std::filesystem::path flagsFile; - const BuildConfiguration& config; - const Settings& settings; + const ctor::BuildConfiguration& config; + const ctor::Settings& settings; std::string sourceDir; }; diff --git a/src/tasks.cc b/src/tasks.cc index 12ff399..2d83349 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -19,6 +19,8 @@ #include "rebuild.h" #include "configure.h" +using namespace ctor; + const std::deque& getTargets(const Settings& settings, bool resolve_externals) { diff --git a/src/tasks.h b/src/tasks.h index 403a954..26cd757 100644 --- a/src/tasks.h +++ b/src/tasks.h @@ -10,17 +10,14 @@ #include "task.h" -struct BuildConfiguration; -struct Settings; - struct Target { - BuildConfiguration config; + ctor::BuildConfiguration config; std::string path; }; //! Get list of all registered targets -const std::deque& getTargets(const Settings& settings, +const std::deque& getTargets(const ctor::Settings& settings, bool resolve_externals = true); //! Returns next dirty task from the dirtyTasks list that has all its dependencies @@ -32,12 +29,12 @@ std::shared_ptr getNextTask(const std::set>& allTask //! Get list of tasks filtered by name including each of their direct //! dependency tasks (ie. objects tasks from their sources). -std::set> getTasks(const Settings& settings, +std::set> getTasks(const ctor::Settings& settings, const std::vector names = {}, bool resolve_externals = true); //! Generate list of targets from a single configuration, including the final //! link target and all its objects files (if any). -std::set> taskFactory(const BuildConfiguration& config, - const Settings& settings, +std::set> taskFactory(const ctor::BuildConfiguration& config, + const ctor::Settings& settings, const std::string& sourceDir); diff --git a/src/tools.cc b/src/tools.cc index 7e8ac78..f0b6d4e 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -8,6 +8,8 @@ #include +using namespace ctor; + ToolChain getToolChain(OutputSystem system) { std::string compiler; diff --git a/src/tools.h b/src/tools.h index c346cbf..0b5b211 100644 --- a/src/tools.h +++ b/src/tools.h @@ -37,7 +37,7 @@ enum class opt }; //! Get tool-chain type from output system (via configuration) -ToolChain getToolChain(OutputSystem system); +ToolChain getToolChain(ctor::OutputSystem system); //! Get tool argument(s) for specific option type matching the supplied //! tool-chain diff --git a/src/unittest.cc b/src/unittest.cc index 942be3e..cceaec7 100644 --- a/src/unittest.cc +++ b/src/unittest.cc @@ -8,6 +8,8 @@ #include "execute.h" #include "task.h" +using namespace ctor; + int runUnitTests(std::set>& tasks, const Settings& settings) { diff --git a/src/unittest.h b/src/unittest.h index 5118689..1ea90dd 100644 --- a/src/unittest.h +++ b/src/unittest.h @@ -7,7 +7,10 @@ #include class Task; + +namespace ctor { struct Settings; +} // namespace ctor:: int runUnitTests(std::set>& tasks, - const Settings& settings); + const ctor::Settings& settings); diff --git a/src/util.cc b/src/util.cc index 92560b6..47cb5c4 100644 --- a/src/util.cc +++ b/src/util.cc @@ -6,6 +6,8 @@ #include #include +using namespace ctor; + std::string readFile(const std::string& fileName) { std::ifstream ifs(fileName.c_str(), diff --git a/src/util.h b/src/util.h index 0cb01ce..1b41823 100644 --- a/src/util.h +++ b/src/util.h @@ -10,7 +10,7 @@ std::string readFile(const std::string& fileName); std::vector readDeps(const std::string& depFile); -Language languageFromExtension(const std::filesystem::path& file); +ctor::Language languageFromExtension(const std::filesystem::path& file); std::string cleanUp(const std::string& path); template diff --git a/test/ctor.cc b/test/ctor.cc index 89a94b9..1a63486 100644 --- a/test/ctor.cc +++ b/test/ctor.cc @@ -5,12 +5,12 @@ namespace { -BuildConfigurations ctorTestConfigs(const Settings& settings) +ctor::BuildConfigurations ctorTestConfigs(const ctor::Settings& settings) { return { { - .type = TargetType::UnitTest, + .type = ctor::TargetType::UnitTest, .target = "execute_test", .sources = { "execute_test.cc", @@ -27,7 +27,7 @@ BuildConfigurations ctorTestConfigs(const Settings& settings) }, }, { - .type = TargetType::UnitTest, + .type = ctor::TargetType::UnitTest, .target = "tasks_test", .sources = { "tasks_test.cc", @@ -44,7 +44,7 @@ BuildConfigurations ctorTestConfigs(const Settings& settings) }, }, { - .type = TargetType::UnitTest, + .type = ctor::TargetType::UnitTest, .target = "source_type_test", .sources = { "source_type_test.cc", @@ -61,7 +61,7 @@ BuildConfigurations ctorTestConfigs(const Settings& settings) }, }, { - .type = TargetType::UnitTest, + .type = ctor::TargetType::UnitTest, .target = "tools_test", .sources = { "tools_test.cc", @@ -78,7 +78,7 @@ BuildConfigurations ctorTestConfigs(const Settings& settings) }, }, { - .type = TargetType::UnitTestLib, + .type = ctor::TargetType::UnitTestLib, .target = "libctor_nomain.a", .sources = { "../src/build.cc", diff --git a/test/source_type_test.cc b/test/source_type_test.cc index ce1923e..e64aaee 100644 --- a/test/source_type_test.cc +++ b/test/source_type_test.cc @@ -1,37 +1,40 @@ -#include - #include #include -std::ostream& operator<<(std::ostream& stream, const Language& lang) +std::ostream& operator<<(std::ostream& stream, const ctor::Language& lang); + +#include + +std::ostream& operator<<(std::ostream& stream, const ctor::Language& lang) { switch(lang) { - case Language::Auto: + case ctor::Language::Auto: stream << "Language::Auto"; break; - case Language::C: + case ctor::Language::C: stream << "Language::C"; break; - case Language::Cpp: + case ctor::Language::Cpp: stream << "Language::Cpp"; break; - case Language::Asm: + case ctor::Language::Asm: stream << "Language::Asm"; break; } return stream; } + class TestableTaskCC : public TaskCC { public: - TestableTaskCC(const Source& source) + TestableTaskCC(const ctor::Source& source) : TaskCC({}, {}, "build", source) {} - Language language() const + ctor::Language language() const { return source_language; } @@ -50,22 +53,22 @@ public: { { // c++ TestableTaskCC task("hello.cc"); - uASSERT_EQUAL(Language::Cpp, task.language()); + uASSERT_EQUAL(ctor::Language::Cpp, task.language()); } { // c TestableTaskCC task("hello.c"); - uASSERT_EQUAL(Language::C, task.language()); + uASSERT_EQUAL(ctor::Language::C, task.language()); } { // asm TestableTaskCC task("hello.s"); - uASSERT_EQUAL(Language::Asm, task.language()); + uASSERT_EQUAL(ctor::Language::Asm, task.language()); } { // custom/explicit language - TestableTaskCC task( {"hello.foo", Language::Asm} ); - uASSERT_EQUAL(Language::Asm, task.language()); + TestableTaskCC task( {"hello.foo", ctor::Language::Asm} ); + uASSERT_EQUAL(ctor::Language::Asm, task.language()); } // Note: Failure state will result in exit(1) so cannot be tested diff --git a/test/tasks_test.cc b/test/tasks_test.cc index a660994..594261d 100644 --- a/test/tasks_test.cc +++ b/test/tasks_test.cc @@ -3,6 +3,8 @@ #include #include +using namespace ctor; + namespace { BuildConfigurations ctorTestConfigs1(const Settings&) diff --git a/test/tools_test.cc b/test/tools_test.cc index 743edb6..0f97bd3 100644 --- a/test/tools_test.cc +++ b/test/tools_test.cc @@ -11,6 +11,7 @@ std::ostream& operator<<(std::ostream& stream, const std::vector& v #include +using namespace ctor; using namespace std::string_literals; std::ostream& operator<<(std::ostream& stream, const ToolChain& tool_chain) @@ -85,6 +86,8 @@ namespace std::string conf_host_cxx{}; std::string conf_build_cxx{}; } + +namespace ctor { const std::string& getConfiguration(const std::string& key, const std::string& defval) { @@ -103,6 +106,7 @@ const std::string& getConfiguration(const std::string& key, static std::string res{}; return res; } +} // namespace ctor:: class ToolsTest : public uUnit -- cgit v1.2.3