This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Prevent multiple definition of MIN/MAX
- From: "Paul E. Murphy" <murphyp at linux dot vnet dot ibm dot com>
- To: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Cc: Joseph Myers <joseph at codesourcery dot com>, Tulio Magno Quites Machado Filho <tuliom at linux dot vnet dot ibm dot com>, Carlos Eduardo Seo <cseo at linux dot vnet dot ibm dot com>
- Date: Tue, 17 Nov 2015 11:20:42 -0600
- Subject: [PATCH] Prevent multiple definition of MIN/MAX
- Authentication-results: sourceware.org; auth=none
Some recent changes caused a redefinition and error when these
are unconditionally defined. Such was caused by gmp-impl.h being
included prior.
2015-11-17 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* misc/sys/param.h (MIN): Guard against an outside definition.
(MAX): Likewise.
---
misc/sys/param.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/misc/sys/param.h b/misc/sys/param.h
index 1908b93..42aa434 100644
--- a/misc/sys/param.h
+++ b/misc/sys/param.h
@@ -99,8 +99,12 @@
#define powerof2(x) ((((x) - 1) & (x)) == 0)
/* Macros for min/max. */
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
+#ifndef MIN
+# define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+#ifndef MAX
+# define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
#endif /* sys/param.h */
--
2.4.3