summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2012-06-23 01:07:33 +0200
committerMarc Glisse <marc.glisse@inria.fr>2012-06-23 01:07:33 +0200
commit4aa6c64925423c7e3953f8e7b6d40edcef91e9c6 (patch)
treea90885c6b28d980dd7fda7bd2eb1a851a00ed7e0
parentddd1cbd976340e24748197a9c55cf55cc159dcb0 (diff)
downloadgmp-4aa6c64925423c7e3953f8e7b6d40edcef91e9c6.tar.gz
Declare members of numeric_limits so they are properly emitted when their use is not inlined.
-rw-r--r--ChangeLog3
-rw-r--r--Makefile.am2
-rw-r--r--cxx/Makefile.am2
-rw-r--r--cxx/limits.cc51
4 files changed, 56 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index ea0a23011..5bc47098c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
2012-06-23 Marc Glisse <marc.glisse@inria.fr>
* gmpxx.h (numeric_limits): Make content public.
+ (cxx/limits.cc): New file, proper declarations.
+ (Makefile.am): List new file.
+ (cxx/Makefile.am): Likewise.
2012-06-09 Marc Glisse <marc.glisse@inria.fr>
diff --git a/Makefile.am b/Makefile.am
index 07e4c4e00..f14a9f567 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -232,7 +232,7 @@ RANDOM_OBJECTS = \
# no $U for C++ files
CXX_OBJECTS = \
cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo cxx/ismpz.lo cxx/ismpznw.lo \
- cxx/osdoprnti.lo cxx/osfuns.lo \
+ cxx/limits.lo cxx/osdoprnti.lo cxx/osfuns.lo \
cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo
# In libtool 1.5 it doesn't work to build libgmp.la from the convenience
diff --git a/cxx/Makefile.am b/cxx/Makefile.am
index c4a42dce4..f60b4c98e 100644
--- a/cxx/Makefile.am
+++ b/cxx/Makefile.am
@@ -25,5 +25,5 @@ noinst_LTLIBRARIES = libcxx.la
endif
libcxx_la_SOURCES = \
- isfuns.cc ismpf.cc ismpq.cc ismpz.cc ismpznw.cc \
+ isfuns.cc ismpf.cc ismpq.cc ismpz.cc ismpznw.cc limits.cc \
osdoprnti.cc osfuns.cc osmpf.cc osmpq.cc osmpz.cc
diff --git a/cxx/limits.cc b/cxx/limits.cc
new file mode 100644
index 000000000..9b32df758
--- /dev/null
+++ b/cxx/limits.cc
@@ -0,0 +1,51 @@
+/* instantiation of numeric_limits specializations.
+
+Copyright 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
+
+#include "gmpxx.h"
+
+namespace std {
+#define GMPXX_INSTANTIATE_LIMITS(T) \
+ const bool numeric_limits<T>::is_specialized; \
+ const int numeric_limits<T>::digits; \
+ const int numeric_limits<T>::digits10; \
+ const int numeric_limits<T>::max_digits10; \
+ const bool numeric_limits<T>::is_signed; \
+ const bool numeric_limits<T>::is_integer; \
+ const bool numeric_limits<T>::is_exact; \
+ const int numeric_limits<T>::radix; \
+ const int numeric_limits<T>::min_exponent; \
+ const int numeric_limits<T>::min_exponent10; \
+ const int numeric_limits<T>::max_exponent; \
+ const int numeric_limits<T>::max_exponent10; \
+ const bool numeric_limits<T>::has_infinity; \
+ const bool numeric_limits<T>::has_quiet_NaN; \
+ const bool numeric_limits<T>::has_signaling_NaN; \
+ const float_denorm_style numeric_limits<T>::has_denorm; \
+ const bool numeric_limits<T>::has_denorm_loss; \
+ const bool numeric_limits<T>::is_iec559; \
+ const bool numeric_limits<T>::is_bounded; \
+ const bool numeric_limits<T>::is_modulo; \
+ const bool numeric_limits<T>::traps; \
+ const bool numeric_limits<T>::tinyness_before; \
+ const float_round_style numeric_limits<T>::round_style
+
+ GMPXX_INSTANTIATE_LIMITS(mpz_class);
+ GMPXX_INSTANTIATE_LIMITS(mpq_class);
+ GMPXX_INSTANTIATE_LIMITS(mpf_class);
+}