summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-04-02 09:24:44 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-04-02 09:24:44 +0000
commitf88296b2e7fd5f3bfd4a0652accd3360af39680a (patch)
tree774ab6a6dd70fde70035a7078a53371ceab1355b /src
parente6b3a2105fffef231ea823503de2ecd012c8316b (diff)
downloadmpfr-f88296b2e7fd5f3bfd4a0652accd3360af39680a.tar.gz
[src/mpfr-gmp.h] If HAVE_ALLOCA is not defined, i.e. if alloca() is
not available (as detected by the configure script), then set the default MPFR_ALLOCA_MAX value to 0 so that alloca() is not used. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13850 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src')
-rw-r--r--src/mpfr-gmp.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mpfr-gmp.h b/src/mpfr-gmp.h
index b85058ab7..3807cd41e 100644
--- a/src/mpfr-gmp.h
+++ b/src/mpfr-gmp.h
@@ -284,9 +284,19 @@ __MPFR_DECLSPEC void *mpfr_tmp_allocate (struct tmp_marker **,
size_t);
__MPFR_DECLSPEC void mpfr_tmp_free (struct tmp_marker *);
-/* Can be overridden at configure time. Useful for checking buffer overflow. */
+/* Default MPFR_ALLOCA_MAX value. It can be overridden at configure time;
+ with some tools, by giving a low value such as 0, this is useful for
+ checking buffer overflow, which may not be possible with alloca.
+ If HAVE_ALLOCA is not defined, then alloca() is not available, so that
+ MPFR_ALLOCA_MAX needs to be 0 (see the definition of TMP_ALLOC below);
+ if the user has explicitly given a non-zero value, this will probably
+ yield an error at link time or at run time. */
#ifndef MPFR_ALLOCA_MAX
-# define MPFR_ALLOCA_MAX 16384
+# ifdef HAVE_ALLOCA
+# define MPFR_ALLOCA_MAX 16384
+# else
+# define MPFR_ALLOCA_MAX 0
+# endif
#endif
/* Do not define TMP_SALLOC (see the test in mpfr-impl.h)! */