[Gmp-commit] /var/hg/gmp: Always include <limits.h>.

mercurial at gmplib.org mercurial at gmplib.org
Thu Jan 2 10:51:30 UTC 2014


details:   /var/hg/gmp/rev/e721865d67d6
changeset: 16146:e721865d67d6
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Thu Jan 02 11:51:27 2014 +0100
description:
Always include <limits.h>.

diffstat:

 ChangeLog           |   5 +++++
 gmp-impl.h          |  12 ++++++------
 tests/mpn/t-get_d.c |   6 ------
 3 files changed, 11 insertions(+), 12 deletions(-)

diffs (65 lines):

diff -r 03807b256405 -r e721865d67d6 ChangeLog
--- a/ChangeLog	Wed Jan 01 23:32:41 2014 +0100
+++ b/ChangeLog	Thu Jan 02 11:51:27 2014 +0100
@@ -1,3 +1,8 @@
+2014-01-02  Marc Glisse  <marc.glisse at inria.fr>
+
+	* gmp-impl.h: Always include <limits.h>.
+	* tests/mpn/t-get_d.c: Remove comment about <limits.h>
+
 2014-01-01  Torbjorn Granlund  <tege at gmplib.org>
 
 	* doc/gmp.texi (Low-level Functions for cryptography): Update interface
diff -r 03807b256405 -r e721865d67d6 gmp-impl.h
--- a/gmp-impl.h	Wed Jan 01 23:32:41 2014 +0100
+++ b/gmp-impl.h	Thu Jan 02 11:51:27 2014 +0100
@@ -36,9 +36,9 @@
 #include <intrinsics.h>  /* for _popcnt */
 #endif
 
-/* limits.h is not used in general, since it's an ANSI-ism, and since on
-   solaris gcc 2.95 under -mcpu=ultrasparc in ABI=32 ends up getting wrong
-   values (the ABI=64 values).
+/* For INT_MAX, etc. We used to avoid it because of a bug (on solaris,
+   gcc 2.95 under -mcpu=ultrasparc in ABI=32 ends up getting wrong
+   values (the ABI=64 values)), but it should be safe now.
 
    On Cray vector systems, however, we need the system limits.h since sizes
    of signed and unsigned types can differ there, depending on compiler
@@ -46,9 +46,7 @@
    reference, int can be 46 or 64 bits, whereas uint is always 64 bits; and
    short can be 24, 32, 46 or 64 bits, and different for ushort.  */
 
-#if defined _CRAY
 #include <limits.h>
-#endif
 
 /* For fat.h and other fat binary stuff.
    No need for __GMP_ATTRIBUTE_PURE or __GMP_NOTHROW, since functions
@@ -544,7 +542,9 @@
 
    #ifndef's are used since on some systems (HP?) header files other than
    limits.h setup these defines.  We could forcibly #undef in that case, but
-   there seems no need to worry about that.  */
+   there seems no need to worry about that.
+ 
+   Now that we include <limits.h> we should be able to remove all this.  */
 
 #ifndef ULONG_MAX
 #define ULONG_MAX   __GMP_ULONG_MAX
diff -r 03807b256405 -r e721865d67d6 tests/mpn/t-get_d.c
--- a/tests/mpn/t-get_d.c	Wed Jan 01 23:32:41 2014 +0100
+++ b/tests/mpn/t-get_d.c	Thu Jan 02 11:51:27 2014 +0100
@@ -17,12 +17,6 @@
 You should have received a copy of the GNU General Public License along with
 the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
-/* Note that we don't use <limits.h> for LONG_MIN, but instead our own
-   definition in gmp-impl.h.  In gcc 2.95.4 (debian 3.0) under
-   -mcpu=ultrasparc, limits.h sees __sparc_v9__ defined and assumes that
-   means long is 64-bit long, but it's only 32-bits, causing fatal compile
-   errors.  */
-
 #include "config.h"
 
 #include <setjmp.h>


More information about the gmp-commit mailing list