diff options
| author | Philipp Stephani | 2021-12-13 18:28:13 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2021-12-13 18:28:13 +0100 |
| commit | ae169bda2cbec49e30a7ca15828c45f2c638e500 (patch) | |
| tree | d07374fbff216ac169a0c8c199b1166f32ede1da /src | |
| parent | b30b33ed9b3cdacecebef73ad1131f03c635de7a (diff) | |
| download | emacs-ae169bda2cbec49e30a7ca15828c45f2c638e500.tar.gz emacs-ae169bda2cbec49e30a7ca15828c45f2c638e500.zip | |
; Add a FIXME regarding the GMP memory allocation functions.
* src/bignum.c (init_bignum): Add a warning about the technically
incorrect use of the GMP memory allocation functions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bignum.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bignum.c b/src/bignum.c index 1ac75c19e24..5c587fc6dba 100644 --- a/src/bignum.c +++ b/src/bignum.c | |||
| @@ -53,6 +53,15 @@ init_bignum (void) | |||
| 53 | { | 53 | { |
| 54 | eassert (mp_bits_per_limb == GMP_NUMB_BITS); | 54 | eassert (mp_bits_per_limb == GMP_NUMB_BITS); |
| 55 | integer_width = 1 << 16; | 55 | integer_width = 1 << 16; |
| 56 | |||
| 57 | /* FIXME: The Info node `(gmp) Custom Allocation' states: "No error | ||
| 58 | return is allowed from any of these functions, if they return | ||
| 59 | then they must have performed the specified operation. [...] | ||
| 60 | There's currently no defined way for the allocation functions to | ||
| 61 | recover from an error such as out of memory, they must terminate | ||
| 62 | program execution. A 'longjmp' or throwing a C++ exception will | ||
| 63 | have undefined results." But xmalloc and xrealloc do call | ||
| 64 | 'longjmp'. */ | ||
| 56 | mp_set_memory_functions (xmalloc, xrealloc_for_gmp, xfree_for_gmp); | 65 | mp_set_memory_functions (xmalloc, xrealloc_for_gmp, xfree_for_gmp); |
| 57 | 66 | ||
| 58 | for (int i = 0; i < ARRAYELTS (mpz); i++) | 67 | for (int i = 0; i < ARRAYELTS (mpz); i++) |