INT_MAX definition in gmp-impl.h conflicts with limits.h

Vincent Lefevre vincent at vinc17.net
Tue Nov 22 02:08:36 CET 2011


On 2011-11-22 01:29:42 +0100, Marc Glisse wrote:
> On Tue, 22 Nov 2011, Vincent Lefevre wrote:
> 
> >On 2011-11-21 20:26:06 +0100, Marc Glisse wrote:
> >>Hello,
> >>
> >>I was compiling gmp with clang (no issue except for the use of jb,pt in
> >>mpn/x86_64/mod_34lsub1.asm), and then I ran the testsuite and hit this
> >>issue: on linux, limits.h includes bits/xopen_lim.h which contains this
> >>code:
> >>
> >>#ifdef INT_MAX
> >># if INT_MAX == 32767
> >>#  define WORD_BIT      16
> >>...
> >>
> >>On the other hand, gmp-impl.h defines INT_MAX as something not
> >>preprocessor-friendly (with casts). The combination doesn't work.
> >
> >We had similar problems too between MPFR and gmp-impl.h in the past.
> >The answer by Torbjorn was that gmp-impl.h is a GMP internal and
> >mustn't be included by users.
> 
> Er, ok, but that doesn't tell me how to make the GMP testsuite pass (I am
> not talking about external use).

But neither GMP, nor its testsuite is supposed to include <limits.h>
(that's why GMP has all these kinds of hacks). Then, why do you get
an error with limits.h?

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list