unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Andreas Vögele" <voegelas@gmx.net>
Subject: MIN macro in numbers.c causes build problems on HP-UX
Date: Sun, 25 Apr 2004 17:04:02 +0200	[thread overview]
Message-ID: <m2r7ucgkv1.fsf@ID-28718.user.uni-berlin.de> (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


             reply	other threads:[~2004-04-25 15:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-25 15:04 Andreas Vögele [this message]
2004-04-26  2:00 ` MIN macro in numbers.c causes build problems on HP-UX Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2r7ucgkv1.fsf@ID-28718.user.uni-berlin.de \
    --to=voegelas@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).