From 998f0e84439ff2665a69d9c33686c86f380713c0 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 10 Jan 2016 00:54:40 +0100 Subject: [PATCH] make it easier to mark execution paths as DEADCODE, and mark one of them :) --- include/xbt/ex.h | 2 ++ src/surf/surf_interface.cpp | 10 +++++----- src/surf/surf_interface.hpp | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/xbt/ex.h b/include/xbt/ex.h index 59e442ba0e..526c374181 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -462,6 +462,8 @@ XBT_PUBLIC( void )__xbt_ex_terminate_default(xbt_ex_t * e); THROWF(unknown_error, 0, "The Impossible Did Happen (yet again)") #define THROW_UNIMPLEMENTED \ THROWF(unknown_error, 0, "Function %s unimplemented",_XBT_FUNCTION) +#define THROW_DEADCODE \ + THROWF(unknown_error, 0, "Function %s was supposed to be DEADCODE, but it's not",_XBT_FUNCTION) #define DIE_IMPOSSIBLE xbt_die("The Impossible Did Happen (yet again)") diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index d1c9c0db44..4d3b104313 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -591,14 +591,14 @@ namespace surf { Resource::Resource() : p_name(NULL), p_model(NULL) -{} // FIXME: DEADCODE? +{THROW_DEADCODE;} // FIXME: DEADCODE? Resource::Resource(Model *model, const char *name) - : Resource(model, name, 1/*SURF_RESOURCE_ON*/) -{} // FIXME: DEADCODE? + : Resource(model, name, 1/*ON*/) +{} Resource::Resource(Model *model, const char *name, lmm_constraint_t constraint) - : Resource(model, name, constraint, 1/*SURF_RESOURCE_ON*/) + : Resource(model, name, constraint, 1/*ON*/) {} Resource::Resource(Model *model, const char *name, lmm_constraint_t constraint, int initiallyOn) @@ -612,7 +612,7 @@ Resource::Resource(Model *model, const char *name, int initiallyOn) : p_name(xbt_strdup(name)) , p_model(model) , m_isOn(initiallyOn) -{} // FIXME: DEADCODE? +{} Resource::~Resource() { diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 5855cca044..dc8d9bc826 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -483,7 +483,7 @@ public: /* LMM */ /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component */ lmm_constraint_t getConstraint(); protected: - lmm_constraint_t p_constraint; + lmm_constraint_t p_constraint = nullptr; }; } -- 2.20.1