Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
do not define MIN() and MAX() in xbt/base.h to not polute our mpi.h
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 17 Apr 2018 15:07:39 +0000 (17:07 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 17 Apr 2018 15:07:39 +0000 (17:07 +0200)
include/simgrid/msg.h
include/simgrid/simdag.h
include/xbt/base.h
src/simdag/simdag_private.hpp
src/xbt/log.c
src/xbt/mallocator.c
src/xbt/mmalloc/mmprivate.h
src/xbt/xbt_log_layout_format.c

index 74d1edb..9f7d0cd 100644 (file)
 #include <simgrid/zone.h>
 #include <xbt.h>
 
+#ifdef MIN
+#undef MIN
+#endif
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+#ifdef MAX
+#undef MAX
+#endif
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 #ifdef __cplusplus
 #include <map>
 #include <simgrid/simix.h>
index cb54bd9..766fe1e 100644 (file)
 #include <set>
 #endif
 
+#ifdef MIN
+#undef MIN
+#endif
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+#ifdef MAX
+#undef MAX
+#endif
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 SG_BEGIN_DECL()
 
 /** @brief Link opaque datatype
index e8537c0..f4de224 100644 (file)
 #  define XBT_THREAD_LOCAL No thread local on this architecture
 #endif
 
-/* improvable on gcc (by evaluating arguments only once), but wouldn't be portable */
-#ifdef MIN
-#  undef MIN
-#endif
-#define MIN(a,b) ((a)<(b)?(a):(b))
-
-#ifdef MAX
-#  undef MAX
-#endif
-#define MAX(a,b) ((a)>(b)?(a):(b))
-
 /*
  * Expands to `one' if there is only one argument for the variadic part.
  * Otherwise, expands to `more'.
index fc9403f..66810f7 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2006-2018. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
index 7365993..eee33f2 100644 (file)
@@ -24,6 +24,9 @@
 #include "xbt/sysdep.h"
 #include "xbt/xbt_os_thread.h"
 
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 int xbt_log_no_loc = 0; /* if set to true (with --log=no_loc), file localization will be omitted (for tesh tests) */
 static xbt_os_mutex_t log_cat_init_mutex = NULL;
 
index ee6a253..77a6915 100644 (file)
@@ -13,6 +13,9 @@
 #include "xbt/asserts.h"
 #include "xbt/sysdep.h"
 
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_mallocator, xbt, "Mallocators");
 
 /** Implementation note on the mallocators:
index 4854410..dcf8c4e 100644 (file)
@@ -26,6 +26,9 @@
 #include <pthread.h>
 #include <stdint.h>
 
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 #ifdef HAVE_LIMITS_H
 #  include <limits.h>
 #else
index 3e711bb..7aa6071 100644 (file)
@@ -11,6 +11,9 @@
 #include "xbt/sysdep.h"
 #include <stdio.h>
 
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 extern const char *xbt_log_priority_names[8];
 
 #define ERRMSG                                                          \