From 627843d2517a5cc8885939d6396fb052cd873aa7 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 7 Feb 2026 22:27:05 +0100 Subject: Use REG function for configuration, like with build_configurations, to get rid of the hacky weak symbol method. --- test/ctor.cc | 7 ++++--- test/source_type_test.cc | 3 ++- test/tasks_test.cc | 4 ++-- test/tools_test.cc | 23 ----------------------- 4 files changed, 8 insertions(+), 29 deletions(-) (limited to 'test') diff --git a/test/ctor.cc b/test/ctor.cc index afec91c..d1c0188 100644 --- a/test/ctor.cc +++ b/test/ctor.cc @@ -31,6 +31,7 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) ctor::sources{ "generated_sources_test.cc", "testmain.cc", + "../configuration.cc", }, ctor::depends({"libctor_nomain.a"}), ctor::cxx_flags{ @@ -146,6 +147,7 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) ctor::sources{ "cycle_test.cc", "testmain.cc", + "../configuration.cc", }, ctor::depends({"libctor_nomain.a"}), ctor::cxx_flags{ @@ -163,6 +165,7 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) ctor::sources{ "source_type_test.cc", "testmain.cc", + "../configuration.cc", }, ctor::depends({"libctor_nomain.a"}), ctor::cxx_flags{ @@ -180,8 +183,7 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) ctor::sources{ "tools_test.cc", "testmain.cc", - "../src/util.cc", - "../src/tools.cc", + "../configuration.cc", }, ctor::depends({"libctor_nomain.a"}), ctor::cxx_flags{ @@ -212,7 +214,6 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) "../src/tools.cc", "../src/util.cc", "../src/externals_manual.cc", - "../configuration.cc", }, ctor::cxx_flags{ "-std=c++20", "-O3", "-Wall", diff --git a/test/source_type_test.cc b/test/source_type_test.cc index 90e77cf..345c591 100644 --- a/test/source_type_test.cc +++ b/test/source_type_test.cc @@ -26,13 +26,14 @@ std::ostream& operator<<(std::ostream& stream, const ctor::language& lang) return stream; } -const ctor::configuration& ctor::get_configuration() +const ctor::configuration& test_configuration() { static ctor::configuration cfg{}; cfg.build_toolchain = ctor::toolchain::gcc; cfg.build_arch = ctor::arch::unix; return cfg; } +REG(test_configuration); class TestableTaskCC : public TaskCC diff --git a/test/tasks_test.cc b/test/tasks_test.cc index 32bed5a..c8e4cf8 100644 --- a/test/tasks_test.cc +++ b/test/tasks_test.cc @@ -38,14 +38,14 @@ namespace test_global { ctor::toolchain toolchain{}; ctor::arch arch{}; } -const ctor::configuration& ctor::get_configuration() +const ctor::configuration& test_configuration() { static ctor::configuration cfg{}; cfg.build_toolchain = test_global::toolchain; cfg.build_arch = test_global::arch; return cfg; } - +REG(test_configuration); REG(ctorTestConfigs1); REG(ctorTestConfigs2); diff --git a/test/tools_test.cc b/test/tools_test.cc index 5ae04c3..cfbcbce 100644 --- a/test/tools_test.cc +++ b/test/tools_test.cc @@ -114,29 +114,6 @@ bool operator!=(const ctor::asm_flag& a, const ctor::asm_flag& b) #include -const ctor::configuration& ctor::get_configuration() -{ - static ctor::configuration cfg; - return cfg; -} - -std::string ctor::configuration::get(const std::string& key, [[maybe_unused]]const std::string& default_value) const -{ - if(key == ctor::cfg::host_cxx) - { - return {}; - } - - if(key == ctor::cfg::build_cxx) - { - return {}; - } - - assert(false); // bad key - - return {}; -} - class ToolsTest : public uUnit { -- cgit v1.2.3