unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* MIN macro in numbers.c causes build problems on HP-UX
@ 2004-04-25 15:04 Andreas Vögele
  2004-04-26  2:00 ` Kevin Ryde
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Vögele @ 2004-04-25 15:04 UTC (permalink / raw)


On HP-UX, the macros MIN and MAX are defined in sys/param.h which is
included by limits.h.  There's an unconditional definition of MIN in
the CVS version of numbers.c which clashes with HP's definition.
Here's the error message:

./guile-snarf -o numbers.x numbers.c -DHAVE_CONFIG_H
-I.. -I.. -I../libguile-ltdl -g -fno-strict-aliasing -Wall
-Wmissing-prototypes -Werror
numbers.c:1797:1: "MIN" redefined
[...]
/usr/include/sys/param.h:420:1: this is the location of the previous
definition

I suggest to remove the MIN macro from numbers.c.  Instead, the lower
case macro min, which is definded in _scm.h anyway, can be used.
I'm wondering why the MIN macro was introduced at all.

Here's a patch:

Index: numbers.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/numbers.c,v
retrieving revision 1.238
diff -u -r1.238 numbers.c
--- numbers.c	22 Apr 2004 01:21:39 -0000	1.238
+++ numbers.c	25 Apr 2004 14:48:23 -0000
@@ -1794,8 +1794,6 @@
 #undef FUNC_NAME
 
 
-#define MIN(x,y)  ((x) < (y) ? (x) : (y))
-
 SCM_DEFINE (scm_bit_extract, "bit-extract", 3, 0, 0,
             (SCM n, SCM start, SCM end),
 	    "Return the integer composed of the @var{start} (inclusive)\n"
@@ -1824,7 +1822,7 @@
 
       /* When istart>=SCM_I_FIXNUM_BIT we can just limit the shift to
          SCM_I_FIXNUM_BIT-1 to get either 0 or -1 per the sign of "in". */
-      in = SCM_SRS (in, MIN (istart, SCM_I_FIXNUM_BIT-1));
+      in = SCM_SRS (in, min (istart, SCM_I_FIXNUM_BIT-1));
 
       if (in < 0 && bits >= SCM_I_FIXNUM_BIT)
 	{
@@ -1839,7 +1837,7 @@
 	}
 
       /* mask down to requisite bits */
-      bits = MIN (bits, SCM_I_FIXNUM_BIT);
+      bits = min (bits, SCM_I_FIXNUM_BIT);
       return SCM_MAKINUM (in & ((1L << bits) - 1));
     }
   else if (SCM_BIGP (n))


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-26  2:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-25 15:04 MIN macro in numbers.c causes build problems on HP-UX Andreas Vögele
2004-04-26  2:00 ` Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).