From 63225b9520042ef129adb975132fe68ec5710988 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 17 Sep 2019 10:23:17 +0200 Subject: [PATCH] Explicit instanciation of xbt::Extendable<> specializations. Fixes Asan warnings about odr-violations (default with current gcc-10, or with ASAN_OPTIONS='use_odr_indicator=true detect_odr_violation=2'). It may also complete commit f2e9bf81aebf9a0d39563c3f955fc24e9270d74f "Explicit instanciation of Extendable". --- include/simgrid/kernel/routing/NetPoint.hpp | 3 +++ include/simgrid/plugins/file_system.h | 3 +++ include/simgrid/s4u/Actor.hpp | 3 +++ include/simgrid/s4u/Disk.hpp | 3 +++ include/simgrid/s4u/Host.hpp | 4 +--- include/simgrid/s4u/Link.hpp | 3 +++ include/simgrid/s4u/Storage.hpp | 3 +++ src/kernel/routing/NetPoint.cpp | 3 +++ src/msg/msg_private.hpp | 3 +++ src/msg/msg_task.cpp | 3 +++ src/plugins/file_system/s4u_FileSystem.cpp | 3 +++ src/plugins/vm/VirtualMachineImpl.cpp | 3 +++ src/plugins/vm/VirtualMachineImpl.hpp | 3 +++ src/s4u/s4u_Actor.cpp | 3 +++ src/s4u/s4u_Disk.cpp | 5 ++--- src/s4u/s4u_Host.cpp | 5 ++--- src/s4u/s4u_Link.cpp | 3 +++ src/s4u/s4u_Storage.cpp | 5 ++--- 18 files changed, 49 insertions(+), 12 deletions(-) diff --git a/include/simgrid/kernel/routing/NetPoint.hpp b/include/simgrid/kernel/routing/NetPoint.hpp index 0ea15d1d01..bddc55681f 100644 --- a/include/simgrid/kernel/routing/NetPoint.hpp +++ b/include/simgrid/kernel/routing/NetPoint.hpp @@ -13,6 +13,9 @@ #include namespace simgrid { + +extern template class XBT_PUBLIC xbt::Extendable; + namespace kernel { namespace routing { diff --git a/include/simgrid/plugins/file_system.h b/include/simgrid/plugins/file_system.h index 6384260bb0..d180a9a561 100644 --- a/include/simgrid/plugins/file_system.h +++ b/include/simgrid/plugins/file_system.h @@ -85,6 +85,9 @@ SG_END_DECL #ifdef __cplusplus namespace simgrid { + +extern template class XBT_PUBLIC xbt::Extendable; + namespace s4u { /** @brief A simulated file diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index 84d61a9eab..4f27167097 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -19,6 +19,9 @@ #include namespace simgrid { + +extern template class XBT_PUBLIC xbt::Extendable; + namespace s4u { /** An actor is an independent stream of execution in your distributed application. diff --git a/include/simgrid/s4u/Disk.hpp b/include/simgrid/s4u/Disk.hpp index ed1db6a5bb..11651d3597 100644 --- a/include/simgrid/s4u/Disk.hpp +++ b/include/simgrid/s4u/Disk.hpp @@ -17,6 +17,9 @@ #include namespace simgrid { + +extern template class XBT_PUBLIC xbt::Extendable; + namespace s4u { /** Disk represent the disk resources associated to a host diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index 5f29122a15..4870a86239 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -16,9 +16,7 @@ namespace simgrid { -namespace xbt { -extern template class XBT_PUBLIC Extendable; -} // namespace xbt +extern template class XBT_PUBLIC xbt::Extendable; namespace s4u { /** @ingroup s4u_api diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index 7fc72cca1b..c2e64533ae 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -20,6 +20,9 @@ ***********/ namespace simgrid { + +extern template class XBT_PUBLIC xbt::Extendable; + namespace s4u { /** @brief A Link represents the network facilities between [hosts](@ref simgrid::s4u::Host) */ class XBT_PUBLIC Link : public xbt::Extendable { diff --git a/include/simgrid/s4u/Storage.hpp b/include/simgrid/s4u/Storage.hpp index ddf443bbbb..3247dff7f3 100644 --- a/include/simgrid/s4u/Storage.hpp +++ b/include/simgrid/s4u/Storage.hpp @@ -17,6 +17,9 @@ #include namespace simgrid { + +extern template class XBT_PUBLIC xbt::Extendable; + namespace s4u { /** Storage represent the disk resources, usually associated to a given host diff --git a/src/kernel/routing/NetPoint.cpp b/src/kernel/routing/NetPoint.cpp index 3dea8499f8..6ff888d333 100644 --- a/src/kernel/routing/NetPoint.cpp +++ b/src/kernel/routing/NetPoint.cpp @@ -10,6 +10,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf"); namespace simgrid { + +template class xbt::Extendable; + namespace kernel { namespace routing { diff --git a/src/msg/msg_private.hpp b/src/msg/msg_private.hpp index dcce872a7a..b6ad1119aa 100644 --- a/src/msg/msg_private.hpp +++ b/src/msg/msg_private.hpp @@ -16,6 +16,9 @@ /**************** datatypes **********************************/ namespace simgrid { + +extern template class XBT_PUBLIC xbt::Extendable; + namespace msg { class Task : public xbt::Extendable { std::string name_ = ""; diff --git a/src/msg/msg_task.cpp b/src/msg/msg_task.cpp index 4757400c92..8c75966d51 100644 --- a/src/msg/msg_task.cpp +++ b/src/msg/msg_task.cpp @@ -16,6 +16,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_task, msg, "Logging specific to MSG (task)"); namespace simgrid { + +template class xbt::Extendable; + namespace msg { Task::Task(const std::string& name, double flops_amount, double bytes_amount, void* data) diff --git a/src/plugins/file_system/s4u_FileSystem.cpp b/src/plugins/file_system/s4u_FileSystem.cpp index bce513bc9e..350382aae1 100644 --- a/src/plugins/file_system/s4u_FileSystem.cpp +++ b/src/plugins/file_system/s4u_FileSystem.cpp @@ -27,6 +27,9 @@ int sg_storage_max_file_descriptors = 1024; */ namespace simgrid { + +template class xbt::Extendable; + namespace s4u { simgrid::xbt::Extension FileSystemDiskExt::EXTENSION_ID; simgrid::xbt::Extension FileSystemStorageExt::EXTENSION_ID; diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index 581d3f9aed..03e42035ce 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -20,6 +20,9 @@ void surf_vm_model_init_HL13() } namespace simgrid { + +template class xbt::Extendable; + namespace vm { /************* * Callbacks * diff --git a/src/plugins/vm/VirtualMachineImpl.hpp b/src/plugins/vm/VirtualMachineImpl.hpp index d26383456c..bb1807e912 100644 --- a/src/plugins/vm/VirtualMachineImpl.hpp +++ b/src/plugins/vm/VirtualMachineImpl.hpp @@ -14,6 +14,9 @@ #define VM_INTERFACE_HPP_ namespace simgrid { + +extern template class XBT_PUBLIC xbt::Extendable; + namespace vm { /************ diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index a23ed083b6..5b711b5f11 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -21,6 +21,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_actor, s4u, "S4U actors"); namespace simgrid { + +template class xbt::Extendable; + namespace s4u { xbt::signal s4u::Actor::on_creation; diff --git a/src/s4u/s4u_Disk.cpp b/src/s4u/s4u_Disk.cpp index d8ad90429a..684cbab8be 100644 --- a/src/s4u/s4u_Disk.cpp +++ b/src/s4u/s4u_Disk.cpp @@ -10,9 +10,8 @@ #include "src/kernel/resource/DiskImpl.hpp" namespace simgrid { -namespace xbt { -template class Extendable; -} // namespace xbt + +template class xbt::Extendable; namespace s4u { diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index a88ada154f..858750bc81 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -18,9 +18,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_host, s4u, "Logging specific to the S4U host XBT_LOG_EXTERNAL_CATEGORY(surf_route); namespace simgrid { -namespace xbt { -template class Extendable; -} // namespace xbt + +template class xbt::Extendable; namespace s4u { diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index 9ead7c2485..4942e65ee6 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -14,6 +14,9 @@ #include "xbt/log.h" namespace simgrid { + +template class xbt::Extendable; + namespace s4u { xbt::signal Link::on_creation; diff --git a/src/s4u/s4u_Storage.cpp b/src/s4u/s4u_Storage.cpp index 6ecf463296..b051b69f31 100644 --- a/src/s4u/s4u_Storage.cpp +++ b/src/s4u/s4u_Storage.cpp @@ -11,9 +11,8 @@ #include "src/surf/StorageImpl.hpp" namespace simgrid { -namespace xbt { -template class Extendable; -} // namespace xbt + +template class xbt::Extendable; namespace s4u { -- 2.20.1