[PATCH] util.h: define MIN macro only if it is not yet defined

andre.sintzoff at gmail.com andre.sintzoff at gmail.com
Sun Jan 21 14:40:23 UTC 2018


# HG changeset patch
# User André Sintzoff <andre.sintzoff at gmail.com>
# Date 1516545588 -3600
#      Sun Jan 21 15:39:48 2018 +0100
# Node ID 6330959c35f4128ed9b7b8d61b400251ecf2475a
# Parent  5f5fb279fd394c117fb64a95ad7fd1e4db72951d
util.h: define MIN macro only if it is not yet defined.

MIN macro is defined in <sys/param.h> on macOS Sierra.
Therefore as HAVE_BSD_STATFS is defined in osutil.c,
'MIN' macro redefined warning is emitted.

diff -r 5f5fb279fd39 -r 6330959c35f4 mercurial/cext/util.h
--- a/mercurial/cext/util.h	Thu Jan 18 00:50:12 2018 +0100
+++ b/mercurial/cext/util.h	Sun Jan 21 15:39:48 2018 +0100
@@ -27,7 +27,9 @@
 extern PyTypeObject dirstateTupleType;
 #define dirstate_tuple_check(op) (Py_TYPE(op) == &dirstateTupleType)
 
+#ifndef MIN
 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
 /* VC9 doesn't include bool and lacks stdbool.h based on my searching */
 #if defined(_MSC_VER) || __STDC_VERSION__ < 199901L
 #define true 1


More information about the Mercurial-devel mailing list