Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix HAVE_FOOBAR flags handling
authorGabriel Corona <gabriel.corona@loria.fr>
Wed, 9 Mar 2016 10:14:02 +0000 (11:14 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Wed, 9 Mar 2016 10:54:56 +0000 (11:54 +0100)
* always #define them (to 0 or 1);

* check with FOO instead of defined(FOO);

This way we detect missing #includes with -Wundef.

47 files changed:
include/xbt/mmalloc.h
src/include/mc/datatypes.h
src/include/mc/mc.h
src/mc/Process.cpp
src/mc/mc_checkpoint.cpp
src/mc/mc_compare.cpp
src/mc/mc_ignore.cpp
src/mc/mc_smx.cpp
src/mc/mc_snapshot.cpp
src/mc/mc_unw_vmread.cpp
src/simgrid/sg_config.c
src/simix/BoostContext.cpp
src/simix/RawContext.cpp
src/simix/UContext.cpp
src/simix/smx_context.cpp
src/simix/smx_global.cpp
src/simix/smx_private.h
src/smpi/smpi_bench.cpp
src/smpi/smpi_dvfs.cpp
src/surf/surf_interface.cpp
src/xbt/automaton/automaton_lexer.yy.c
src/xbt/automaton/parserPromela.lex
src/xbt/automaton/parserPromela.tab.cacc
src/xbt/automaton/parserPromela.yacc
src/xbt/ex.c
src/xbt/mmalloc/mm.c
src/xbt/mmalloc/mm_module.c
src/xbt/mmalloc/mmorecore.c
src/xbt/parmap.cpp
src/xbt/snprintf.c
src/xbt/xbt_log_appender_file.c
src/xbt/xbt_log_layout_format.c
src/xbt/xbt_main.c
src/xbt/xbt_os_thread.c
src/xbt/xbt_os_time.c
teshsuite/simdag/platforms/Evaluate_parse_time.c
teshsuite/smpi/mpich3-test/coll/nonblocking3.c
teshsuite/smpi/mpich3-test/datatype/contents.c
teshsuite/smpi/mpich3-test/rma/linked_list.c
teshsuite/smpi/mpich3-test/rma/linked_list_bench_lock_all.c
teshsuite/smpi/mpich3-test/rma/linked_list_bench_lock_excl.c
teshsuite/smpi/mpich3-test/rma/linked_list_bench_lock_shr.c
teshsuite/smpi/mpich3-test/rma/linked_list_fop.c
teshsuite/smpi/mpich3-test/rma/linked_list_lockall.c
teshsuite/xbt/parmap_bench/parmap_bench.c
teshsuite/xbt/parmap_test/parmap_test.c
tools/cmake/src/internal_config.h.in

index 85af731..116a6c3 100644 (file)
@@ -11,7 +11,7 @@
 #define SIMGRID_MMALLOC_H 1
 
 #include "src/internal_config.h"
-#ifdef HAVE_MMALLOC
+#if HAVE_MMALLOC
 
 # include <sys/types.h>        /* for size_t */
 # include <stdio.h>            /* for NULL */
index bb32dba..403a264 100644 (file)
@@ -10,7 +10,7 @@
 #include <src/internal_config.h>
 #include <xbt/base.h>
 
-#ifdef HAVE_UCONTEXT_H
+#if HAVE_UCONTEXT_H
 #include <ucontext.h>           /* context relative declarations */
 #endif
 
@@ -20,7 +20,7 @@ typedef struct s_mc_transition *mc_transition_t;
 
 typedef struct s_stack_region{
   void *address;
-#ifdef HAVE_UCONTEXT_H
+#if HAVE_UCONTEXT_H
   ucontext_t* context;
 #endif
   size_t size;
index 0e8da69..d6352f5 100644 (file)
@@ -10,7 +10,7 @@
 #include <src/internal_config.h>
 #include <simgrid/simix.h>
 #include <simgrid/modelchecker.h> /* our public interface (and definition of HAVE_MC) */
-#ifdef HAVE_UCONTEXT_H
+#if HAVE_UCONTEXT_H
 #include <ucontext.h>           /* context relative declarations */
 #endif
 
@@ -78,7 +78,7 @@ XBT_PUBLIC(void) MC_ignore_heap(void *address, size_t size);
 XBT_PUBLIC(void) MC_remove_ignore_heap(void *address, size_t size);
 XBT_PUBLIC(void) MC_ignore_local_variable(const char *var_name, const char *frame);
 XBT_PUBLIC(void) MC_ignore_global_variable(const char *var_name);
-#ifdef HAVE_UCONTEXT_H
+#if HAVE_UCONTEXT_H
 XBT_PUBLIC(void) MC_register_stack_area(void *stack, smx_process_t process, ucontext_t* context, size_t size);
 #endif
 
index 6434732..74f6411 100644 (file)
@@ -489,7 +489,7 @@ const void *Process::read_bytes(void* buffer, std::size_t size,
     std::shared_ptr<simgrid::mc::ObjectInformation> const& info =
       this->find_object_info_rw((void*)address.address());
     // Segment overlap is not handled.
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
     if (info.get() && this->privatized(*info)) {
       if (process_index < 0)
         xbt_die("Missing process index");
index b92e233..5788d9c 100644 (file)
@@ -82,7 +82,7 @@ static void restore(mc_mem_region_t region)
   }
 }
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 RegionSnapshot privatized_region(
     RegionType region_type, void *start_addr, void* permanent_addr,
     std::size_t size, const RegionSnapshot* ref_region
@@ -134,7 +134,7 @@ void add_region(int index, mc_snapshot_t snapshot,
     ref_region = mc_model_checker->parent_snapshot_->snapshot_regions[index].get();
 
   simgrid::mc::RegionSnapshot region;
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
   const bool privatization_aware = object_info
     && mc_model_checker->process().privatized(*object_info);
   if (privatization_aware && MC_smpi_process_count())
@@ -173,7 +173,7 @@ static void get_memory_regions(simgrid::mc::Process* process, mc_snapshot_t snap
     heap->heaplimit,
     process->get_malloc_info());
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
   if (mc_model_checker->process().privatized() && MC_smpi_process_count())
     // snapshot->privatization_index = smpi_loaded_page
     mc_model_checker->process().read_variable(
@@ -499,7 +499,7 @@ static std::vector<s_fd_infos_t> get_current_fds(pid_t pid)
 
     link[res] = '\0';
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
     if(smpi_is_privatisation_file(link))
       continue;
 #endif
@@ -587,7 +587,7 @@ void restore_snapshot_regions(mc_snapshot_t snapshot)
       restore(region.get());
   }
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
   // TODO, send a message to implement this in the MCed process
   if(snapshot->privatization_index >= 0) {
     // Fix the privatization mmap:
index 4afbc79..232feec 100644 (file)
@@ -23,7 +23,7 @@
 #include "src/mc/ObjectInformation.hpp"
 #include "src/mc/Variable.hpp"
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 #include "src/smpi/private.h"
 #endif
 
@@ -236,7 +236,7 @@ static int compare_global_variables(simgrid::mc::ObjectInformation* object_info,
 {
   xbt_assert(r1 && r2, "Missing region.");
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
   if (r1->storage_type() == simgrid::mc::StorageType::Privatized) {
     xbt_assert(process_index >= 0);
     if (r2->storage_type() != simgrid::mc::StorageType::Privatized)
index 1df9b1a..e04d7fc 100644 (file)
@@ -91,7 +91,7 @@ void MC_register_stack_area(void *stack, smx_process_t process, ucontext_t* cont
   region.block =
       ((char *) stack -
        (char *) heap->heapbase) / BLOCKSIZE + 1;
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
   if (smpi_privatize_global_variables && process)
     region.process_index = smpi_process_index_of_smx_process(process);
   else
index 07f11b8..ef15f63 100644 (file)
@@ -207,7 +207,7 @@ const char* MC_smx_process_get_name(smx_process_t p)
   return info->name.c_str();
 }
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 int MC_smpi_process_count(void)
 {
   if (mc_mode == MC_MODE_CLIENT)
index eb9e92d..f408e67 100644 (file)
@@ -39,7 +39,7 @@ mc_mem_region_t mc_get_snapshot_region(
       continue;
 
     if (region->storage_type() == simgrid::mc::StorageType::Privatized) {
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
       // Use the current process index of the snapshot:
       if (process_index == simgrid::mc::ProcessIndexDisabled)
         process_index = snapshot->privatization_index;
index e3fba78..29b015b 100644 (file)
@@ -52,7 +52,7 @@ static int access_mem(const unw_addr_space_t as,
   pid_t pid = _UPT_getpid(arg);
   size_t size = sizeof(unw_word_t);
 
-#ifdef HAVE_PROCESS_VM_READV
+#if HAVE_PROCESS_VM_READV
   // process_vm_read implementation.
   // This is only available since Linux 3.2.
 
index 658c008..899f452 100644 (file)
@@ -19,7 +19,7 @@
 #include "simgrid/simix.h"
 #include "simgrid/sg_config.h"
 #include "simgrid_config.h" /* what was compiled in? */
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 #include "smpi/smpi_interface.h"
 #endif
 #include "mc/mc.h"
@@ -286,7 +286,7 @@ static void _sg_cfg_cb__weight_S(const char *name, int pos)
   sg_weight_S_parameter = xbt_cfg_get_double(_sg_cfg_set, name);
 }
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 /* callback of the mpi collectives */
 static void _sg_cfg_cb__coll(const char *category,
                              s_mpi_coll_description_t * table,
@@ -695,11 +695,11 @@ void sg_config_init(int *argc, char **argv)
         sprintf(description,
                 "Context factory to use in SIMIX. Possible values: %s",
                 dflt_ctx_fact);
-#ifdef HAVE_UCONTEXT_CONTEXTS
+#if HAVE_UCONTEXT_CONTEXTS
       dflt_ctx_fact = "ucontext";
       p += sprintf(p, ", %s", dflt_ctx_fact);
 #endif
-#ifdef HAVE_RAW_CONTEXTS
+#if HAVE_RAW_CONTEXTS
       dflt_ctx_fact = "raw";
       p += sprintf(p, ", %s", dflt_ctx_fact);
 #endif
@@ -745,7 +745,7 @@ void sg_config_init(int *argc, char **argv)
     xbt_cfg_register(&_sg_cfg_set, "contexts/synchro",
                      "Synchronization mode to use when running contexts in parallel (either futex, posix or busy_wait)",
                      xbt_cfgelm_string, 1, 1, _sg_cfg_cb_contexts_parallel_mode);
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
     xbt_cfg_setdefault_string(_sg_cfg_set, "contexts/synchro", "futex");
 #else //No futex on mac and posix is unimplememted yet
     xbt_cfg_setdefault_string(_sg_cfg_set, "contexts/synchro", "busy_wait");
@@ -789,7 +789,7 @@ void sg_config_init(int *argc, char **argv)
                      xbt_cfgelm_string, 1, 1, NULL);
     xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/IB_penalty_factors", "0.965;0.925;1.35");
     
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
     xbt_cfg_register(&_sg_cfg_set, "smpi/running_power",
                      "Power of the host running the simulation (in flop/s). Used to bench the operations.",
                      xbt_cfgelm_double, 1, 1, NULL);
index 8af1011..241ecc3 100644 (file)
@@ -38,7 +38,7 @@ public:
   void resume();
 };
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
 class BoostParallelContext : public BoostContext {
 public:
   BoostParallelContext(std::function<void()> code,
@@ -66,7 +66,7 @@ BoostContextFactory::BoostContextFactory()
 {
   BoostContext::parallel_ = SIMIX_context_is_parallel();
   if (BoostContext::parallel_) {
-#ifndef HAVE_THREAD_CONTEXTS
+#if !HAVE_THREAD_CONTEXTS
     xbt_die("No thread support for parallel context execution");
 #else
     int nthreads = SIMIX_context_get_nthreads();
@@ -81,7 +81,7 @@ BoostContextFactory::BoostContextFactory()
 
 BoostContextFactory::~BoostContextFactory()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   if (BoostContext::parmap_) {
     xbt_parmap_destroy(BoostContext::parmap_);
     BoostContext::parmap_ = nullptr;
@@ -95,7 +95,7 @@ smx_context_t BoostContextFactory::create_context(std::function<void()>  code,
 {
   BoostContext* context = nullptr;
   if (BoostContext::parallel_)
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
     context = this->new_context<BoostParallelContext>(
       std::move(code), cleanup_func, process);
 #else
@@ -109,7 +109,7 @@ smx_context_t BoostContextFactory::create_context(std::function<void()>  code,
 
 void BoostContextFactory::run_all()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   if (BoostContext::parallel_) {
     BoostContext::threads_working_ = 0;
     xbt_parmap_apply(BoostContext::parmap_,
@@ -232,7 +232,7 @@ void BoostSerialContext::stop()
 
 // BoostParallelContext
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
 
 void BoostParallelContext::suspend()
 {
index 96cedd1..1ea7806 100644 (file)
@@ -83,7 +83,7 @@ ContextFactory* raw_factory()
 
 // ***** Loads of static stuff
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
 static xbt_parmap_t raw_parmap;
 static simgrid::simix::RawContext** raw_workers_context;    /* space to save the worker context in each thread */
 static uintptr_t raw_threads_working;     /* number of threads that have started their work */
@@ -286,7 +286,7 @@ RawContextFactory::RawContextFactory()
 #endif
   raw_context_parallel = SIMIX_context_is_parallel();
   if (raw_context_parallel) {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
     int nthreads = SIMIX_context_get_nthreads();
     xbt_os_thread_key_create(&raw_worker_id_key);
     // TODO, lazily init
@@ -305,7 +305,7 @@ RawContextFactory::RawContextFactory()
 
 RawContextFactory::~RawContextFactory()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   if (raw_parmap)
     xbt_parmap_destroy(raw_parmap);
   xbt_free(raw_workers_context);
@@ -380,7 +380,7 @@ void RawContextFactory::run_all_serial()
 
 void RawContextFactory::run_all_parallel()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   raw_threads_working = 0;
   if (raw_parmap == nullptr)
     raw_parmap = xbt_parmap_new(
@@ -428,7 +428,7 @@ void RawContext::suspend_serial()
 
 void RawContext::suspend_parallel()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   /* determine the next context */
   smx_process_t next_work = (smx_process_t) xbt_parmap_next(raw_parmap);
   RawContext* next_context = nullptr;
@@ -469,7 +469,7 @@ void RawContext::resume_serial()
 
 void RawContext::resume_parallel()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   uintptr_t worker_id = __sync_fetch_and_add(&raw_threads_working, 1);
   xbt_os_thread_set_specific(raw_worker_id_key, (void*) worker_id);
   RawContext* worker_context = (RawContext*) SIMIX_context_self();
index 51a8afb..8852c73 100644 (file)
@@ -57,7 +57,7 @@ namespace simix {
 }
 }
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
 static xbt_parmap_t sysv_parmap;
 static simgrid::simix::ParallelUContext** sysv_workers_context;   /* space to save the worker's context in each thread */
 static uintptr_t sysv_threads_working;     /* number of threads that have started their work */
@@ -131,7 +131,7 @@ UContextFactory::UContextFactory() : ContextFactory("UContextFactory")
 {
   if (SIMIX_context_is_parallel()) {
     sysv_parallel = true;
-#ifdef HAVE_THREAD_CONTEXTS  /* To use parallel ucontexts a thread pool is needed */
+#if HAVE_THREAD_CONTEXTS  /* To use parallel ucontexts a thread pool is needed */
     int nthreads = SIMIX_context_get_nthreads();
     sysv_parmap = nullptr;
     sysv_workers_context = xbt_new(ParallelUContext*, nthreads);
@@ -147,7 +147,7 @@ UContextFactory::UContextFactory() : ContextFactory("UContextFactory")
 
 UContextFactory::~UContextFactory()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   if (sysv_parmap)
     xbt_parmap_destroy(sysv_parmap);
   xbt_free(sysv_workers_context);
@@ -161,7 +161,7 @@ UContextFactory::~UContextFactory()
 void UContextFactory::run_all()
 {
   if (sysv_parallel) {
-    #ifdef HAVE_THREAD_CONTEXTS
+    #if HAVE_THREAD_CONTEXTS
       sysv_threads_working = 0;
       // Parmap_apply ensures that every working thread get an index in the
       // process_to_run array (through an atomic fetch_and_add),
@@ -303,7 +303,7 @@ void ParallelUContext::stop()
 /** Run one particular simulated process on the current thread. */
 void ParallelUContext::resume()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   // What is my containing body?
   uintptr_t worker_id = __sync_fetch_and_add(&sysv_threads_working, 1);
   // Store the number of my containing body in os-thread-specific area :
@@ -344,7 +344,7 @@ void ParallelUContext::resume()
  */
 void ParallelUContext::suspend()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   /* determine the next context */
   // Get the next soul to embody now:
   smx_process_t next_work = (smx_process_t) xbt_parmap_next(sysv_parmap);
index 82a78fd..b1bc093 100644 (file)
@@ -29,7 +29,7 @@
 #define _aligned_free  __mingw_aligned_free 
 #endif //MINGW
 
-#ifdef HAVE_VALGRIND_H
+#if HAVE_VALGRIND_H
 # include <valgrind/valgrind.h>
 #endif
 
@@ -40,7 +40,7 @@ int smx_context_stack_size;
 int smx_context_stack_size_was_set = 0;
 int smx_context_guard_size;
 int smx_context_guard_size_was_set = 0;
-#ifdef HAVE_THREAD_LOCAL_STORAGE
+#if HAVE_THREAD_LOCAL_STORAGE
 static XBT_THREAD_LOCAL smx_context_t smx_current_context_parallel;
 #else
 static xbt_os_thread_key_t smx_current_context_key = 0;
@@ -55,7 +55,7 @@ static e_xbt_parmap_mode_t smx_parallel_synchronization_mode = XBT_PARMAP_DEFAUL
  */
 void SIMIX_context_mod_init(void)
 {
-#if defined(HAVE_THREAD_CONTEXTS) && !defined(HAVE_THREAD_LOCAL_STORAGE)
+#if HAVE_THREAD_CONTEXTS && !HAVE_THREAD_LOCAL_STORAGE
   /* the __thread storage class is not available on this platform:
    * use getspecific/setspecific instead to store the current context in each thread */
   xbt_os_thread_key_create(&smx_current_context_key);
@@ -65,37 +65,37 @@ void SIMIX_context_mod_init(void)
     if (simgrid::simix::factory_initializer)
       simix_global->context_factory = simgrid::simix::factory_initializer();
     else { /* use the factory specified by --cfg=contexts/factory:value */
-#if defined(HAVE_THREAD_CONTEXTS)
+#if HAVE_THREAD_CONTEXTS
       if (!strcmp(smx_context_factory_name, "thread"))
         simix_global->context_factory = simgrid::simix::thread_factory();
 #else
       if (0);
 #endif
-#ifdef HAVE_UCONTEXT_CONTEXTS
+#if HAVE_UCONTEXT_CONTEXTS
       else if (!strcmp(smx_context_factory_name, "ucontext"))
         simix_global->context_factory = simgrid::simix::sysv_factory();
 #endif
-#ifdef HAVE_RAW_CONTEXTS
+#if HAVE_RAW_CONTEXTS
       else if (!strcmp(smx_context_factory_name, "raw"))
         simix_global->context_factory = simgrid::simix::raw_factory();
 #endif
-#ifdef HAVE_BOOST_CONTEXTS
+#if HAVE_BOOST_CONTEXTS
       else if (!strcmp(smx_context_factory_name, "boost"))
         simix_global->context_factory = simgrid::simix::boost_factory();
 #endif
       else {
         XBT_ERROR("Invalid context factory specified. Valid factories on this machine:");
-#ifdef HAVE_RAW_CONTEXTS
+#if HAVE_RAW_CONTEXTS
         XBT_ERROR("  raw: high performance context factory implemented specifically for SimGrid");
 #else
         XBT_ERROR("  (raw contexts were disabled at compilation time on this machine -- check configure logs for details)");
 #endif
-#ifdef HAVE_UCONTEXT_CONTEXTS
+#if HAVE_UCONTEXT_CONTEXTS
         XBT_ERROR("  ucontext: classical system V contexts (implemented with makecontext, swapcontext and friends)");
 #else
         XBT_ERROR("  (ucontext was disabled at compilation time on this machine -- check configure logs for details)");
 #endif
-#ifdef HAVE_BOOST_CONTEXTS
+#if HAVE_BOOST_CONTEXTS
         XBT_ERROR("  boost: this uses the boost libraries context implementation");
 #else
         XBT_ERROR("  (boost was disabled at compilation time on this machine -- check configure logs for details. Did you install the libboost-context-dev package?)");
@@ -160,7 +160,7 @@ void *SIMIX_context_stack_new(void)
     stack = xbt_malloc0(smx_context_stack_size);
   }
 
-#ifdef HAVE_VALGRIND_H
+#if HAVE_VALGRIND_H
   unsigned int valgrind_stack_id = VALGRIND_STACK_REGISTER(stack, (char *)stack + smx_context_stack_size);
   memcpy((char *)stack + smx_context_usable_stack_size, &valgrind_stack_id, sizeof valgrind_stack_id);
 #endif
@@ -173,7 +173,7 @@ void SIMIX_context_stack_delete(void *stack)
   if (!stack)
     return;
 
-#ifdef HAVE_VALGRIND_H
+#if HAVE_VALGRIND_H
   unsigned int valgrind_stack_id;
   memcpy(&valgrind_stack_id, (char *)stack + smx_context_usable_stack_size, sizeof valgrind_stack_id);
   VALGRIND_STACK_DEREGISTER(valgrind_stack_id);
@@ -225,7 +225,7 @@ void SIMIX_context_set_nthreads(int nb_threads) {
      nb_threads = xbt_os_get_numcores();
      XBT_INFO("Auto-setting contexts/nthreads to %d",nb_threads);
   }   
-#ifndef HAVE_THREAD_CONTEXTS
+#if !HAVE_THREAD_CONTEXTS
   xbt_assert(nb_threads == 1, "Parallel runs are impossible when the pthreads are missing.");
 #endif
   smx_parallel_contexts = nb_threads;
@@ -282,7 +282,7 @@ void SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode) {
 smx_context_t SIMIX_context_get_current(void)
 {
   if (SIMIX_context_is_parallel()) {
-#ifdef HAVE_THREAD_LOCAL_STORAGE
+#if HAVE_THREAD_LOCAL_STORAGE
     return smx_current_context_parallel;
 #else
     return xbt_os_thread_get_specific(smx_current_context_key);
@@ -300,7 +300,7 @@ smx_context_t SIMIX_context_get_current(void)
 void SIMIX_context_set_current(smx_context_t context)
 {
   if (SIMIX_context_is_parallel()) {
-#ifdef HAVE_THREAD_LOCAL_STORAGE
+#if HAVE_THREAD_LOCAL_STORAGE
     smx_current_context_parallel = context;
 #else
     xbt_os_thread_set_specific(smx_current_context_key, context);
index 2d559e7..2ef29f3 100644 (file)
@@ -88,9 +88,9 @@ static void segvhandler(int signum, siginfo_t *siginfo, void *context)
     }
   } else  if (siginfo->si_signo == SIGSEGV) {
     fprintf(stderr, "Segmentation fault.\n");
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
     if (smpi_enabled() && !smpi_privatize_global_variables) {
-#ifdef HAVE_PRIVATIZATION
+#if HAVE_PRIVATIZATION
       fprintf(stderr,
         "Try to enable SMPI variable privatization with --cfg=smpi/privatize_global_variables:yes.\n");
 #else
index d6c81df..5db6cea 100644 (file)
@@ -223,7 +223,7 @@ XBT_PUBLIC_DATA(char sigsegv_stack[SIGSTKSZ]);
 /* We are using the bottom of the stack to save some information, like the
  * valgrind_stack_id. Define smx_context_usable_stack_size to give the remaining
  * size for the stack. */
-#ifdef HAVE_VALGRIND_H
+#if HAVE_VALGRIND_H
 # define smx_context_usable_stack_size                                  \
   (smx_context_stack_size - sizeof(unsigned int)) /* for valgrind_stack_id */
 #else
index e5d3510..00ded92 100644 (file)
@@ -616,7 +616,7 @@ void smpi_really_switch_data_segment(int dest) {
   if(smpi_size_data_exe == 0)//no need to switch
     return;
 
-#ifdef HAVE_PRIVATIZATION
+#if HAVE_PRIVATIZATION
   if(smpi_loaded_page==-1){//initial switch, do the copy from the real page here
     for (int i=0; i< smpi_process_count(); i++){
       memcpy(smpi_privatisation_regions[i].address, TOPAGE(smpi_start_data_exe), smpi_size_data_exe);
@@ -641,7 +641,7 @@ int smpi_is_privatisation_file(char* file)
 
 void smpi_initialize_global_memory_segments(){
 
-#ifndef HAVE_PRIVATIZATION
+#if !HAVE_PRIVATIZATION
   smpi_privatize_global_variables=0;
   xbt_die("You are trying to use privatization on a system that does not support it. Don't.");
   return;
@@ -712,7 +712,7 @@ Ask the Internet about tutorials on how to increase the files limit such as: htt
 void smpi_destroy_global_memory_segments(){
   if (smpi_size_data_exe == 0)//no need to switch
     return;
-#ifdef HAVE_PRIVATIZATION
+#if HAVE_PRIVATIZATION
   int i;
   for (i=0; i< smpi_process_count(); i++){
     if(munmap(smpi_privatisation_regions[i].address, smpi_size_data_exe) < 0) {
index 478f234..c5d9142 100644 (file)
@@ -68,7 +68,7 @@ double smpi_get_host_consumed_energy(void) {
   return sg_host_get_consumed_energy(SIMIX_host_self());
 }
 
-#ifdef SMPI_FORTRAN
+#if SMPI_FORTRAN
 
 #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
 typedef int integer;
index d16f7c9..8226352 100644 (file)
@@ -103,7 +103,7 @@ s_surf_model_description_t surf_storage_model_description[] = {
   {NULL, NULL,  NULL}      /* this array must be NULL terminated */
 };
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
 static xbt_parmap_t surf_parmap = NULL; /* parallel map on models */
 #endif
 
@@ -342,7 +342,7 @@ void surf_exit(void)
     future_evt_set = nullptr;
   }
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   xbt_parmap_destroy(surf_parmap);
 #endif
 
index da2a760..4580e33 100644 (file)
@@ -529,7 +529,7 @@ char *xbt_automaton_parser_text;
 #line 10 "parserPromela.lex"
 
 #include "simgrid_config.h"
-#ifndef HAVE_UNISTD_H
+#if !HAVE_UNISTD_H
 #define YY_NO_UNISTD_H /* hello Windows */
 
 #ifdef _MSC_VER
index b93895b..b0dd1eb 100644 (file)
@@ -9,7 +9,7 @@
 %{
 
 #include "simgrid_config.h"
-#ifndef HAVE_UNISTD_H
+#if !HAVE_UNISTD_H
 #define YY_NO_UNISTD_H /* hello Windows */
 
 #ifdef _MSC_VER
index 46e1170..52a2cea 100644 (file)
@@ -73,7 +73,7 @@
 #line 7 "parserPromela.yacc" /* yacc.c:339  */
 
 #include "simgrid_config.h"
-#ifndef HAVE_UNISTD_H
+#if !HAVE_UNISTD_H
 #define YY_NO_UNISTD_H /* hello Windows */
 #endif
 
index d5789f0..b96bc93 100644 (file)
@@ -6,7 +6,7 @@
 
 %{
 #include "simgrid_config.h"
-#ifndef HAVE_UNISTD_H
+#if !HAVE_UNISTD_H
 #define YY_NO_UNISTD_H /* hello Windows */
 #endif
 
index 7db2ce5..f5050cc 100644 (file)
@@ -57,7 +57,7 @@
 #include "simgrid/simix.h" /* SIMIX_process_self_get_name() */
 
 #undef HAVE_BACKTRACE
-#if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
+#if HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
 # define HAVE_BACKTRACE 1       /* Hello linux box */
 #endif
 
@@ -120,7 +120,7 @@ void xbt_backtrace_display_current(void)
   xbt_backtrace_display(&e);
 }
 
-#if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
+#if HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
 # include "src/xbt/backtrace_linux.c"
 #else
 # include "src/xbt/backtrace_dummy.c"
index 031bb3e..d395c8d 100644 (file)
@@ -12,7 +12,7 @@
 
 /* Copyright 1996, 2000 Free Software Foundation  */
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>             /* Prototypes for lseek, sbrk (maybe) */
 #endif
 #include "mfree.c"
index fea22d3..8d3b0d0 100644 (file)
@@ -32,7 +32,7 @@
 #include <fcntl.h>              /* After sys/types.h, at least for dpx/2.  */
 #include <sys/stat.h>
 #include <string.h>
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>             /* Prototypes for lseek */
 #endif
 #include "mmprivate.h"
index e78ba90..c80e74f 100644 (file)
@@ -11,7 +11,7 @@
    Contributed by Fred Fish at Cygnus Support.   fnf@cygnus.com */
 
 #include "src/internal_config.h"
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>             /* Prototypes for lseek */
 #endif
 #include <stdio.h>
index 1df0bf7..f574884 100644 (file)
@@ -7,7 +7,7 @@
 #include <atomic>
 
 #include "src/internal_config.h"
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
@@ -15,7 +15,7 @@
 #include <sys/syscall.h>
 #endif
 
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
 #include <linux/futex.h>
 #include <limits.h>
 #endif
@@ -45,7 +45,7 @@ static void xbt_parmap_posix_worker_signal(xbt_parmap_t parmap);
 static void xbt_parmap_posix_master_signal(xbt_parmap_t parmap);
 static void xbt_parmap_posix_worker_wait(xbt_parmap_t parmap, unsigned round);
 
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
 static void xbt_parmap_futex_master_wait(xbt_parmap_t parmap);
 static void xbt_parmap_futex_worker_signal(xbt_parmap_t parmap);
 static void xbt_parmap_futex_master_signal(xbt_parmap_t parmap);
@@ -131,7 +131,7 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode)
   /* Create the pool of worker threads */
   xbt_parmap_thread_data_t data;
   parmap->workers[0] = NULL;
-#ifdef HAVE_PTHREAD_SETAFFINITY
+#if HAVE_PTHREAD_SETAFFINITY
   int core_bind = 0;
 #endif  
   for (unsigned int i = 1; i < num_workers; i++) {
@@ -139,7 +139,7 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode)
     data->parmap = parmap;
     data->worker_id = i;
     parmap->workers[i] = xbt_os_thread_create(NULL, xbt_parmap_worker_main, data, NULL);
-#ifdef HAVE_PTHREAD_SETAFFINITY
+#if HAVE_PTHREAD_SETAFFINITY
     xbt_os_thread_bind(parmap->workers[i], core_bind); 
     if (core_bind != xbt_os_get_numcores())
       core_bind++;
@@ -219,7 +219,7 @@ void xbt_parmap_destroy(xbt_parmap_t parmap)
 static void xbt_parmap_set_mode(xbt_parmap_t parmap, e_xbt_parmap_mode_t mode)
 {
   if (mode == XBT_PARMAP_DEFAULT) {
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
     mode = XBT_PARMAP_FUTEX;
 #else
     mode = XBT_PARMAP_POSIX;
@@ -243,7 +243,7 @@ static void xbt_parmap_set_mode(xbt_parmap_t parmap, e_xbt_parmap_mode_t mode)
 
 
     case XBT_PARMAP_FUTEX:
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
       parmap->master_wait_f = xbt_parmap_futex_master_wait;
       parmap->worker_signal_f = xbt_parmap_futex_worker_signal;
       parmap->master_signal_f = xbt_parmap_futex_master_signal;
@@ -439,7 +439,7 @@ static void *xbt_parmap_mc_worker_main(void *arg)
 }
 #endif
 
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
 static void futex_wait(unsigned *uaddr, unsigned val)
 {
   XBT_VERB("Waiting on futex %p", uaddr);
@@ -524,7 +524,7 @@ static void xbt_parmap_posix_worker_wait(xbt_parmap_t parmap, unsigned round)
   xbt_os_mutex_release(parmap->ready_mutex);
 }
 
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
 /**
  * \brief Starts the parmap: waits for all workers to be ready and returns.
  *
index 148a593..426d0bb 100644 (file)
@@ -53,7 +53,7 @@
 #include "src/internal_config.h"  /* Do we need vasprintf? */
 #include <stdio.h>
 
-#if !defined(HAVE_VASPRINTF)
+#if !HAVE_VASPRINTF
 #include <stdarg.h> /* vsnprintf */
 int vasprintf(char **ptr, const char *fmt, va_list ap);
 int vasprintf(char **ptr, const char *fmt, va_list ap)
index 82f8141..9a56875 100644 (file)
@@ -6,9 +6,10 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "src/internal_config.h"
 #include "xbt/sysdep.h"
 #include "src/xbt/log_private.h"
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 #include "src/smpi/private.h" // to access bench_begin/end. Not ultraclean, I confess
 #endif
 #include <stdio.h>
@@ -26,7 +27,7 @@ static void free_(xbt_log_appender_t this_) {
     fclose(this_->data);
 }
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 void __smpi_bench_dont (void); // Stupid prototype
 void __smpi_bench_dont (void) { /* I'm only a place-holder in case we link without SMPI */; }
 void smpi_bench_begin(void) __attribute__ ((weak, alias ("__smpi_bench_dont")));
index d1931aa..372ed4e 100644 (file)
@@ -160,7 +160,7 @@ static int xbt_log_layout_format_doit(xbt_log_layout_t l,
         break;
       case 'b':                 /* backtrace; called %throwable in LOG4J */
       case 'B':         /* short backtrace; called %throwable{short} in LOG4J */
-#if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
+#if HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
         {
           xbt_ex_t e;
 
index be770f2..ec1bddf 100644 (file)
@@ -27,7 +27,7 @@
 #ifdef _WIN32
 #include <signal.h> /* To silence MSVC on abort() */
 #endif
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
 
@@ -88,12 +88,14 @@ static BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserv
 
 static void xbt_preinit(void) {
   unsigned int seed = 2147483647;
-#ifndef _WIN32
-  xbt_pagesize = sysconf(_SC_PAGESIZE);
-#else
+#ifdef _WIN32
   SYSTEM_INFO si;
   GetSystemInfo(&si);
   xbt_pagesize = si.dwPageSize;
+#elif HAVE_SYSCONF
+  xbt_pagesize = sysconf(_SC_PAGESIZE);
+#else
+  #error Cannot get page size.
 #endif
 
   xbt_pagebits = 0;
index 1003575..d5d9739 100644 (file)
@@ -9,7 +9,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/internal_config.h"
-#ifdef HAVE_PTHREAD_SETAFFINITY
+#if HAVE_PTHREAD_SETAFFINITY
 #define _GNU_SOURCE
 #include <sched.h>
 #endif
@@ -46,7 +46,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_os, xbt, "Synchronization mechanism (OS
 
 
 /* use named sempahore when sem_init() does not work */
-#ifndef HAVE_SEM_INIT
+#if !HAVE_SEM_INIT
 static int next_sem_ID = 0;
 static xbt_os_mutex_t next_sem_ID_lock;
 #endif
@@ -124,7 +124,7 @@ void xbt_os_thread_mod_preinit(void)
 
   thread_mod_inited = 1;
 
-#ifndef HAVE_SEM_INIT
+#if !HAVE_SEM_INIT
   next_sem_ID_lock = xbt_os_mutex_init();
 #endif
 }
@@ -141,7 +141,7 @@ void xbt_os_thread_mod_postexit(void)
   free(main_thread);
   main_thread = NULL;
   thread_mod_inited = 0;
-#ifndef HAVE_SEM_INIT
+#if !HAVE_SEM_INIT
   xbt_os_mutex_destroy(next_sem_ID_lock);
 #endif
 
@@ -200,7 +200,7 @@ xbt_os_thread_t xbt_os_thread_create(const char *name,  pvoid_f_pvoid_t start_ro
  */
 int xbt_os_thread_bind(xbt_os_thread_t thread, int cpu){
   int errcode = 0;
-#ifdef HAVE_PTHREAD_SETAFFINITY
+#if HAVE_PTHREAD_SETAFFINITY
   pthread_t pthread = thread->t;
   cpu_set_t cpuset;
   CPU_ZERO(&cpuset);
@@ -399,7 +399,7 @@ void xbt_os_cond_destroy(xbt_os_cond_t cond)
 }
 
 typedef struct xbt_os_sem_ {
-#ifndef HAVE_SEM_INIT
+#if !HAVE_SEM_INIT
   char *name;
 #endif
   sem_t s;
@@ -418,7 +418,7 @@ xbt_os_sem_t xbt_os_sem_init(unsigned int value)
    * Any attempt to use it leads to ENOSYS (function not implemented).
    * If such a prehistoric system is detected, do the job with sem_open instead
    */
-#ifdef HAVE_SEM_INIT
+#if HAVE_SEM_INIT
   if (sem_init(&(res->s), 0, value) != 0)
     THROWF(system_error, errno, "sem_init() failed: %s", strerror(errno));
   res->ps = &(res->s);
@@ -462,7 +462,7 @@ void xbt_os_sem_release(xbt_os_sem_t sem)
 
 void xbt_os_sem_destroy(xbt_os_sem_t sem)
 {
-#ifdef HAVE_SEM_INIT
+#if HAVE_SEM_INIT
   if (sem_destroy(sem->ps) < 0)
     THROWF(system_error, errno, "sem_destroy() failed: %s",
            strerror(errno));
index 204d357..0994708 100644 (file)
@@ -40,7 +40,7 @@
 
 double xbt_os_time(void)
 {
-#ifdef HAVE_GETTIMEOFDAY
+#if HAVE_GETTIMEOFDAY
   struct timeval tv;
   gettimeofday(&tv, NULL);
 #elif defined(_WIN32)
@@ -96,9 +96,9 @@ void xbt_os_sleep(double sec)
 
 
 struct s_xbt_os_timer {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   struct timespec start, stop, elapse;
-#elif defined(HAVE_GETTIMEOFDAY) || defined(_WIN32)
+#elif HAVE_GETTIMEOFDAY || defined(_WIN32)
   struct timeval start, stop, elapse;
 #else
   unsigned long int start, stop, elapse;
@@ -121,12 +121,12 @@ void xbt_os_timer_free(xbt_os_timer_t timer)
 
 double xbt_os_timer_elapsed(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   return ((double) timer->stop.tv_sec) - ((double) timer->start.tv_sec) +
                                           ((double) timer->elapse.tv_sec ) +
       ((((double) timer->stop.tv_nsec) -
         ((double) timer->start.tv_nsec) + ((double) timer->elapse.tv_nsec )) / 1e9);
-#elif defined(HAVE_GETTIMEOFDAY) || defined(_WIN32)
+#elif HAVE_GETTIMEOFDAY || defined(_WIN32)
   return ((double) timer->stop.tv_sec) - ((double) timer->start.tv_sec)
     + ((double) timer->elapse.tv_sec ) +
       ((((double) timer->stop.tv_usec) -
@@ -139,11 +139,11 @@ double xbt_os_timer_elapsed(xbt_os_timer_t timer)
 
 void xbt_os_walltimer_start(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_nsec = 0;
   clock_gettime(CLOCK_REALTIME, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_usec = 0;
   gettimeofday(&(timer->start), NULL);
@@ -169,12 +169,12 @@ void xbt_os_walltimer_start(xbt_os_timer_t timer)
 
 void xbt_os_walltimer_resume(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
 
    timer->elapse.tv_nsec += timer->stop.tv_nsec - timer->start.tv_nsec;
   clock_gettime(CLOCK_REALTIME, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_usec += timer->stop.tv_usec - timer->start.tv_usec;
   gettimeofday(&(timer->start), NULL);
@@ -200,9 +200,9 @@ void xbt_os_walltimer_resume(xbt_os_timer_t timer)
 
 void xbt_os_walltimer_stop(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   clock_gettime(CLOCK_REALTIME, &(timer->stop));
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   gettimeofday(&(timer->stop), NULL);
 #elif defined(_WIN32)
   FILETIME ft;
@@ -223,11 +223,11 @@ void xbt_os_walltimer_stop(xbt_os_timer_t timer)
 
 void xbt_os_cputimer_start(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_nsec = 0;
   clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY)//return time and not cputime in this case
+#elif HAVE_GETTIMEOFDAY //return time and not cputime in this case
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_usec = 0;
   gettimeofday(&(timer->start), NULL);
@@ -251,11 +251,11 @@ void xbt_os_cputimer_start(xbt_os_timer_t timer)
 
 void xbt_os_cputimer_resume(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_nsec += timer->stop.tv_nsec - timer->start.tv_nsec;
   clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_usec += timer->stop.tv_usec - timer->start.tv_usec;
   gettimeofday(&(timer->start), NULL);
@@ -279,9 +279,9 @@ void xbt_os_cputimer_resume(xbt_os_timer_t timer)
 
 void xbt_os_cputimer_stop(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(timer->stop));
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   gettimeofday(&(timer->stop), NULL);
 #elif defined(_WIN32)
   HANDLE h = GetCurrentProcess();
@@ -301,11 +301,11 @@ void xbt_os_cputimer_stop(xbt_os_timer_t timer)
 
 void xbt_os_threadtimer_start(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_nsec = 0;
   clock_gettime(CLOCK_THREAD_CPUTIME_ID, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY) && defined(__MACH__) && defined(__APPLE__)
+#elif HAVE_GETTIMEOFDAY && defined(__MACH__) && defined(__APPLE__)
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_usec = 0;
   mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
@@ -314,7 +314,7 @@ void xbt_os_threadtimer_start(xbt_os_timer_t timer)
   thread_info(mach_thread_self(), THREAD_BASIC_INFO, (thread_info_t)thi, &count);
   timer->start.tv_usec =  thi->system_time.microseconds + thi->user_time.microseconds;
   timer->start.tv_sec = thi->system_time.seconds + thi->user_time.seconds;
-#elif defined(HAVE_GETTIMEOFDAY)//return time and not cputime in this case
+#elif HAVE_GETTIMEOFDAY //return time and not cputime in this case
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_usec = 0;
   gettimeofday(&(timer->start), NULL);
@@ -336,11 +336,11 @@ void xbt_os_threadtimer_start(xbt_os_timer_t timer)
 
 void xbt_os_threadtimer_resume(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_nsec += timer->stop.tv_nsec - timer->start.tv_nsec;
   clock_gettime(CLOCK_THREAD_CPUTIME_ID, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY) && defined(__MACH__) && defined(__APPLE__)
+#elif HAVE_GETTIMEOFDAY && defined(__MACH__) && defined(__APPLE__)
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_usec += timer->stop.tv_usec - timer->start.tv_usec;
   mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
@@ -349,7 +349,7 @@ void xbt_os_threadtimer_resume(xbt_os_timer_t timer)
   thread_info(mach_thread_self(), THREAD_BASIC_INFO, (thread_info_t)thi, &count);
   timer->start.tv_usec =  thi->system_time.microseconds + thi->user_time.microseconds;
   timer->start.tv_sec = thi->system_time.seconds + thi->user_time.seconds;
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_usec += timer->stop.tv_usec - timer->start.tv_usec;
   gettimeofday(&(timer->start), NULL);
@@ -373,16 +373,16 @@ void xbt_os_threadtimer_resume(xbt_os_timer_t timer)
 
 void xbt_os_threadtimer_stop(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   clock_gettime(CLOCK_THREAD_CPUTIME_ID, &(timer->stop));
-#elif defined(HAVE_GETTIMEOFDAY) && defined(__MACH__) && defined(__APPLE__)
+#elif HAVE_GETTIMEOFDAY && defined(__MACH__) && defined(__APPLE__)
   mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
   thread_basic_info_data_t thi_data;
   thread_basic_info_t thi = &thi_data;
   thread_info(mach_thread_self(), THREAD_BASIC_INFO, (thread_info_t)thi, &count);
   timer->stop.tv_usec =  thi->system_time.microseconds + thi->user_time.microseconds;
   timer->stop.tv_sec = thi->system_time.seconds + thi->user_time.seconds;
-#elif defined(HAVE_GETTIMEOFDAY)//if nothing else is available, return just time
+#elif HAVE_GETTIMEOFDAY //if nothing else is available, return just time
   gettimeofday(&(timer->stop), NULL);
 #elif defined(_WIN32)
   HANDLE h = GetCurrentThread();
index e635574..f21cb3a 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <stdio.h>
 #include "src/internal_config.h"
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
 
index f160c5d..2a92994 100644 (file)
@@ -19,7 +19,7 @@
 #include <string.h>
 #include <assert.h>
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index 2e96a9e..61ee87a 100644 (file)
@@ -5,7 +5,7 @@
  */
 #include "mpi.h"
 #include "mpitestconf.h"
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <stdio.h>
index c0dc769..7b59c90 100644 (file)
@@ -23,7 +23,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index ef67050..304ac47 100644 (file)
@@ -19,7 +19,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index 8bf5427..288be5d 100644 (file)
@@ -19,7 +19,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index 62315ed..662cbc8 100644 (file)
@@ -19,7 +19,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index bb95b77..82a3ec2 100644 (file)
@@ -23,7 +23,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index f1373fb..2690692 100644 (file)
@@ -23,7 +23,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index b73e0b1..de148a0 100644 (file)
@@ -46,7 +46,7 @@ static const char *parmap_mode_name(e_xbt_parmap_mode_t mode)
 static int parmap_skip_mode(e_xbt_parmap_mode_t mode)
 {
   switch (mode) {
-#ifndef HAVE_FUTEX_H
+#if !HAVE_FUTEX_H
   case XBT_PARMAP_FUTEX:
     printf("not available\n");
     return 1;
index 76ac002..e2d5faf 100644 (file)
@@ -120,7 +120,7 @@ int main(int argc, char** argv)
   XBT_INFO("Basic testing posix");
   status += test_parmap_basic(XBT_PARMAP_POSIX);
   XBT_INFO("Basic testing futex");
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
   status += test_parmap_basic(XBT_PARMAP_FUTEX);
 #endif
   XBT_INFO("Basic testing busy wait");
@@ -129,7 +129,7 @@ int main(int argc, char** argv)
   XBT_INFO("Extended testing posix");
   status += test_parmap_extended(XBT_PARMAP_POSIX);
   XBT_INFO("Extended testing futex");
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
   status += test_parmap_extended(XBT_PARMAP_FUTEX);
 #endif
   XBT_INFO("Extended testing busy wait");
index 3af7168..20aefcf 100644 (file)
@@ -9,28 +9,28 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* Non-standard header files */
-#cmakedefine HAVE_EXECINFO_H @HAVE_EXECINFO_H@ /* <execinfo.h> */
-#cmakedefine HAVE_FUTEX_H    @HAVE_FUTEX_H@ /* <linux/futex.h> */
-#cmakedefine HAVE_SIGNAL_H   @HAVE_SIGNAL_H@ /* <signal.h> */
-#cmakedefine HAVE_UNISTD_H   @HAVE_UNISTD_H@ /* <unistd.h> */
-#cmakedefine HAVE_UCONTEXT_H @HAVE_UCONTEXT_H@ /* <ucontext.h> */
-#cmakedefine HAVE_VALGRIND_H @HAVE_VALGRIND_H@ /* <valgrind/valgrind.h> */
+#define HAVE_EXECINFO_H @HAVE_EXECINFO_H@ /* <execinfo.h> */
+#define HAVE_FUTEX_H    @HAVE_FUTEX_H@ /* <linux/futex.h> */
+#define HAVE_SIGNAL_H   @HAVE_SIGNAL_H@ /* <signal.h> */
+#define HAVE_UNISTD_H   @HAVE_UNISTD_H@ /* <unistd.h> */
+#define HAVE_UCONTEXT_H @HAVE_UCONTEXT_H@ /* <ucontext.h> */
+#define HAVE_VALGRIND_H @HAVE_VALGRIND_H@ /* <valgrind/valgrind.h> */
 
 /* Time portability */
-#cmakedefine HAVE_GETTIMEOFDAY  @HAVE_GETTIMEOFDAY@ /* Function gettimeofday */
-#cmakedefine HAVE_POSIX_GETTIME @HAVE_POSIX_GETTIME@ /* Function clock_gettime */
-#cmakedefine HAVE_NANOSLEEP     @HAVE_NANOSLEEP@ /* Function nanosleep */
+#define HAVE_GETTIMEOFDAY  @HAVE_GETTIMEOFDAY@ /* Function gettimeofday */
+#define HAVE_POSIX_GETTIME @HAVE_POSIX_GETTIME@ /* Function clock_gettime */
+#define HAVE_NANOSLEEP     @HAVE_NANOSLEEP@ /* Function nanosleep */
 
 /* The usable context factories */
-#cmakedefine HAVE_BOOST_CONTEXTS    @HAVE_BOOST_CONTEXTS@
-#cmakedefine HAVE_RAW_CONTEXTS      @HAVE_RAW_CONTEXTS@
-#cmakedefine HAVE_THREAD_CONTEXTS   @HAVE_THREAD_CONTEXTS@
-#cmakedefine HAVE_UCONTEXT_CONTEXTS @HAVE_UCONTEXT_CONTEXTS@
+#define HAVE_BOOST_CONTEXTS    @HAVE_BOOST_CONTEXTS@
+#define HAVE_RAW_CONTEXTS      @HAVE_RAW_CONTEXTS@
+#define HAVE_THREAD_CONTEXTS   @HAVE_THREAD_CONTEXTS@
+#define HAVE_UCONTEXT_CONTEXTS @HAVE_UCONTEXT_CONTEXTS@
 
 /* Variables for the thread contexts (and parallel mode of raw contexts) */
-#cmakedefine HAVE_PTHREAD              @HAVE_PTHREAD@ /* Define to 1 if threads are usable . */
-#cmakedefine HAVE_PTHREAD_SETAFFINITY  @HAVE_PTHREAD_SETAFFINITY@ /* Does not seems defined on Mac nor Windows */
-#cmakedefine HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@ /* If __thread is available */
+#define HAVE_PTHREAD              @HAVE_PTHREAD@ /* Define to 1 if threads are usable . */
+#define HAVE_PTHREAD_SETAFFINITY  @HAVE_PTHREAD_SETAFFINITY@ /* Does not seems defined on Mac nor Windows */
+#define HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@ /* If __thread is available */
 
 /* Variables for the raw contexts (to select the right assembly code) */
 #cmakedefine PROCESSOR_i686         @PROCESSOR_i686@
 #cmakedefine PTH_STACKGROWTH @PTH_STACKGROWTH@ /* Does the stack growth upward, or downward? */
 
 /* MC variables */
-#cmakedefine HAVE_GETDTABLESIZE    @HAVE_GETDTABLESIZE@ /* getdtablesize: get descriptor table size */
-#cmakedefine HAVE_MMALLOC          @HAVE_MMALLOC@ /* Did we compile mmalloc in? */
-#cmakedefine HAVE_PROCESS_VM_READV @HAVE_PROCESS_VM_READV@ /* process_vm_readv: transfer data between process address spaces */
-#cmakedefine HAVE_MC               @HAVE_MC@ /* Set to true if enable_model-checking is true and the dependencies available */
+#define HAVE_GETDTABLESIZE    @HAVE_GETDTABLESIZE@ /* getdtablesize: get descriptor table size */
+#define HAVE_MMALLOC          @HAVE_MMALLOC@ /* Did we compile mmalloc in? */
+#define HAVE_PROCESS_VM_READV @HAVE_PROCESS_VM_READV@ /* process_vm_readv: transfer data between process address spaces */
+#define HAVE_MC               @HAVE_MC@ /* Set to true if enable_model-checking is true and the dependencies available */
 
 /* SMPI variables */
-#cmakedefine HAVE_SMPI          @HAVE_SMPI@
-#cmakedefine SMPI_FORTRAN       @SMPI_FORTRAN@
-#cmakedefine HAVE_PRIVATIZATION @HAVE_PRIVATIZATION@ /* We have mmap and objdump to handle privatization */
+#define HAVE_SMPI          @HAVE_SMPI@
+#define SMPI_FORTRAN       @SMPI_FORTRAN@
+#define HAVE_PRIVATIZATION @HAVE_PRIVATIZATION@ /* We have mmap and objdump to handle privatization */
 
 /* Other function checks */
-#cmakedefine HAVE_MMAP      @HAVE_MMAP@ /* Function mmap */
-#cmakedefine HAVE_SEM_INIT  @HAVE_SEM_INIT@ /* Function sem_init (part of XPG6 standard only) */
-#cmakedefine HAVE_POPEN     @HAVE_POPEN@ /* Function popen */
-#cmakedefine HAVE_SYSCONF   @HAVE_SYSCONF@ /* Function sysconf */
-#cmakedefine HAVE_VASPRINTF @HAVE_VASPRINTF@ /* Function vasprintf */
+#define HAVE_MMAP      @HAVE_MMAP@ /* Function mmap */
+#define HAVE_SEM_INIT  @HAVE_SEM_INIT@ /* Function sem_init (part of XPG6 standard only) */
+#define HAVE_POPEN     @HAVE_POPEN@ /* Function popen */
+#define HAVE_SYSCONF   @HAVE_SYSCONF@ /* Function sysconf */
+#define HAVE_VASPRINTF @HAVE_VASPRINTF@ /* Function vasprintf */
 
 /* Other checks */
 #cmakedefine ADDR2LINE       "@ADDR2LINE@" /* Path to the addr2line tool */