Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use #if instead if #ifdef for the things in the public config header
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 8 Mar 2016 23:26:23 +0000 (00:26 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 8 Mar 2016 23:26:23 +0000 (00:26 +0100)
50 files changed:
CMakeLists.txt
examples/simdag/scheduling/minmin_test.c
examples/smpi/mc/bugged1.c
include/simgrid/jedule/jedule_events.h
include/simgrid/jedule/jedule_output.h
include/simgrid/jedule/jedule_platform.h
include/simgrid/jedule/jedule_sd_binding.h
include/simgrid/modelchecker.h
include/simgrid_config.h.in
include/smpi/mpi.h
include/xbt/parmap.h
include/xbt/signal.hpp
include/xbt/string.hpp
src/include/surf/surf.h
src/instr/instr_private.h
src/instr/jedule/jedule_events.cpp
src/instr/jedule/jedule_output.cpp
src/instr/jedule/jedule_platform.cpp
src/instr/jedule/jedule_sd_binding.cpp
src/mc/Process.hpp
src/mc/mc_base.cpp
src/mc/mc_client.h
src/mc/mc_config.cpp
src/mc/mc_global.cpp
src/mc/mc_record.cpp
src/msg/msg_environment.cpp
src/simdag/sd_global.cpp
src/simdag/sd_task.cpp
src/simgrid/sg_config.c
src/simix/Context.cpp
src/simix/UContext.cpp
src/simix/popping.cpp
src/simix/popping_generated.cpp
src/simix/simcalls.py
src/simix/smx_context.cpp
src/simix/smx_global.cpp
src/simix/smx_network.cpp
src/simix/smx_private.h
src/smpi/colls/smpi_automatic_selector.c
src/smpi/smpi_mpi_dt.cpp
src/surf/network_interface.cpp
src/surf/surf_interface.cpp
src/surf/xml/surfxml_parseplatf.cpp
src/xbt/backtrace_linux.c
src/xbt/log.c
src/xbt/mmalloc/mm_legacy.c
src/xbt/parmap.cpp
src/xbt/string.cpp
src/xbt/xbt_main.c
tools/cmake/DefinePackages.cmake

index 73b7e9b..b0a6d3c 100644 (file)
@@ -338,6 +338,8 @@ endif()
 
 if(enable_jedule)
   set(HAVE_JEDULE 1)
+else()
+  set(HAVE_JEDULE 0)
 endif()
 
 if(enable_mallocators)
index 37b8f79..437ba69 100644 (file)
@@ -8,7 +8,7 @@
 #include <string.h>
 #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);
index 5cf9e63..8815dd3 100644 (file)
@@ -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);
index 329ef4c..d2a5bdf 100644 (file)
@@ -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 {
index ed623c2..6b50c76 100644 (file)
@@ -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;
index 1858759..38df596 100644 (file)
@@ -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;
index 93a7261..8f2a162 100644 (file)
@@ -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);
index da3d831..a401b7a 100644 (file)
@@ -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
  *
index 340f0a8..4749db6 100644 (file)
 #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 */
index 5bfe31a..2cb6aca 100644 (file)
@@ -20,7 +20,7 @@
 #include <sys/time.h> /* 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
index 8f80930..a92c3e7 100644 (file)
@@ -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,
index de3c031..714ae0d 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef SIMGRID_XBT_SIGNAL_HPP
 #define SIMGRID_XBT_SIGNAL_HPP
 
-#ifdef SIMGRID_HAVE_LIBSIG
+#if SIMGRID_HAVE_LIBSIG
 #include <sigc++/sigc++.h>
 #else
 #include <boost/signals2.hpp>
@@ -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 T> class signal;
@@ -55,4 +55,4 @@ namespace xbt {
 }
 }
 
-#endif
\ No newline at end of file
+#endif
index 164d1a0..71f7545 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef SIMGRIC_XBT_STRING_HPP
 #define SIMGRIC_XBT_STRING_HPP
 
-#ifdef HAVE_MC
+#if HAVE_MC
 
 #include <stdexcept>
 #include <cstddef>
@@ -296,4 +296,4 @@ typedef std::string string;
 
 #endif
 
-#endif
\ No newline at end of file
+#endif
index 11f12e4..5a78792 100644 (file)
@@ -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
  *
index c004b99..bd861c1 100644 (file)
@@ -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
 
index 3578ec7..64dc9dd 100644 (file)
@@ -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;
index 1655a20..a0c3461 100644 (file)
@@ -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");
 
index 89a1574..90a2c49 100644 (file)
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef HAVE_JEDULE
+#if HAVE_JEDULE
 
 static xbt_dict_t host2_simgrid_parent_container;
 static xbt_dict_t container_name2container;
index 8e8becc..542fa68 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <stdio.h>
 
-#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");
index 724d068..cd090fc 100644 (file)
@@ -22,7 +22,7 @@
 #include <xbt/dynar.h>
 #include <xbt/mmalloc.h>
 
-#ifdef HAVE_MC
+#if HAVE_MC
 #include "src/xbt/mmalloc/mmprivate.h"
 #endif
 
index 70ca01c..dd609ad 100644 (file)
 #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) {
index fb12858..0f1fc22 100644 (file)
@@ -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
 
index d7752f1..a0ddac8 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <simgrid/sg_config.h>
 
-#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;
index 898da3f..4460977 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "src/simix/smx_process_private.h"
 
-#ifdef HAVE_MC
+#if HAVE_MC
 #include <libunwind.h>
 #include "src/mc/mc_comm_pattern.h"
 #include "src/mc/mc_request.h"
@@ -59,7 +59,7 @@ std::vector<double> 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("**************************");
index ce7eeb2..216356d 100644 (file)
@@ -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;
index e7bd23f..2b19c76 100644 (file)
@@ -11,7 +11,7 @@
 #include "simgrid/s4u/As.hpp"
 #include "simgrid/s4u/engine.hpp"
 
-#ifdef HAVE_LUA
+#if HAVE_LUA
 #include <lua.h>
 #include <lauxlib.h>
 #include <lualib.h>
index 2b7e904..8ff96f8 100644 (file)
@@ -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
index c139420..3768b22 100644 (file)
@@ -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;
index 02de65b..658c008 100644 (file)
@@ -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);
index 4c478a2..be5da21 100644 (file)
@@ -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
+}
index 42ee16b..51a8afb 100644 (file)
@@ -221,7 +221,7 @@ UContext::UContext(std::function<void()> 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);
index facf8e8..15ad87d 100644 (file)
@@ -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<void()>* function = (std::function<void()>*) code;
   (*function)();
-}
\ No newline at end of file
+}
index cee0200..ecaa6b8 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <xbt/base.h>
 #include "smx_private.h"
-#ifdef HAVE_MC
+#if HAVE_MC
 #include "src/mc/mc_forward.h"
 #endif
 
index 73c78ce..0265346 100755 (executable)
@@ -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 <xbt/base.h>\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')
index 4c3e022..82a78fd 100644 (file)
@@ -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
index 5c47af3..2d559e7 100644 (file)
 #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 <stdlib.h>
 #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();
index 58b1ac1..b57a60e 100644 (file)
@@ -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;
index ccd2436..938b5d4 100644 (file)
@@ -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)) */
index 40cebaf..63b3b60 100644 (file)
@@ -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 <float.h>
index 59af331..5e5b242 100644 (file)
@@ -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
index 6b25825..b53f312 100644 (file)
@@ -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<std::string,Link *> *Link::links = new boost::unordered_map<std::string,Link *>();
     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() {
index 7590c31..d16f7c9 100644 (file)
@@ -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).",
index d87f73c..283098c 100644 (file)
@@ -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
index 4842e83..5bdd34c 100644 (file)
@@ -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 <libunwind.h>
 #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;
index 075e482..1a13c86 100644 (file)
@@ -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);
index c9644fc..1652eb4 100644 (file)
@@ -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
  *
index 8dff2fe..1df0bf7 100644 (file)
@@ -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<unsigned int> 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.
index 4489c33..f378cec 100644 (file)
@@ -10,7 +10,7 @@
 namespace simgrid {
 namespace xbt {
 
-#ifdef HAVE_MC
+#if HAVE_MC
 
 const char string::NUL = '\0';
 
index 319a422..52ec606 100644 (file)
@@ -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
 }
index 7148f45..abbd3b1 100644 (file)
@@ -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})