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

Marc Glisse marc.glisse at
Wed Nov 23 15:35:33 CET 2011

On Wed, 23 Nov 2011, Vincent Lefevre wrote:

> On 2011-11-23 14:48:32 +0100, Torbjorn Granlund wrote:
>> Marc Glisse <marc.glisse at> writes:
>>   For now we could work around the problem by including tests.h before
>>   gmp-impl.h, and postpone thinking about this until that breaks
>>   too. But I wanted to check if you had a better idea.
>> OK.
>> I support ugly hacks in the GMP test suite, while we of course want to
>> keep the GMP lib code as clean as possible...
> Are you sure that this works with every other platforms, configure
> options and so on?
> I'm wondering... tests/tests.h has:
> where HAVE_CALLING_CONVENTIONS can be defined in config.h, which is
> included from gmp-impl.h. So, I would say that tests/tests.h depends
> on gmp-impl.h, so that including tests.h before gmp-impl.h could
> yield an incorrect build of the tests.

Ah. Maybe including limits.h in gmp-impl.h before defining INTMAX and 
such? It is already done for CRAY, I could make it be included also in 
C++/glibc when the #include <string> defined some macro characteristic of 

Actually, tests.h already includes config.h. If there is a dependency 
between tests.h and gmp-impl.h, we should probably include one in the 
other, but config.h is not such a dependency.

Marc Glisse

More information about the gmp-bugs mailing list