From 524de5f4ae0694f650b58ce80c901db748c9fe93 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Thu, 27 Jul 2017 14:53:46 +0200 Subject: [PATCH] cosmetics --- include/xbt/config.h | 2 +- src/kernel/EngineImpl.hpp | 2 -- src/kernel/context/Context.hpp | 2 -- src/kernel/routing/RoutedZone.cpp | 1 - src/surf/trace_mgr.cpp | 1 - src/xbt/config.cpp | 49 +++++++++++-------------------- 6 files changed, 18 insertions(+), 39 deletions(-) diff --git a/include/xbt/config.h b/include/xbt/config.h index 1131871c98..a6246df424 100644 --- a/include/xbt/config.h +++ b/include/xbt/config.h @@ -10,7 +10,7 @@ #define XBT_CONFIG_H #include -#include +#include /** @addtogroup XBT_config * @brief Changing the configuration of SimGrid components (grounding feature) diff --git a/src/kernel/EngineImpl.hpp b/src/kernel/EngineImpl.hpp index c25063d629..d8f96c2acd 100644 --- a/src/kernel/EngineImpl.hpp +++ b/src/kernel/EngineImpl.hpp @@ -4,8 +4,6 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include -#include - #include #include diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index e45c097e71..97614a9d97 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -24,10 +24,8 @@ #include "surf/surf.h" #include "xbt/base.h" #include "xbt/config.h" -#include "xbt/dict.h" #include "xbt/function_types.h" #include "xbt/mallocator.h" -#include "xbt/swag.h" #include "xbt/xbt_os_time.h" #include "src/simix/ActorImpl.hpp" diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index 35f44d8955..2647781a29 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -4,7 +4,6 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "xbt/dict.h" -#include "xbt/dynar.h" #include "xbt/graph.h" #include "xbt/log.h" #include "xbt/sysdep.h" diff --git a/src/surf/trace_mgr.cpp b/src/surf/trace_mgr.cpp index 16eb4f8abf..f100e2e1a0 100644 --- a/src/surf/trace_mgr.cpp +++ b/src/surf/trace_mgr.cpp @@ -5,7 +5,6 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "xbt/sysdep.h" -#include "xbt/dict.h" #include "xbt/log.h" #include "xbt/str.h" diff --git a/src/xbt/config.cpp b/src/xbt/config.cpp index 977bad1502..f451949b43 100644 --- a/src/xbt/config.cpp +++ b/src/xbt/config.cpp @@ -141,7 +141,6 @@ protected: bool isdefault = true; public: - /* Callback */ xbt_cfg_cb_t old_callback = nullptr; @@ -190,16 +189,13 @@ public: TypedConfigurationElement(const char* key, const char* desc, T value = T()) : ConfigurationElement(key, desc), content(std::move(value)) {} - TypedConfigurationElement(const char* key, const char* desc, T value, - xbt_cfg_cb_t cb) - : ConfigurationElement(key, desc, cb), content(std::move(value)) + TypedConfigurationElement(const char* key, const char* desc, T value, xbt_cfg_cb_t cb) + : ConfigurationElement(key, desc, cb), content(std::move(value)) {} - TypedConfigurationElement(const char* key, const char* desc, T value, - std::function callback) - : ConfigurationElement(key, desc), content(std::move(value)), - callback(std::move(callback)) + TypedConfigurationElement(const char* key, const char* desc, T value, std::function callback) + : ConfigurationElement(key, desc), content(std::move(value)), callback(std::move(callback)) {} - ~TypedConfigurationElement()=default; + ~TypedConfigurationElement() = default; std::string getStringValue() override; const char* getTypeName() override; @@ -227,8 +223,8 @@ public: this->content = std::move(value); this->update(); } else { - XBT_DEBUG("Do not override configuration variable '%s' with value '%s'" - " because it was already set.", key.c_str(), to_string(value).c_str()); + XBT_DEBUG("Do not override configuration variable '%s' with value '%s' because it was already set.", key.c_str(), + to_string(value).c_str()); } } }; @@ -567,8 +563,7 @@ on_exception: } // Horrible mess to translate C++ exceptions to C exceptions: -// Exit from the catch blog (and do the correct exceptio cleaning) -// before attempting to THROWF. +// Exit from the catch block (and do the correct exception cleaning) before attempting to THROWF. #define TRANSLATE_EXCEPTIONS(...) \ catch(simgrid::config::missing_key_error& e) { THROWF(not_found_error, 0, __VA_ARGS__); abort(); } \ catch(...) { THROWF(not_found_error, 0, __VA_ARGS__); abort(); } @@ -599,8 +594,7 @@ void xbt_cfg_setdefault_int(const char *key, int value) (*simgrid_config)[key].setDefaultValue(value); return; } - TRANSLATE_EXCEPTIONS("Could not set variable %s to default integer %i", - key, value); + TRANSLATE_EXCEPTIONS("Could not set variable %s to default integer %i", key, value); } /** @brief Set an integer value to \a name within \a cfg if it wasn't changed yet @@ -614,8 +608,7 @@ void xbt_cfg_setdefault_double(const char *key, double value) (*simgrid_config)[key].setDefaultValue(value); return; } - TRANSLATE_EXCEPTIONS("Could not set variable %s to default double %f", - key, value); + TRANSLATE_EXCEPTIONS("Could not set variable %s to default double %f", key, value); } /** @brief Set a string value to \a name within \a cfg if it wasn't changed yet @@ -629,8 +622,7 @@ void xbt_cfg_setdefault_string(const char *key, const char *value) (*simgrid_config)[key].setDefaultValue(value ? value : ""); return; } - TRANSLATE_EXCEPTIONS("Could not set variable %s to default string %s", - key, value); + TRANSLATE_EXCEPTIONS("Could not set variable %s to default string %s", key, value); } /** @brief Set an boolean value to \a name within \a cfg if it wasn't changed yet @@ -644,8 +636,7 @@ void xbt_cfg_setdefault_boolean(const char *key, const char *value) (*simgrid_config)[key].setDefaultValue(simgrid::config::parseBool(value)); return; } - TRANSLATE_EXCEPTIONS("Could not set variable %s to default boolean %s", - key, value); + TRANSLATE_EXCEPTIONS("Could not set variable %s to default boolean %s", key, value); } /** @brief Set an integer value to \a name within \a cfg @@ -659,8 +650,7 @@ void xbt_cfg_set_int(const char *key, int value) (*simgrid_config)[key].setValue(value); return; } - TRANSLATE_EXCEPTIONS("Could not set variable %s to integer %i", - key, value); + TRANSLATE_EXCEPTIONS("Could not set variable %s to integer %i", key, value); } /** @brief Set or add a double value to \a name within \a cfg @@ -674,8 +664,7 @@ void xbt_cfg_set_double(const char *key, double value) (*simgrid_config)[key].setValue(value); return; } - TRANSLATE_EXCEPTIONS("Could not set variable %s to double %f", - key, value); + TRANSLATE_EXCEPTIONS("Could not set variable %s to double %f", key, value); } /** @brief Set or add a string value to \a name within \a cfg @@ -690,8 +679,7 @@ void xbt_cfg_set_string(const char *key, const char *value) (*simgrid_config)[key].setValue(value ? value : ""); return; } - TRANSLATE_EXCEPTIONS("Could not set variable %s to string %s", - key, value); + TRANSLATE_EXCEPTIONS("Could not set variable %s to string %s", key, value); } /** @brief Set or add a boolean value to \a name within \a cfg @@ -705,8 +693,7 @@ void xbt_cfg_set_boolean(const char *key, const char *value) (*simgrid_config)[key].setValue(simgrid::config::parseBool(value)); return; } - TRANSLATE_EXCEPTIONS("Could not set variable %s to boolean %s", - key, value); + TRANSLATE_EXCEPTIONS("Could not set variable %s to boolean %s", key, value); } @@ -823,10 +810,8 @@ XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests") xbt_test_add("Get a single value"); { /* get_single_value */ - int ival; - xbt_cfg_set_parse("peername:toto:42 speed:42"); - ival = xbt_cfg_get_int("speed"); + int ival = xbt_cfg_get_int("speed"); if (ival != 42) xbt_test_fail("Speed value = %d, I expected 42", ival); } -- 2.20.1