summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-06-08 09:53:48 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-06-08 09:53:48 +0000
commit621d7ffd3682b99ba21ba2f796c7cc9680b4b774 (patch)
tree111de3ed4033d552b4e2f09ed23edcf45bf861f8
parent5ab31a6cfff0c816f35a8146e0aedcd1e80a78f5 (diff)
downloadmpfr-621d7ffd3682b99ba21ba2f796c7cc9680b4b774.tar.gz
Clean up use of stdio.h:
it is now included by mpfr-impl iff DEBUG is defined or WANT_ASSERT is defined. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3631 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--add1sp.c19
-rw-r--r--atan.c2
-rw-r--r--clear.c12
-rw-r--r--div.c2
-rw-r--r--gamma.c5
-rw-r--r--get_f.c1
-rw-r--r--get_str.c7
-rw-r--r--mpfr-impl.h5
-rw-r--r--mul.c1
-rw-r--r--round_p.c5
-rw-r--r--set_z.c2
-rw-r--r--sin.c2
-rw-r--r--strtofr.c5
-rw-r--r--sub1sp.c19
-rw-r--r--subnormal.c1
-rw-r--r--zeta.c5
16 files changed, 32 insertions, 61 deletions
diff --git a/add1sp.c b/add1sp.c
index e45b21b43..3e117ffc2 100644
--- a/add1sp.c
+++ b/add1sp.c
@@ -21,20 +21,9 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#if defined(DEBUG) || defined(WANT_ASSERT)
-# include <stdio.h>
-#endif
-
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
-#ifdef DEBUG
-# undef DEBUG
-# define DEBUG(x) (x)
-#else
-# define DEBUG(x) /**/
-#endif
-
/* Check if we have to check the result of mpfr_add1sp with mpfr_add1 */
#ifdef WANT_ASSERT
# if WANT_ASSERT >= 2
@@ -77,6 +66,14 @@ int mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
# endif
#endif
+/* Debugging support */
+#ifdef DEBUG
+# undef DEBUG
+# define DEBUG(x) (x)
+#else
+# define DEBUG(x) /**/
+#endif
+
/* compute sign(b) * (|b| + |c|)
Returns 0 iff result is exact,
a negative value when the result is less than the exact value,
diff --git a/atan.c b/atan.c
index d12490669..cf5982f85 100644
--- a/atan.c
+++ b/atan.c
@@ -19,8 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include <stdio.h>
-
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
diff --git a/clear.c b/clear.c
index 1215c2540..651d2adfb 100644
--- a/clear.c
+++ b/clear.c
@@ -1,6 +1,6 @@
/* mpfr_clear -- free the memory space allocated for a floating-point number
-Copyright 1999, 2000, 2001, 2004 Free Software Foundation.
+Copyright 1999, 2000, 2001, 2004, 2005 Free Software Foundation.
This file is part of the MPFR Library.
@@ -19,16 +19,12 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include <stdio.h>
-
#include "mpfr-impl.h"
void
mpfr_clear (mpfr_ptr m)
{
- /* be careful to always free an entire number of limbs */
- (*__gmp_free_func)
- (MPFR_GET_REAL_PTR(m),
- MPFR_MALLOC_SIZE(MPFR_GET_ALLOC_SIZE(m)));
- MPFR_MANT(m) = NULL;
+ (*__gmp_free_func) (MPFR_GET_REAL_PTR (m),
+ MPFR_MALLOC_SIZE (MPFR_GET_ALLOC_SIZE (m)));
+ MPFR_MANT (m) = NULL;
}
diff --git a/div.c b/div.c
index 247a5381d..be6ff6d84 100644
--- a/div.c
+++ b/div.c
@@ -24,7 +24,7 @@ MA 02110-1301, USA. */
#ifdef DEBUG
#define mpn_print(ap,n) mpn_print3(ap,n,MPFR_LIMB_ZERO)
-void
+static void
mpn_print3 (mp_ptr ap, mp_size_t n, mp_limb_t cy)
{
mp_size_t i;
diff --git a/gamma.c b/gamma.c
index bdd6d46d0..16b15041c 100644
--- a/gamma.c
+++ b/gamma.c
@@ -19,11 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#ifdef DEBUG
-#include <stdio.h>
-#include <stdlib.h>
-#endif
-
/* The error analysis of gamma has been lost.
As a consequence, we can't change the algorithm...
But we may compute the exp(A-k) in the inner loop a lot faster
diff --git a/get_f.c b/get_f.c
index e2194a753..dcce2b063 100644
--- a/get_f.c
+++ b/get_f.c
@@ -19,7 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include <stdio.h>
#include "mpfr-impl.h"
/* return value is 0 iff no error occurred in the conversion
diff --git a/get_str.c b/get_str.c
index 221efc59b..cf948994b 100644
--- a/get_str.c
+++ b/get_str.c
@@ -20,11 +20,8 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
+#include <string.h> /* For strlen */
+#include <limits.h> /* For LONG_MAX and LONG_MIN */
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
diff --git a/mpfr-impl.h b/mpfr-impl.h
index 7eea18546..ab30224c0 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -23,6 +23,11 @@ MA 02110-1301, USA. */
#ifndef __MPFR_IMPL_H__
#define __MPFR_IMPL_H__
+/* Include stdio.h iff we are debugging or we want to check */
+#if defined(DEBUG) || defined(WANT_ASSERT)
+# include <stdio.h>
+#endif
+
/* Check if we are inside a build of MPFR or inside the test suite.
This is needed in mpfr.h to export or import the functions.
It matters only for Windows DLL */
diff --git a/mul.c b/mul.c
index c2c08deed..37743676d 100644
--- a/mul.c
+++ b/mul.c
@@ -20,7 +20,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include <stdio.h>
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
diff --git a/round_p.c b/round_p.c
index c7683fbd4..446a07b86 100644
--- a/round_p.c
+++ b/round_p.c
@@ -21,11 +21,10 @@ MA 02110-1301, USA. */
#include "mpfr-impl.h"
+/* Check against mpfr_can_round ? */
#ifdef WANT_ASSERT
# if WANT_ASSERT >= 2
-# include <stdio.h>
-int
-mpfr_round_p_2 (mp_limb_t *bp, mp_size_t bn, mp_exp_t err0, mp_prec_t prec);
+int mpfr_round_p_2 (mp_limb_t *, mp_size_t, mp_exp_t, mp_prec_t);
int
mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mp_exp_t err0, mp_prec_t prec)
{
diff --git a/set_z.c b/set_z.c
index 7073287d5..6db3a5946 100644
--- a/set_z.c
+++ b/set_z.c
@@ -20,8 +20,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include <stdio.h>
-
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
diff --git a/sin.c b/sin.c
index c2377c60a..e5e56161b 100644
--- a/sin.c
+++ b/sin.c
@@ -19,8 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include <stdio.h>
-
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
diff --git a/strtofr.c b/strtofr.c
index 3e6b3ad90..0e2633859 100644
--- a/strtofr.c
+++ b/strtofr.c
@@ -19,9 +19,8 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
+#include <stdlib.h> /* For strtol */
+#include <ctype.h> /* For isdigit */
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
diff --git a/sub1sp.c b/sub1sp.c
index c219f8370..e45a317a2 100644
--- a/sub1sp.c
+++ b/sub1sp.c
@@ -21,20 +21,9 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#if defined(DEBUG) || defined(WANT_ASSERT)
-# include <stdio.h>
-#endif
-
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
-#ifdef DEBUG
-# undef DEBUG
-# define DEBUG(x) (x)
-#else
-# define DEBUG(x) /**/
-#endif
-
/* Check if we have to check the result of mpfr_sub1sp with mpfr_sub1 */
#ifdef WANT_ASSERT
# if WANT_ASSERT >= 2
@@ -77,7 +66,13 @@ int mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
# endif
#endif
-
+/* Debugging support */
+#ifdef DEBUG
+# undef DEBUG
+# define DEBUG(x) (x)
+#else
+# define DEBUG(x) /**/
+#endif
/* Rounding Sub */
diff --git a/subnormal.c b/subnormal.c
index 37aa85c02..b0dc12d51 100644
--- a/subnormal.c
+++ b/subnormal.c
@@ -20,7 +20,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include <stdio.h>
#include "mpfr-impl.h"
/* For GMP_RNDN, we can have a problem of double rounding.
diff --git a/zeta.c b/zeta.c
index f2a39ec07..3732200f0 100644
--- a/zeta.c
+++ b/zeta.c
@@ -20,10 +20,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston,
MA 02110-1301, USA. */
-/* #define DEBUG */
-
-#include <stdio.h>
-#include <limits.h>
+#include <limits.h> /* For CHAR_BIT */
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"