From fd769219531a772284d75320187a0ef9f8118afd Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 9 Mar 2016 00:26:23 +0100 Subject: [PATCH] use #if instead if #ifdef for the things in the public config header --- CMakeLists.txt | 2 ++ examples/simdag/scheduling/minmin_test.c | 4 ++-- examples/smpi/mc/bugged1.c | 3 --- include/simgrid/jedule/jedule_events.h | 2 +- include/simgrid/jedule/jedule_output.h | 2 +- include/simgrid/jedule/jedule_platform.h | 2 +- include/simgrid/jedule/jedule_sd_binding.h | 2 +- include/simgrid/modelchecker.h | 2 +- include/simgrid_config.h.in | 10 +++++----- include/smpi/mpi.h | 2 +- include/xbt/parmap.h | 2 +- include/xbt/signal.hpp | 6 +++--- include/xbt/string.hpp | 4 ++-- src/include/surf/surf.h | 2 +- src/instr/instr_private.h | 2 +- src/instr/jedule/jedule_events.cpp | 2 +- src/instr/jedule/jedule_output.cpp | 2 +- src/instr/jedule/jedule_platform.cpp | 2 +- src/instr/jedule/jedule_sd_binding.cpp | 2 +- src/mc/Process.hpp | 2 +- src/mc/mc_base.cpp | 18 +++++++++--------- src/mc/mc_client.h | 2 +- src/mc/mc_config.cpp | 8 ++++---- src/mc/mc_global.cpp | 10 +++++----- src/mc/mc_record.cpp | 4 ++-- src/msg/msg_environment.cpp | 2 +- src/simdag/sd_global.cpp | 8 ++++---- src/simdag/sd_task.cpp | 2 +- src/simgrid/sg_config.c | 8 ++++---- src/simix/Context.cpp | 4 ++-- src/simix/UContext.cpp | 2 +- src/simix/popping.cpp | 4 ++-- src/simix/popping_generated.cpp | 2 +- src/simix/simcalls.py | 4 ++-- src/simix/smx_context.cpp | 4 ++-- src/simix/smx_global.cpp | 10 ++++------ src/simix/smx_network.cpp | 2 +- src/simix/smx_private.h | 2 +- src/smpi/colls/smpi_automatic_selector.c | 2 +- src/smpi/smpi_mpi_dt.cpp | 6 +++--- src/surf/network_interface.cpp | 12 ++++-------- src/surf/surf_interface.cpp | 2 +- src/surf/xml/surfxml_parseplatf.cpp | 6 +++--- src/xbt/backtrace_linux.c | 5 ++--- src/xbt/log.c | 10 +++++----- src/xbt/mmalloc/mm_legacy.c | 2 +- src/xbt/parmap.cpp | 10 ++++------ src/xbt/string.cpp | 2 +- src/xbt/xbt_main.c | 3 +-- tools/cmake/DefinePackages.cmake | 2 +- 50 files changed, 102 insertions(+), 113 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73b7e9bbe3..b0a6d3c96c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,6 +338,8 @@ endif() if(enable_jedule) set(HAVE_JEDULE 1) +else() + set(HAVE_JEDULE 0) endif() if(enable_mallocators) diff --git a/examples/simdag/scheduling/minmin_test.c b/examples/simdag/scheduling/minmin_test.c index 37b8f79acc..437ba691dd 100644 --- a/examples/simdag/scheduling/minmin_test.c +++ b/examples/simdag/scheduling/minmin_test.c @@ -8,7 +8,7 @@ #include #include "simgrid/simdag.h" -#ifdef HAVE_JEDULE +#if HAVE_JEDULE #include "simgrid/jedule/jedule_sd_binding.h" #endif @@ -253,7 +253,7 @@ int main(int argc, char **argv) XBT_INFO("Simulation Time: %f", SD_get_clock()); XBT_INFO("------------------- Produce the trace file---------------------------"); XBT_INFO("Producing a jedule output (if active) of the run into %s", tracefilename?tracefilename:"minmin_test.jed"); -#ifdef HAVE_JEDULE +#if HAVE_JEDULE jedule_sd_dump(tracefilename); #endif free(tracefilename); diff --git a/examples/smpi/mc/bugged1.c b/examples/smpi/mc/bugged1.c index 5cf9e632b9..8815dd38b0 100644 --- a/examples/smpi/mc/bugged1.c +++ b/examples/smpi/mc/bugged1.c @@ -39,9 +39,6 @@ int main(int argc, char **argv) } printf("recv_buff = %d\n", recv_buff); - //#ifdef HAVE_MC - //MC_assert(recv_buff == size - 1); - //#endif }else{ MPI_Send(&rank, 1, MPI_INT, 0, 42, MPI_COMM_WORLD); printf("Sent %d to rank 0\n", rank); diff --git a/include/simgrid/jedule/jedule_events.h b/include/simgrid/jedule/jedule_events.h index 329ef4c0e9..d2a5bdf0f7 100644 --- a/include/simgrid/jedule/jedule_events.h +++ b/include/simgrid/jedule/jedule_events.h @@ -12,7 +12,7 @@ #include "xbt/dict.h" #include "simgrid/jedule/jedule_platform.h" -#ifdef HAVE_JEDULE +#if HAVE_JEDULE SG_BEGIN_DECL() struct jed_event { diff --git a/include/simgrid/jedule/jedule_output.h b/include/simgrid/jedule/jedule_output.h index ed623c21ed..6b50c7672e 100644 --- a/include/simgrid/jedule/jedule_output.h +++ b/include/simgrid/jedule/jedule_output.h @@ -12,7 +12,7 @@ #include "jedule_events.h" #include "jedule_platform.h" -#ifdef HAVE_JEDULE +#if HAVE_JEDULE SG_BEGIN_DECL() extern xbt_dynar_t jedule_event_list; diff --git a/include/simgrid/jedule/jedule_platform.h b/include/simgrid/jedule/jedule_platform.h index 1858759e0a..38df596628 100644 --- a/include/simgrid/jedule/jedule_platform.h +++ b/include/simgrid/jedule/jedule_platform.h @@ -11,7 +11,7 @@ #include "xbt/dynar.h" #include "xbt/dict.h" -#ifdef HAVE_JEDULE +#if HAVE_JEDULE SG_BEGIN_DECL() typedef struct jed_simgrid_container s_jed_simgrid_container_t, *jed_simgrid_container_t; diff --git a/include/simgrid/jedule/jedule_sd_binding.h b/include/simgrid/jedule/jedule_sd_binding.h index 93a726123a..8f2a162391 100644 --- a/include/simgrid/jedule/jedule_sd_binding.h +++ b/include/simgrid/jedule/jedule_sd_binding.h @@ -10,7 +10,7 @@ #include "simgrid_config.h" #include "simgrid/simdag.h" -#ifdef HAVE_JEDULE +#if HAVE_JEDULE SG_BEGIN_DECL() XBT_PUBLIC(void) jedule_log_sd_event(SD_task_t task); XBT_PUBLIC(void) jedule_setup_platform(void); diff --git a/include/simgrid/modelchecker.h b/include/simgrid/modelchecker.h index da3d83150c..a401b7a5fe 100644 --- a/include/simgrid/modelchecker.h +++ b/include/simgrid/modelchecker.h @@ -26,7 +26,7 @@ SG_BEGIN_DECL() XBT_PUBLIC(int) MC_random(int min, int max); -#ifdef HAVE_MC +#if HAVE_MC /* Internal variable used to check if we're running under the MC * diff --git a/include/simgrid_config.h.in b/include/simgrid_config.h.in index 340f0a877c..4749db6f4d 100644 --- a/include/simgrid_config.h.in +++ b/include/simgrid_config.h.in @@ -19,12 +19,12 @@ #define SIMGRID_VERSION_STRING "@SIMGRID_VERSION_STRING@" #define SIMGRID_VERSION_BANNER "@SIMGRID_VERSION_BANNER@" -#cmakedefine HAVE_JEDULE @HAVE_JEDULE@ /* Was Jedule compiled in? */ -#cmakedefine HAVE_LUA @HAVE_LUA@ /* Was the Lua support compiled in? */ +#define HAVE_JEDULE @HAVE_JEDULE@ /* Was Jedule compiled in? */ +#define HAVE_LUA @HAVE_LUA@ /* Was the Lua support compiled in? */ #define HAVE_MALLOCATOR @HAVE_MALLOCATOR@ /* Whether mallocators (object pools) were activated at compilation time. */ -#cmakedefine HAVE_MC @HAVE_MC@ /* Was the model-checking compiled in? */ -#cmakedefine HAVE_NS3 @HAVE_NS3@ /* Was the NS3 support compiled in? */ +#define HAVE_MC @HAVE_MC@ /* Was the model-checking compiled in? */ +#define HAVE_NS3 @HAVE_NS3@ /* Was the NS3 support compiled in? */ -#cmakedefine SIMGRID_HAVE_LIBSIG @SIMGRID_HAVE_LIBSIG@ /* Used in the public interface xbt/signal.hpp :( */ +#define SIMGRID_HAVE_LIBSIG @SIMGRID_HAVE_LIBSIG@ /* Used in the public interface xbt/signal.hpp :( */ #endif /* SIMGRID_PUBLIC_CONFIG_H */ diff --git a/include/smpi/mpi.h b/include/smpi/mpi.h index 5bfe31a43e..2cb6aca2b4 100644 --- a/include/smpi/mpi.h +++ b/include/smpi/mpi.h @@ -20,7 +20,7 @@ #include /* Load it before the define next line to not mess with the system headers */ #define gettimeofday(x, y) smpi_gettimeofday(x, NULL) -#ifdef HAVE_MC +#if HAVE_MC #undef assert #define assert(x) MC_assert(x) #endif diff --git a/include/xbt/parmap.h b/include/xbt/parmap.h index 8f80930622..a92c3e7dbf 100644 --- a/include/xbt/parmap.h +++ b/include/xbt/parmap.h @@ -44,7 +44,7 @@ XBT_PUBLIC(void) xbt_parmap_destroy(xbt_parmap_t parmap); XBT_PUBLIC(void) xbt_parmap_apply(xbt_parmap_t parmap, void_f_pvoid_t fun, xbt_dynar_t data); XBT_PUBLIC(void*) xbt_parmap_next(xbt_parmap_t parmap); -#ifdef HAVE_MC +#if HAVE_MC XBT_PUBLIC(xbt_parmap_t) xbt_parmap_mc_new(unsigned int num_workers, e_xbt_parmap_mode_t mode); XBT_PUBLIC(int) xbt_parmap_mc_apply(xbt_parmap_t parmap, int_f_pvoid_pvoid_t fun, void *data, unsigned int length, diff --git a/include/xbt/signal.hpp b/include/xbt/signal.hpp index de3c031317..714ae0d17d 100644 --- a/include/xbt/signal.hpp +++ b/include/xbt/signal.hpp @@ -6,7 +6,7 @@ #ifndef SIMGRID_XBT_SIGNAL_HPP #define SIMGRID_XBT_SIGNAL_HPP -#ifdef SIMGRID_HAVE_LIBSIG +#if SIMGRID_HAVE_LIBSIG #include #else #include @@ -15,7 +15,7 @@ namespace simgrid { namespace xbt { -#ifdef SIMGRID_HAVE_LIBSIG +#if SIMGRID_HAVE_LIBSIG // Wraps sigc++ signals with the interface of boost::signals2: template class signal; @@ -55,4 +55,4 @@ namespace xbt { } } -#endif \ No newline at end of file +#endif diff --git a/include/xbt/string.hpp b/include/xbt/string.hpp index 164d1a0fce..71f75458fc 100644 --- a/include/xbt/string.hpp +++ b/include/xbt/string.hpp @@ -7,7 +7,7 @@ #ifndef SIMGRIC_XBT_STRING_HPP #define SIMGRIC_XBT_STRING_HPP -#ifdef HAVE_MC +#if HAVE_MC #include #include @@ -296,4 +296,4 @@ typedef std::string string; #endif -#endif \ No newline at end of file +#endif diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 11f12e4615..5a78792ae3 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -592,7 +592,7 @@ XBT_PUBLIC(void) surf_network_model_init_Constant(void); */ XBT_PUBLIC(void) surf_network_model_init_CM02(void); -#ifdef HAVE_NS3 +#if HAVE_NS3 /** \ingroup SURF_models * \brief Initializes the platform with the network model NS3 * diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index c004b99634..bd861c1585 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -453,7 +453,7 @@ typedef struct s_instr_extra_data { SG_END_DECL() -#ifdef HAVE_JEDULE +#if HAVE_JEDULE #include "simgrid/jedule/jedule_sd_binding.h" #endif diff --git a/src/instr/jedule/jedule_events.cpp b/src/instr/jedule/jedule_events.cpp index 3578ec7524..64dc9dd63b 100644 --- a/src/instr/jedule/jedule_events.cpp +++ b/src/instr/jedule/jedule_events.cpp @@ -15,7 +15,7 @@ #include "simgrid/jedule/jedule_events.h" #include "simgrid/jedule/jedule_platform.h" -#ifdef HAVE_JEDULE +#if HAVE_JEDULE void jed_event_add_resources(jed_event_t event, xbt_dynar_t host_selection) { xbt_dynar_t resource_subset_list; diff --git a/src/instr/jedule/jedule_output.cpp b/src/instr/jedule/jedule_output.cpp index 1655a205ce..a0c34619e4 100644 --- a/src/instr/jedule/jedule_output.cpp +++ b/src/instr/jedule/jedule_output.cpp @@ -13,7 +13,7 @@ #include "simgrid/jedule/jedule_output.h" -#ifdef HAVE_JEDULE +#if HAVE_JEDULE XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_out, jedule, "Logging specific to Jedule output"); diff --git a/src/instr/jedule/jedule_platform.cpp b/src/instr/jedule/jedule_platform.cpp index 89a15746a0..90a2c497b4 100644 --- a/src/instr/jedule/jedule_platform.cpp +++ b/src/instr/jedule/jedule_platform.cpp @@ -13,7 +13,7 @@ #include #include -#ifdef HAVE_JEDULE +#if HAVE_JEDULE static xbt_dict_t host2_simgrid_parent_container; static xbt_dict_t container_name2container; diff --git a/src/instr/jedule/jedule_sd_binding.cpp b/src/instr/jedule/jedule_sd_binding.cpp index 8e8becc94d..542fa68f22 100644 --- a/src/instr/jedule/jedule_sd_binding.cpp +++ b/src/instr/jedule/jedule_sd_binding.cpp @@ -23,7 +23,7 @@ #include -#ifdef HAVE_JEDULE +#if HAVE_JEDULE XBT_LOG_NEW_CATEGORY(jedule, "Logging specific to Jedule"); XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_sd, jedule, "Logging specific to Jedule SD binding"); diff --git a/src/mc/Process.hpp b/src/mc/Process.hpp index 724d068133..cd090fcdc2 100644 --- a/src/mc/Process.hpp +++ b/src/mc/Process.hpp @@ -22,7 +22,7 @@ #include #include -#ifdef HAVE_MC +#if HAVE_MC #include "src/xbt/mmalloc/mmprivate.h" #endif diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index 70ca01cebf..dd609ad2ca 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -20,14 +20,14 @@ #include "mc/mc.h" #include "src/mc/mc_protocol.h" -#ifdef HAVE_MC +#if HAVE_MC #include "src/mc/mc_request.h" #include "src/mc/Process.hpp" #include "src/mc/ModelChecker.hpp" #include "src/mc/mc_smx.h" #endif -#ifdef HAVE_MC +#if HAVE_MC using simgrid::mc::remote; #endif @@ -72,7 +72,7 @@ bool request_is_enabled(smx_simcall_t req) { unsigned int index = 0; smx_synchro_t act = 0; -#ifdef HAVE_MC +#if HAVE_MC s_smx_synchro_t temp_synchro; #endif @@ -84,7 +84,7 @@ bool request_is_enabled(smx_simcall_t req) /* FIXME: check also that src and dst processes are not suspended */ act = simcall_comm_wait__get__comm(req); -#ifdef HAVE_MC +#if HAVE_MC // Fetch from MCed memory: if (mc_mode == MC_MODE_SERVER) { mc_model_checker->process().read(&temp_synchro, remote(act)); @@ -106,7 +106,7 @@ bool request_is_enabled(smx_simcall_t req) case SIMCALL_COMM_WAITANY: { xbt_dynar_t comms; -#ifdef HAVE_MC +#if HAVE_MC s_xbt_dynar_t comms_buffer; size_t buffer_size = 0; @@ -130,7 +130,7 @@ bool request_is_enabled(smx_simcall_t req) #endif for (index = 0; index < comms->used; ++index) { -#ifdef HAVE_MC +#if HAVE_MC // Fetch act from MCed memory: if (mc_mode == MC_MODE_SERVER) { memcpy(&act, buffer + comms->elmsize * index, sizeof(act)); @@ -151,7 +151,7 @@ bool request_is_enabled(smx_simcall_t req) case SIMCALL_MUTEX_LOCK: { smx_mutex_t mutex = simcall_mutex_lock__get__mutex(req); -#ifdef HAVE_MC +#if HAVE_MC s_smx_mutex_t temp_mutex; if (mc_mode == MC_MODE_SERVER) { mc_model_checker->process().read(&temp_mutex, remote(mutex)); @@ -161,7 +161,7 @@ bool request_is_enabled(smx_simcall_t req) if(mutex->owner == nullptr) return true; else -#ifdef HAVE_MC +#if HAVE_MC // TODO, *(mutex->owner) :/ return MC_smx_resolve_process(mutex->owner)->pid == MC_smx_resolve_process(req->issuer)->pid; @@ -224,7 +224,7 @@ namespace mc { void handle_simcall(smx_simcall_t req, int value) { -#ifndef HAVE_MC +#if !HAVE_MC SIMIX_simcall_handle(req, value); #else if (mc_mode == MC_MODE_CLIENT) { diff --git a/src/mc/mc_client.h b/src/mc/mc_client.h index fb12858964..0f1fc22baa 100644 --- a/src/mc/mc_client.h +++ b/src/mc/mc_client.h @@ -26,7 +26,7 @@ XBT_PRIVATE void MC_client_handle_messages(void); XBT_PRIVATE void MC_client_send_message(void* message, std::size_t size); XBT_PRIVATE void MC_client_send_simple_message(e_mc_message_type type); -#ifdef HAVE_MC +#if HAVE_MC void MC_ignore(void* addr, std::size_t size); #endif diff --git a/src/mc/mc_config.cpp b/src/mc/mc_config.cpp index d7752f16f3..a0ddac8c5f 100644 --- a/src/mc/mc_config.cpp +++ b/src/mc/mc_config.cpp @@ -13,7 +13,7 @@ #include -#ifdef HAVE_MC +#if HAVE_MC #include "src/mc/mc_safety.h" #include "src/mc/mc_private.h" #endif @@ -27,7 +27,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_config, mc, } -#ifdef HAVE_MC +#if HAVE_MC namespace simgrid { namespace mc { /* Configuration support */ @@ -36,7 +36,7 @@ simgrid::mc::ReductionMode reduction_mode = simgrid::mc::ReductionMode::unset; } #endif -#ifndef HAVE_MC +#if !HAVE_MC #define _sg_do_model_check 0 #endif @@ -51,7 +51,7 @@ void _mc_cfg_cb_timeout(const char *name, int pos) _sg_mc_timeout = xbt_cfg_get_boolean(_sg_cfg_set, name); } -#ifdef HAVE_MC +#if HAVE_MC int _sg_do_model_check = 0; int _sg_do_model_check_record = 0; int _sg_mc_checkpoint = 0; diff --git a/src/mc/mc_global.cpp b/src/mc/mc_global.cpp index 898da3f27b..446097787a 100644 --- a/src/mc/mc_global.cpp +++ b/src/mc/mc_global.cpp @@ -26,7 +26,7 @@ #include "src/simix/smx_process_private.h" -#ifdef HAVE_MC +#if HAVE_MC #include #include "src/mc/mc_comm_pattern.h" #include "src/mc/mc_request.h" @@ -59,7 +59,7 @@ std::vector processes_time; } } -#ifdef HAVE_MC +#if HAVE_MC int user_max_depth_reached = 0; /* MC global data structures */ @@ -117,7 +117,7 @@ void MC_init_dot_output() } -#ifdef HAVE_MC +#if HAVE_MC void MC_init() { simgrid::mc::processes_time.resize(simix_process_maxpid); @@ -154,7 +154,7 @@ void MC_exit(void) //xbt_abort(); } -#ifdef HAVE_MC +#if HAVE_MC int MC_deadlock_check() { if (mc_mode == MC_MODE_SERVER) { @@ -538,7 +538,7 @@ void MC_process_clock_add(smx_process_t process, double amount) simgrid::mc::processes_time[process->pid] += amount; } -#ifdef HAVE_MC +#if HAVE_MC void MC_report_assertion_error(void) { XBT_INFO("**************************"); diff --git a/src/mc/mc_record.cpp b/src/mc/mc_record.cpp index ce7eeb2ac2..216356d274 100644 --- a/src/mc/mc_record.cpp +++ b/src/mc/mc_record.cpp @@ -21,7 +21,7 @@ #include "src/mc/mc_record.h" #include "src/mc/mc_base.h" -#ifdef HAVE_MC +#if HAVE_MC #include "src/mc/mc_request.h" #include "src/mc/mc_private.h" #include "src/mc/mc_state.h" @@ -99,7 +99,7 @@ fail: return nullptr; } -#ifdef HAVE_MC +#if HAVE_MC static char* MC_record_stack_to_string_liveness(xbt_fifo_t stack) { char* buffer; diff --git a/src/msg/msg_environment.cpp b/src/msg/msg_environment.cpp index e7bd23f06d..2b19c7693d 100644 --- a/src/msg/msg_environment.cpp +++ b/src/msg/msg_environment.cpp @@ -11,7 +11,7 @@ #include "simgrid/s4u/As.hpp" #include "simgrid/s4u/engine.hpp" -#ifdef HAVE_LUA +#if HAVE_LUA #include #include #include diff --git a/src/simdag/sd_global.cpp b/src/simdag/sd_global.cpp index 2b7e904e8e..8ff96f877b 100644 --- a/src/simdag/sd_global.cpp +++ b/src/simdag/sd_global.cpp @@ -11,7 +11,7 @@ #include "src/surf/surf_interface.hpp" #include "simgrid/s4u/engine.hpp" -#ifdef HAVE_JEDULE +#if HAVE_JEDULE #include "simgrid/jedule/jedule_sd_binding.h" #endif @@ -49,7 +49,7 @@ void SD_init(int *argc, char **argv) xbt_cfg_setdefault_string(_sg_cfg_set, "host/model", "ptask_L07"); -#ifdef HAVE_JEDULE +#if HAVE_JEDULE jedule_sd_init(); #endif @@ -94,7 +94,7 @@ void SD_create_environment(const char *platform_file) simgrid::s4u::Engine::instance()->loadPlatform(platform_file); XBT_DEBUG("Workstation number: %zu, link number: %d", sg_host_count(), sg_link_count()); -#ifdef HAVE_JEDULE +#if HAVE_JEDULE jedule_setup_platform(); #endif XBT_VERB("Starting simulation..."); @@ -265,7 +265,7 @@ void SD_exit(void) { TRACE_surf_resource_utilization_release(); -#ifdef HAVE_JEDULE +#if HAVE_JEDULE jedule_sd_cleanup(); jedule_sd_exit(); #endif diff --git a/src/simdag/sd_task.cpp b/src/simdag/sd_task.cpp index c13942043e..3768b223d5 100644 --- a/src/simdag/sd_task.cpp +++ b/src/simdag/sd_task.cpp @@ -350,7 +350,7 @@ void SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state) xbt_dynar_push(sd_global->completed_task_set,&task); task->finish_time = task->surf_action->getFinishTime(); task->remains = 0; -#ifdef HAVE_JEDULE +#if HAVE_JEDULE jedule_log_sd_event(task); #endif break; diff --git a/src/simgrid/sg_config.c b/src/simgrid/sg_config.c index 02de65b661..658c0087cb 100644 --- a/src/simgrid/sg_config.c +++ b/src/simgrid/sg_config.c @@ -372,7 +372,7 @@ static void _sg_cfg_cb__surf_path(const char *name, int pos) /* callback to decide if we want to use the model-checking */ #include "src/xbt_modinter.h" -#ifdef HAVE_MC +#if HAVE_MC extern int _sg_do_model_check; /* this variable lives in xbt_main until I find a right location for it */ extern int _sg_do_model_check_record; #endif @@ -381,7 +381,7 @@ static void _sg_cfg_cb_model_check_replay(const char *name, int pos) { MC_record_path = xbt_cfg_get_string(_sg_cfg_set, name); } -#ifdef HAVE_MC +#if HAVE_MC static void _sg_cfg_cb_model_check_record(const char *name, int pos) { _sg_do_model_check_record = xbt_cfg_get_boolean(_sg_cfg_set, name); } @@ -583,7 +583,7 @@ void sg_config_init(int *argc, char **argv) xbt_cfg_register(&_sg_cfg_set, "model-check/replay", "Enable replay mode with the given path", xbt_cfgelm_string, 0, 1, _sg_cfg_cb_model_check_replay); -#ifdef HAVE_MC +#if HAVE_MC /* do model-checking-record */ xbt_cfg_register(&_sg_cfg_set, "model-check/record", "Record the model-checking paths", @@ -761,7 +761,7 @@ void sg_config_init(int *argc, char **argv) xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb__surf_network_crosstraffic); xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "no"); -#ifdef HAVE_NS3 +#if HAVE_NS3 xbt_cfg_register(&_sg_cfg_set, "ns3/TcpModel", "The ns3 tcp model can be : NewReno or Reno or Tahoe", xbt_cfgelm_string, 1, 1, NULL); diff --git a/src/simix/Context.cpp b/src/simix/Context.cpp index 4c478a2d20..be5da21828 100644 --- a/src/simix/Context.cpp +++ b/src/simix/Context.cpp @@ -56,7 +56,7 @@ Context* ContextFactory::self() void ContextFactory::declare_context(void* context, std::size_t size) { -#ifdef HAVE_MC +#if HAVE_MC /* Store the address of the stack in heap to compare it apart of heap comparison */ if(MC_is_active()) MC_ignore_heap(context, size); @@ -108,4 +108,4 @@ AttachContext::~AttachContext() } } -} \ No newline at end of file +} diff --git a/src/simix/UContext.cpp b/src/simix/UContext.cpp index 42ee16b14e..51a8afb2d0 100644 --- a/src/simix/UContext.cpp +++ b/src/simix/UContext.cpp @@ -221,7 +221,7 @@ UContext::UContext(std::function code, sysv_maestro_context = this; } -#ifdef HAVE_MC +#if HAVE_MC if (MC_is_active() && has_code()) { MC_register_stack_area(this->stack_, process, &(this->uc_), smx_context_usable_stack_size); diff --git a/src/simix/popping.cpp b/src/simix/popping.cpp index facf8e844d..15ad87daf6 100644 --- a/src/simix/popping.cpp +++ b/src/simix/popping.cpp @@ -7,7 +7,7 @@ #include "smx_private.h" #include "xbt/fifo.h" #include "xbt/xbt_os_thread.h" -#ifdef HAVE_MC +#if HAVE_MC #include "src/mc/mc_private.h" #endif @@ -64,4 +64,4 @@ void SIMIX_run_kernel(void* code) { std::function* function = (std::function*) code; (*function)(); -} \ No newline at end of file +} diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index cee0200fa4..ecaa6b8526 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -15,7 +15,7 @@ #include #include "smx_private.h" -#ifdef HAVE_MC +#if HAVE_MC #include "src/mc/mc_forward.h" #endif diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index 73c78ce37d..02653461a4 100755 --- a/src/simix/simcalls.py +++ b/src/simix/simcalls.py @@ -257,7 +257,7 @@ def handle(fd, func, simcalls, guarded_simcalls): '\n'.join(filter(nonempty, (func(simcall) for simcall in simcalls)))) for guard, list in guarded_simcalls.items(): - fd.write('\n#ifdef %s\n' % (guard)) + fd.write('\n#if %s\n' % (guard)) fd.write('\n'.join(func(simcall) for simcall in list)) fd.write('\n#endif\n') @@ -308,7 +308,7 @@ if __name__ == '__main__': fd.write('#include \n') fd.write('#include "smx_private.h"\n') - fd.write('#ifdef HAVE_MC\n') + fd.write('#if HAVE_MC\n') fd.write('#include "src/mc/mc_forward.h"\n') fd.write('#endif\n') fd.write('\n') diff --git a/src/simix/smx_context.cpp b/src/simix/smx_context.cpp index 4c3e02286a..82a78fd036 100644 --- a/src/simix/smx_context.cpp +++ b/src/simix/smx_context.cpp @@ -135,7 +135,7 @@ void *SIMIX_context_stack_new(void) #endif size_t size = smx_context_stack_size + smx_context_guard_size; -#ifdef HAVE_MC +#if HAVE_MC /* Cannot use posix_memalign when HAVE_MC. Align stack by hand, and save the * pointer returned by xbt_malloc0. */ char *alloc = (char*)xbt_malloc0(size + xbt_pagesize); @@ -186,7 +186,7 @@ void SIMIX_context_stack_delete(void *stack) XBT_WARN("Failed to remove page protection: %s", strerror(errno)); /* try to pursue anyway */ } -#ifdef HAVE_MC +#if HAVE_MC /* Retrieve the saved pointer. See SIMIX_context_stack_new above. */ stack = *((void **)stack - 1); #endif diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 5c47af32a9..2d559e7d9d 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -18,20 +18,18 @@ #include "src/mc/mc_replay.h" #include "simgrid/sg_config.h" -#ifdef HAVE_MC +#if HAVE_MC #include "src/mc/mc_private.h" #include "src/mc/mc_protocol.h" #include "src/mc/mc_client.h" -#endif -#ifdef HAVE_MC #include #include "src/mc/mc_protocol.h" #endif #include "src/mc/mc_record.h" -#ifdef HAVE_SMPI +#if HAVE_SMPI #include "src/smpi/private.h" #endif @@ -191,7 +189,7 @@ void SIMIX_set_maestro(void (*code)(void*), void* data) */ void SIMIX_global_init(int *argc, char **argv) { -#ifdef HAVE_MC +#if HAVE_MC _sg_do_model_check = getenv(MC_ENV_VARIABLE) != NULL; #endif @@ -265,7 +263,7 @@ void SIMIX_global_init(int *argc, char **argv) if (sg_cfg_get_boolean("clean_atexit")) atexit(SIMIX_clean); -#ifdef HAVE_MC +#if HAVE_MC // The communication initialization is done ASAP. // We need to communicate initialization of the different layers to the model-checker. MC_client_init(); diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index 58b1ac1f1d..b57a60edc2 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -178,7 +178,7 @@ smx_synchro_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, xbt_fifo_remove_item(fifo, item); xbt_fifo_free_item(item); synchro->comm.refcount++; -#ifdef HAVE_MC +#if HAVE_MC synchro->comm.rdv_cpy = synchro->comm.rdv; #endif synchro->comm.rdv = NULL; diff --git a/src/simix/smx_private.h b/src/simix/smx_private.h index ccd24366f0..938b5d4614 100644 --- a/src/simix/smx_private.h +++ b/src/simix/smx_private.h @@ -154,7 +154,7 @@ typedef struct s_smx_synchro { e_smx_comm_type_t type; /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */ smx_mailbox_t rdv; /* Rendez-vous where the comm is queued */ -#ifdef HAVE_MC +#if HAVE_MC smx_mailbox_t rdv_cpy; /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR (comm.rdv set to NULL when the communication is removed from the mailbox (used as garbage collector)) */ diff --git a/src/smpi/colls/smpi_automatic_selector.c b/src/smpi/colls/smpi_automatic_selector.c index 40cebafecc..63b3b6028e 100644 --- a/src/smpi/colls/smpi_automatic_selector.c +++ b/src/smpi/colls/smpi_automatic_selector.c @@ -5,7 +5,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "colls_private.h" -#ifdef HAVE_MC +#if HAVE_MC #include "src/mc/mc_private.h" #endif #include diff --git a/src/smpi/smpi_mpi_dt.cpp b/src/smpi/smpi_mpi_dt.cpp index 59af3317d7..5e5b242222 100644 --- a/src/smpi/smpi_mpi_dt.cpp +++ b/src/smpi/smpi_mpi_dt.cpp @@ -377,7 +377,7 @@ void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int h new_t->attributes=NULL; *new_type = new_t; -#ifdef HAVE_MC +#if HAVE_MC if(MC_is_active()) MC_ignore(&(new_t->in_use), sizeof(new_t->in_use)); #endif @@ -420,7 +420,7 @@ void smpi_datatype_free(MPI_Datatype* type){ void smpi_datatype_use(MPI_Datatype type){ if(type)type->in_use++; -#ifdef HAVE_MC +#if HAVE_MC if(MC_is_active()) MC_ignore(&(type->in_use), sizeof(type->in_use)); #endif @@ -433,7 +433,7 @@ void smpi_datatype_unuse(MPI_Datatype type){ if(type && type->in_use == 0 && (type->flags & DT_FLAG_DESTROYED)) smpi_datatype_free(&type); -#ifdef HAVE_MC +#if HAVE_MC if(MC_is_active()) MC_ignore(&(type->in_use), sizeof(type->in_use)); #endif diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index 6b258252f0..b53f31255f 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -12,8 +12,7 @@ #ifndef NETWORK_INTERFACE_CPP_ #define NETWORK_INTERFACE_CPP_ -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf, - "Logging specific to the SURF network module"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf, "Logging specific to the SURF network module"); /********* * C API * @@ -64,12 +63,9 @@ namespace simgrid { boost::unordered_map *Link::links = new boost::unordered_map(); Link *Link::byName(const char* name) { - Link * res = NULL; - try { - res = links->at(name); - } catch (std::out_of_range& e) {} - - return res; + if (links->find(name) == links->end()) + return NULL; + return links->at(name); } /** @brief Returns the amount of links in the platform */ int Link::linksCount() { diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 7590c310a8..d16f7c910b 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -62,7 +62,7 @@ s_surf_model_description_t surf_network_model_description[] = { surf_network_model_init_IB}, {"CM02", "Legacy network analytic model (Very similar to LV08, but without corrective factors. The timings of small messages are thus poorly modeled).", surf_network_model_init_CM02}, -#ifdef HAVE_NS3 +#if HAVE_NS3 {"NS3", "Network pseudo-model using the NS3 tcp model instead of an analytic model", surf_network_model_init_NS3}, #endif {"Reno", "Model from Steven H. Low using lagrange_solve instead of lmm_solve (experts only; check the code for more info).", diff --git a/src/surf/xml/surfxml_parseplatf.cpp b/src/surf/xml/surfxml_parseplatf.cpp index d87f73c1f3..283098c153 100644 --- a/src/surf/xml/surfxml_parseplatf.cpp +++ b/src/surf/xml/surfxml_parseplatf.cpp @@ -14,7 +14,7 @@ #include "src/surf/xml/platf.hpp" -#ifdef HAVE_LUA +#if HAVE_LUA extern "C" { #include "src/bindings/lua/simgrid_lua.h" @@ -128,14 +128,14 @@ void parse_after_config() { /* This function acts as a main in the parsing area. */ void parse_platform_file(const char *file) { -#ifdef HAVE_LUA +#if HAVE_LUA int is_lua = (file != NULL && strlen(file) > 3 && file[strlen(file)-3] == 'l' && file[strlen(file)-2] == 'u' && file[strlen(file)-1] == 'a'); #endif sg_platf_init(); -#ifdef HAVE_LUA +#if HAVE_LUA /* Check if file extension is "lua". If so, we will use * the lua bindings to parse the platform file (since it is * written in lua). If not, we will use the (old?) XML parser diff --git a/src/xbt/backtrace_linux.c b/src/xbt/backtrace_linux.c index 4842e834b7..5bdd34cd5b 100644 --- a/src/xbt/backtrace_linux.c +++ b/src/xbt/backtrace_linux.c @@ -16,7 +16,7 @@ #include "xbt/str.h" #include "xbt/module.h" /* xbt_binary_name */ #include "src/xbt_modinter.h" /* backtrace initialization headers */ -#ifdef HAVE_MC +#if HAVE_MC #define UNW_LOCAL_ONLY #include #endif @@ -374,8 +374,7 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) //FIXME: This code could be greatly im free(cmd); } -#ifdef HAVE_MC - +#if HAVE_MC int xbt_libunwind_backtrace(void* bt[XBT_BACKTRACE_SIZE], int size){ int i = 0; diff --git a/src/xbt/log.c b/src/xbt/log.c index 075e482c0a..1a13c86dfd 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -586,7 +586,7 @@ static void xbt_log_connect_categories(void) /* The following categories are only defined in libsimgrid */ /* bindings */ -#ifdef HAVE_LUA +#if HAVE_LUA XBT_LOG_CONNECT(lua); XBT_LOG_CONNECT(lua_host); XBT_LOG_CONNECT(lua_platf); @@ -612,14 +612,14 @@ static void xbt_log_connect_categories(void) XBT_LOG_CONNECT(instr_TI_trace); /* jedule */ -#ifdef HAVE_JEDULE +#if HAVE_JEDULE XBT_LOG_CONNECT(jedule); XBT_LOG_CONNECT(jed_out); XBT_LOG_CONNECT(jed_sd); #endif /* mc */ -#ifdef HAVE_MC +#if HAVE_MC XBT_LOG_CONNECT(mc); XBT_LOG_CONNECT(mc_checkpoint); XBT_LOG_CONNECT(mc_comm_determinism); @@ -665,7 +665,7 @@ static void xbt_log_connect_categories(void) /* simdag */ XBT_LOG_CONNECT(sd); XBT_LOG_CONNECT(sd_daxparse); -#ifdef HAVE_GRAPHVIZ +#if HAVE_GRAPHVIZ XBT_LOG_CONNECT(sd_dotparse); #endif XBT_LOG_CONNECT(sd_kernel); @@ -700,7 +700,7 @@ static void xbt_log_connect_categories(void) XBT_LOG_CONNECT(surf_lagrange_dichotomy); XBT_LOG_CONNECT(surf_maxmin); XBT_LOG_CONNECT(surf_network); -#ifdef HAVE_NS3 +#if HAVE_NS3 XBT_LOG_CONNECT(ns3); #endif XBT_LOG_CONNECT(surf_parse); diff --git a/src/xbt/mmalloc/mm_legacy.c b/src/xbt/mmalloc/mm_legacy.c index c9644fc3dc..1652eb4cbd 100644 --- a/src/xbt/mmalloc/mm_legacy.c +++ b/src/xbt/mmalloc/mm_legacy.c @@ -51,7 +51,7 @@ xbt_mheap_t mmalloc_set_current_heap(xbt_mheap_t new_heap) } /* Override the malloc-like functions if MC is activated at compile time */ -#ifdef HAVE_MC +#if HAVE_MC /* ***** Temporary allocator * diff --git a/src/xbt/parmap.cpp b/src/xbt/parmap.cpp index 8dff2fe504..1df0bf7b07 100644 --- a/src/xbt/parmap.cpp +++ b/src/xbt/parmap.cpp @@ -54,14 +54,12 @@ static void futex_wait(unsigned *uaddr, unsigned val); static void futex_wake(unsigned *uaddr, unsigned val); #endif -#ifndef _MSC_VER static void xbt_parmap_busy_master_wait(xbt_parmap_t parmap); static void xbt_parmap_busy_worker_signal(xbt_parmap_t parmap); static void xbt_parmap_busy_master_signal(xbt_parmap_t parmap); static void xbt_parmap_busy_worker_wait(xbt_parmap_t parmap, unsigned round); -#endif -#ifdef HAVE_MC +#if HAVE_MC static void xbt_parmap_mc_work(xbt_parmap_t parmap, int worker_id); static void *xbt_parmap_mc_worker_main(void *arg); #endif @@ -80,7 +78,7 @@ typedef struct s_xbt_parmap { xbt_dynar_t data; /**< parameters to pass to fun in parallel */ std::atomic index; /**< index of the next element of data to pick */ -#ifdef HAVE_MC +#if HAVE_MC int finish; void* ref_snapshot; int_f_pvoid_pvoid_t snapshot_compare; @@ -152,7 +150,7 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode) return parmap; } -#ifdef HAVE_MC +#if HAVE_MC /** * \brief Creates a parallel map object * \param num_workers number of worker threads to create @@ -359,7 +357,7 @@ static void *xbt_parmap_worker_main(void *arg) } } -#ifdef HAVE_MC +#if HAVE_MC /** * \brief Applies a list of tasks in parallel. diff --git a/src/xbt/string.cpp b/src/xbt/string.cpp index 4489c33abe..f378cec98a 100644 --- a/src/xbt/string.cpp +++ b/src/xbt/string.cpp @@ -10,7 +10,7 @@ namespace simgrid { namespace xbt { -#ifdef HAVE_MC +#if HAVE_MC const char string::NUL = '\0'; diff --git a/src/xbt/xbt_main.c b/src/xbt/xbt_main.c index 319a42296c..52ec606361 100644 --- a/src/xbt/xbt_main.c +++ b/src/xbt/xbt_main.c @@ -10,7 +10,6 @@ #include "xbt/misc.h" #include "simgrid_config.h" -#include "src/internal_config.h" /* HAVE_MC */ #include "src/portable.h" #include "xbt/sysdep.h" #include "xbt/log.h" @@ -127,7 +126,7 @@ static void xbt_postexit(void) xbt_dynar_free(&xbt_cmdline); xbt_log_postexit(); free(xbt_binary_name); -#ifdef HAVE_MC +#if HAVE_MC mmalloc_postexit(); #endif } diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 7148f45d2f..abbd3b1ff6 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -787,7 +787,7 @@ if(WIN32) ) endif() -if(${HAVE_LUA}) +if(HAVE_LUA) set(simgrid_sources ${simgrid_sources} ${LUA_SRC}) else() set(EXTRA_DIST ${EXTRA_DIST} ${LUA_SRC}) -- 2.20.1