Should we declare _itch functions __GMP_NOTHROW __GMP_ATTRIBUTE_PURE ?

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Sun Jan 5 17:24:53 UTC 2014


Ciao,

Il Dom, 5 Gennaio 2014 5:06 pm, Torbjorn Granlund ha scritto:
> bodrato at mail.dm.unipi.it writes:
>
>   > Indeed.  I pushed a fix.
>
>   Any comment about marking them also with __GMP_NOTHROW ?
>
> Perhaps that too.  I suppose __GMP_ATTRIBUTE_PURE should really be the
> stronger ATTRIBUTE_CONST, except that we don't yet have any name space
> clean way of doing that for gmp.h.

But we have it in gmp-impl.h, I pushed this change.

Are there compilers that have the attribute pure and not the attribute const?
In case, should we use pure as a fallback? With something like this patch?

diff -r 8d8f8cef5236 gmp-impl.h
--- a/gmp-impl.h	Sun Jan 05 15:47:48 2014 +0100
+++ b/gmp-impl.h	Sun Jan 05 18:19:51 2014 +0100
@@ -255,7 +255,7 @@
 #if HAVE_ATTRIBUTE_CONST && ! defined (__GMP_NO_ATTRIBUTE_CONST_PURE)
 #define ATTRIBUTE_CONST  __attribute__ ((const))
 #else
-#define ATTRIBUTE_CONST
+#define ATTRIBUTE_CONST __GMP_ATTRIBUTE_PURE
 #endif


Regards,
m

-- 
http://bodrato.it/papers/



More information about the gmp-devel mailing list