From 494abb77daa472be264899fea23876ed28a6be63 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Mon, 30 May 2016 15:46:51 +0200 Subject: [PATCH] Set the levels to -1 by default This should help us detect uninitalized levels. --- src/bindings/java/jmsg.cpp | 4 ++-- src/s4u/s4u_host.cpp | 6 +++--- src/surf/sg_platf.cpp | 4 ++-- src/surf/storage_interface.cpp | 8 ++++---- src/surf/surf_routing.cpp | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index 56b47a420a..eeb39838df 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -32,8 +32,8 @@ SG_BEGIN_DECL() -int JAVA_HOST_LEVEL; -int JAVA_STORAGE_LEVEL; +int JAVA_HOST_LEVEL = -1; +int JAVA_STORAGE_LEVEL = -1; XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg); diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 5020d7dc8b..8c70f80b5f 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -20,9 +20,9 @@ #include "simgrid/s4u/host.hpp" #include "simgrid/s4u/storage.hpp" -int MSG_HOST_LEVEL; -int SIMIX_HOST_LEVEL; -int USER_HOST_LEVEL; +int MSG_HOST_LEVEL = -1; +int SIMIX_HOST_LEVEL = -1; +int USER_HOST_LEVEL = -1; namespace simgrid { diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 43f06efb85..a93e51fe34 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -181,9 +181,9 @@ void sg_platf_new_router(sg_platf_router_cbarg_t router) xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL), "Refusing to create a router named '%s': this name already describes a node.", router->id); - simgrid::surf::NetCard *netcard = + simgrid::surf::NetCard* netcard = new simgrid::surf::NetCardImpl(router->id, simgrid::surf::NetCard::Type::Router, current_routing); - xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, (void *) netcard); + xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, netcard); XBT_DEBUG("Having set name '%s' id '%d'", router->id, netcard->id()); if (router->coord && strcmp(router->coord, "")) { diff --git a/src/surf/storage_interface.cpp b/src/surf/storage_interface.cpp index c674ff92bc..88860dc55a 100644 --- a/src/surf/storage_interface.cpp +++ b/src/surf/storage_interface.cpp @@ -13,11 +13,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf, xbt_lib_t file_lib; xbt_lib_t storage_lib; -int ROUTING_STORAGE_LEVEL; //Routing for storagelevel -int ROUTING_STORAGE_HOST_LEVEL; -int SURF_STORAGE_LEVEL; +int ROUTING_STORAGE_LEVEL = -1; //Routing for storagelevel +int ROUTING_STORAGE_HOST_LEVEL = -1; +int SURF_STORAGE_LEVEL = -1; xbt_lib_t storage_type_lib; -int ROUTING_STORAGE_TYPE_LEVEL; //Routing for storage_type level +int ROUTING_STORAGE_TYPE_LEVEL = -1; //Routing for storage_type level simgrid::surf::StorageModel *surf_storage_model = NULL; namespace simgrid { diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 8b0b80676a..35df0801cc 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -32,18 +32,18 @@ namespace surf { */ xbt_dict_t host_list = nullptr; -int COORD_HOST_LEVEL=0; //Coordinates level +int COORD_HOST_LEVEL = -1; //Coordinates level -int MSG_FILE_LEVEL; //Msg file level +int MSG_FILE_LEVEL = -1; //Msg file level -int SIMIX_STORAGE_LEVEL; //Simix storage level -int MSG_STORAGE_LEVEL; //Msg storage level +int SIMIX_STORAGE_LEVEL = -1; //Simix storage level +int MSG_STORAGE_LEVEL = -1; //Msg storage level xbt_lib_t as_router_lib; -int ROUTING_ASR_LEVEL; //Routing level -int COORD_ASR_LEVEL; //Coordinates level -int NS3_ASR_LEVEL; //host node for ns3 -int ROUTING_PROP_ASR_LEVEL; //Where the properties are stored +int ROUTING_ASR_LEVEL = -1; //Routing level +int COORD_ASR_LEVEL = -1; //Coordinates level +int NS3_ASR_LEVEL = -1; //host node for ns3 +int ROUTING_PROP_ASR_LEVEL = -1; //Where the properties are stored /** @brief Retrieve a netcard from its name * -- 2.20.1