Various patches against gmp-4.3.0

Torbjorn Granlund tg at gmplib.org
Wed May 6 14:10:37 CEST 2009


Michiel De Wilde <mdewilde.agilent at googlemail.com> writes:

  2009/5/6 Torbjorn Granlund tg at gmplib.org
  
  > [... abour "#define restrict __restrict"]
  > Sorry, I don't see why this reasoning is relevant to the present
  > situation.  I repeat: gmp-impl.h is an internal GMP file.  Surely its
  > "global" effects should be quite limited.  :-)
  >
  > I understand that
  >
  > #include "gmp.h"
  > #include "gmp-impl.h"
  > #include <somesystemheader.h>
  >
  > can be a problem.  Are you trying to say that we do that in GMP?
  
  The autoconf defines are performed before including system files. See the
  failed config test below.
  
OK, now I think I see what's going wrong, at least one more step.

The feature test includes just gmp.h and gmp-impl.h.  In turn,
gmp-impl.h includes config.h and (conditionally) some system headers
like malloc.h when it detects the microsoft compiler.

What causes problems in your case is that config.h is included before
malloc.h, and config.h defines restrict to __restrict.

But this is done only because a feature test that determined that
__restrict is the right variant in the present compilation mode.  Why
does that feature test go wrong?

Surely, the microsoft compiler is not so silly that it wants
__declspec(restrict) but wants __restrict when used for formal
parameters?  If it does, then they ought to fix that!

i am curious why you are seeing all these problems?  Are you using an
unusual variant of MS's tools?  Prerelease, old release?

-- 
Torbjörn


More information about the gmp-devel mailing list