From 10a511d29ca51a4b38bc9df85eb4f9554e7a0ec1 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 30 Sep 2013 00:42:27 +0200 Subject: [PATCH] bughunt: build testcase statically linked ...but still dynamically linking against the core lib But the actual template instantiations happen now within the two compilation units, which are linked statically. When looking into the symbol table, we can see that the static field is emitted two times readelf -W target/clang-static-init -s | c++filt |less --- research/SConscript | 2 ++ research/clang-static-init-1.cpp | 40 +++++++++++++------------------- research/clang-static-init-2.cpp | 5 ++-- research/clang-static-init.hpp | 4 +--- 4 files changed, 21 insertions(+), 30 deletions(-) diff --git a/research/SConscript b/research/SConscript index cde733bf9..282a4b1e4 100644 --- a/research/SConscript +++ b/research/SConscript @@ -9,10 +9,12 @@ Import('env core support_lib') envR = env.Clone() +envR.Append(CPPPATH='research') # envR.Append(CCFLAGS=' -O3 ') # build additional test and administrative tools.... experiments = [ envR.Program('try', ['try.cpp'] + support_lib) #### to try out some feature... + , envR.Program('clang-static-init', ['clang-static-init-1.cpp', 'clang-static-init-2.cpp'] + core) ] # diff --git a/research/clang-static-init-1.cpp b/research/clang-static-init-1.cpp index c4869fd65..8b8cbcb7e 100644 --- a/research/clang-static-init-1.cpp +++ b/research/clang-static-init-1.cpp @@ -1,7 +1,7 @@ #include "lib/test/run.hpp" -#include "proc/hh.hpp" #include "proc/config-resolver.hpp" +#include "clang-static-init.hpp" #include @@ -12,27 +12,19 @@ using std::cout; using std::endl; -namespace proc { -namespace test { +int +main (int, char**) + { + cout << "\n.gulp.\n"; + + ConfigResolver& ref1 = ConfigResolver::instance(); + + ConfigResolver& sub2 = test::fabricate(); + + cout << "sub1="<< &ref1 << " sub2="<< &sub2 <<"\n"; + + + return 0; + } + - class StaticInstance_test : public Test - { - virtual void - run (Arg) - { - ConfigResolver& ref1 = ConfigResolver::instance(); - - ConfigResolver& sub2 = fabricate(); - - cout << "sub1="<< &ref1 << " sub2="<< &sub2 <<"\n"; - - } - - }; - - /** Register this test class... */ - LAUNCHER (StaticInstance_test, "unit bug"); - - - -}} // namespace proc::test diff --git a/research/clang-static-init-2.cpp b/research/clang-static-init-2.cpp index ea107ee96..2bf169019 100644 --- a/research/clang-static-init-2.cpp +++ b/research/clang-static-init-2.cpp @@ -1,5 +1,5 @@ -#include "proc/hh.hpp" +#include "clang-static-init.hpp" #include @@ -8,7 +8,6 @@ using std::cout; using std::endl; -namespace proc { namespace test { @@ -33,4 +32,4 @@ namespace test { } -}} // namespace proc::test +} // namespace test diff --git a/research/clang-static-init.hpp b/research/clang-static-init.hpp index c27e5ddf7..65d0a6ef7 100644 --- a/research/clang-static-init.hpp +++ b/research/clang-static-init.hpp @@ -3,7 +3,6 @@ #include "proc/config-resolver.hpp" -namespace proc { namespace test { template @@ -40,5 +39,4 @@ namespace test { -}} // namespace proc::test - +} // namespace test