From 5e4e3ed6a92f699a364dc069b4367e6c72623f18 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 19 Apr 2018 14:11:59 +0200 Subject: [PATCH] Convert xbt_cfg_is_default_value -> simgrid::config::is_default. --- include/xbt/config.h | 3 ++- include/xbt/config.hpp | 2 ++ src/simix/smx_context.cpp | 4 ++-- src/smpi/internals/smpi_global.cpp | 2 +- src/surf/cpu_cas01.cpp | 2 +- src/surf/network_cm02.cpp | 2 +- src/surf/sg_platf.cpp | 4 ++-- src/surf/xml/surfxml_sax_cb.cpp | 2 +- src/xbt/config.cpp | 5 +++++ 9 files changed, 17 insertions(+), 9 deletions(-) diff --git a/include/xbt/config.h b/include/xbt/config.h index 03fcda0bfd..7cd6b613e9 100644 --- a/include/xbt/config.h +++ b/include/xbt/config.h @@ -94,7 +94,8 @@ XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::set_default void xbt_cfg_setdefault_string(const char* name, const char* val); /** @brief Return if configuration is set by default*/ -XBT_PUBLIC int xbt_cfg_is_default_value(const char* name); +XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::is_default") XBT_PUBLIC + int xbt_cfg_is_default_value(const char* name); /* @} */ diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index 202bb4ab17..c9fe8653ab 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -52,6 +52,8 @@ extern template XBT_PUBLIC void set_default(const char* name, double val extern template XBT_PUBLIC void set_default(const char* name, bool value); extern template XBT_PUBLIC void set_default(const char* name, std::string value); +XBT_PUBLIC bool is_default(const char* name); + // Set config template XBT_PUBLIC void set_value(const char* name, T value); diff --git a/src/simix/smx_context.cpp b/src/simix/smx_context.cpp index e5d27c3775..55bb5e8970 100644 --- a/src/simix/smx_context.cpp +++ b/src/simix/smx_context.cpp @@ -97,8 +97,8 @@ void SIMIX_context_mod_init() { xbt_assert(simix_global->context_factory == nullptr); - smx_context_stack_size_was_set = not xbt_cfg_is_default_value("contexts/stack-size"); - smx_context_guard_size_was_set = not xbt_cfg_is_default_value("contexts/guard-size"); + smx_context_stack_size_was_set = not simgrid::config::is_default("contexts/stack-size"); + smx_context_guard_size_was_set = not simgrid::config::is_default("contexts/guard-size"); #if HAVE_THREAD_CONTEXTS && not HAVE_THREAD_LOCAL_STORAGE /* the __thread storage class is not available on this platform: diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 902237b487..21f8e09b11 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -221,7 +221,7 @@ static void smpi_check_options() xbt_assert(simgrid::config::get_value("smpi/async-small-thresh") <= simgrid::config::get_value("smpi/send-is-detached-thresh")); - if (xbt_cfg_is_default_value("smpi/host-speed")) { + if (simgrid::config::is_default("smpi/host-speed")) { XBT_INFO("You did not set the power of the host running the simulation. " "The timings will certainly not be accurate. " "Use the option \"--cfg=smpi/host-speed:\" to set its value." diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 315520c4ae..cc47188652 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -63,7 +63,7 @@ CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : simgrid bool select = simgrid::config::get_value("cpu/maxmin-selective-update"); if (algo == Model::UpdateAlgo::Lazy) { - xbt_assert(select || xbt_cfg_is_default_value("cpu/maxmin-selective-update"), + xbt_assert(select || simgrid::config::is_default("cpu/maxmin-selective-update"), "You cannot disable cpu selective update when using the lazy update mechanism"); select = true; } diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index b40a6b985c..d041c580c0 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -139,7 +139,7 @@ NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(b bool select = simgrid::config::get_value("network/maxmin-selective-update"); if (optim == "Lazy") { - xbt_assert(select || xbt_cfg_is_default_value("network/maxmin-selective-update"), + xbt_assert(select || simgrid::config::is_default("network/maxmin-selective-update"), "You cannot disable network selective update when using the lazy update mechanism"); select = true; } diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index a6fcca8d06..3f290e77be 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -506,8 +506,8 @@ static void surf_config_models_setup() std::string storage_model_name = simgrid::config::get_value("storage/model"); /* The compound host model is needed when using non-default net/cpu models */ - if ((not xbt_cfg_is_default_value("network/model") || not xbt_cfg_is_default_value("cpu/model")) && - xbt_cfg_is_default_value("host/model")) { + if ((not simgrid::config::is_default("network/model") || not simgrid::config::is_default("cpu/model")) && + simgrid::config::is_default("host/model")) { host_model_name = "compound"; simgrid::config::set_value("host/model", host_model_name); } diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 2b692e93d3..ea98c47721 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -865,7 +865,7 @@ void STag_surfxml_config() void ETag_surfxml_config() { for (auto const& elm : *current_property_set) { - if (xbt_cfg_is_default_value(elm.first.c_str())) { + if (simgrid::config::is_default(elm.first.c_str())) { std::string cfg = elm.first + ":" + elm.second; xbt_cfg_set_parse(cfg.c_str()); } else diff --git a/src/xbt/config.cpp b/src/xbt/config.cpp index 3f5be9aabe..62d44ecd9d 100644 --- a/src/xbt/config.cpp +++ b/src/xbt/config.cpp @@ -378,6 +378,11 @@ template XBT_PUBLIC void set_default(const char* name, double value); template XBT_PUBLIC void set_default(const char* name, bool value); template XBT_PUBLIC void set_default(const char* name, std::string value); +bool is_default(const char* name) +{ + return (*simgrid_config)[name].is_default(); +} + // ***** set_value ***** template XBT_PUBLIC void set_value(const char* name, T value) -- 2.20.1