Various patches against gmp-4.3.0

Marc Glisse marc.glisse at
Fri May 1 22:06:30 CEST 2009

On Fri, 1 May 2009, Torbjorn Granlund wrote:

>  It has been supported for quite a long time for Sun. Forte 6U2 is I
>  think the only version that doesn't understand this syntax and is not
>  completely dead. Anyway, __SUNPRO_C>=0x540 should be safe, if I read
>  the doc correctly.
> Thanks, I applied a patch taking this into account.

I don't have Forte 6 (or anything older) at hand, but for C++ 
(__SUNPRO_CC) I have a feeling that "inline" is safer than "static 
inline". At least we know it worked with previous versions of gmp and 
adding "static" should not provide any functionality improvement.

Anyway as I have no way of checking this, I'll let you decide if it is 
worth removing the || defined (__SUNPRO_CC).

For C, I just checked a bit what happens with a recent version of Sun 
Studio. I compiled several files that include the same header with a 
static inline function and all use it. I then used nm to look at the 
result. With optimization, the function disappears. Without optimization, 
I end up with 2 copies of the function (not exported).

If I replace static with extern, I always end up with one single copy of 
the function, and the symbol is exported (although I can prevent that if I 
add __hidden in front).

If I write just "inline", without optimization the function is undefined 
and an implementation is expected to be found elsewhere, and with 
optimization it is usually inlined.

Note that this C99 meaning of "inline" and "extern inline" is only 
available for __SUNPRO_C>=0x560.

Now I don't know exactly what behavior is wanted in GMP... (just "inline" 
looks nice)

Marc Glisse

More information about the gmp-devel mailing list