<feed xmlns='http://www.w3.org/2005/Atom'>
<title>emacs/src/bignum.h, branch feature/package-factorize</title>
<subtitle>Emacs is the extensible, customizable, self-documenting real-time display editor. 
</subtitle>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/'/>
<entry>
<title>A few more functions are not pure</title>
<updated>2025-11-20T20:04:01+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2025-11-20T19:59:47+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=c230dfdc26f0ffffd0718120d5e49478ae7cbb72'/>
<id>c230dfdc26f0ffffd0718120d5e49478ae7cbb72</id>
<content type='text'>
Assuming ATTRIBUTE_PURE means that the function must return,
a few more functions that should not be declared with ATTRIBUTE_PURE.
The GCC manual (and even the C23 standard, with [[reproducible]])
is not clear about this, and it’s better to be safe.
* src/bignum.h (mpz_get_d_rounded):
* src/lisp.h (bignum_to_double):
No longer pure, as it does not return if memory is exhausted.
* src/fns.c (Fproper_list_p): No longer pure, as it does not
return if the user quits.
* src/gnutls.c (Fgnutls_errorp): No longer pure, as it does not
return if it runs into an eassert failure in XSYMBOL_WITH_POS via EQ.
* src/lisp.h (bignum_to_intmax, bignum_to_uintmax, bignum_bufsize):
No longer pure, as it does not return if it runs into an
eassert failure in XBIGNUM via xbignum_val.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Assuming ATTRIBUTE_PURE means that the function must return,
a few more functions that should not be declared with ATTRIBUTE_PURE.
The GCC manual (and even the C23 standard, with [[reproducible]])
is not clear about this, and it’s better to be safe.
* src/bignum.h (mpz_get_d_rounded):
* src/lisp.h (bignum_to_double):
No longer pure, as it does not return if memory is exhausted.
* src/fns.c (Fproper_list_p): No longer pure, as it does not
return if the user quits.
* src/gnutls.c (Fgnutls_errorp): No longer pure, as it does not
return if it runs into an eassert failure in XSYMBOL_WITH_POS via EQ.
* src/lisp.h (bignum_to_intmax, bignum_to_uintmax, bignum_bufsize):
No longer pure, as it does not return if it runs into an
eassert failure in XBIGNUM via xbignum_val.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix mis-declarations of non-const functions</title>
<updated>2025-11-20T00:21:24+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2025-11-19T19:18:13+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=20fd47e741342e160d774ae6afee7182bba0de65'/>
<id>20fd47e741342e160d774ae6afee7182bba0de65</id>
<content type='text'>
Problem for mpz_get_d_rounded reported by Helmut Eller in:
https://lists.gnu.org/r/emacs-devel/2025-11/msg00795.html
* lib-src/make-docfile.c (DEFUN_pure): New constant.
(write_globals, scan_c_stream): Support "attributes: pure".
* src/bignum.h (mpz_get_d_rounded):
* src/data.c (Fsymbolp, Fmodule_function_p, Fintegerp, Fnumberp):
* src/lisp.h (bignum_to_double, bignum_to_intmax)
(bignum_to_uintmax, bignum_bufsize):
Now pure, not const, since they depend on current state.
For example, Fsymbolp now inspects symbols_with_pos_enabled,
and the bignum functions inspect bignum contents in memory.
* src/data.c (Feq):
* src/xfaces.c (Fface_attribute_relative_p):
No longer const, since they might abort when debugging.
* src/pdumper.h (pdumper_object_p, pdumper_cold_object_p)
(pdumper_find_object_type, pdumper_object_p_precise):
These are not const functions.  But there is no need to declare
them to be pure, either, as they’re inline so the compiler can
figure it out.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem for mpz_get_d_rounded reported by Helmut Eller in:
https://lists.gnu.org/r/emacs-devel/2025-11/msg00795.html
* lib-src/make-docfile.c (DEFUN_pure): New constant.
(write_globals, scan_c_stream): Support "attributes: pure".
* src/bignum.h (mpz_get_d_rounded):
* src/data.c (Fsymbolp, Fmodule_function_p, Fintegerp, Fnumberp):
* src/lisp.h (bignum_to_double, bignum_to_intmax)
(bignum_to_uintmax, bignum_bufsize):
Now pure, not const, since they depend on current state.
For example, Fsymbolp now inspects symbols_with_pos_enabled,
and the bignum functions inspect bignum contents in memory.
* src/data.c (Feq):
* src/xfaces.c (Fface_attribute_relative_p):
No longer const, since they might abort when debugging.
* src/pdumper.h (pdumper_object_p, pdumper_cold_object_p)
(pdumper_find_object_type, pdumper_object_p_precise):
These are not const functions.  But there is no need to declare
them to be pure, either, as they’re inline so the compiler can
figure it out.
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright year to 2025</title>
<updated>2025-01-01T07:39:17+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2025-01-01T07:39:17+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=4da38c632161867e914b3a13dc760f8019255f94'/>
<id>4da38c632161867e914b3a13dc760f8019255f94</id>
<content type='text'>
Run "TZ=UTC0 admin/update-copyright".
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Run "TZ=UTC0 admin/update-copyright".
</pre>
</div>
</content>
</entry>
<entry>
<title>New FASTER_BIGNUM macro to test slow-path code</title>
<updated>2024-07-11T14:01:41+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2024-07-11T10:27:36+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=1c8e64a9536ed092af27279fa3f044cf031a4324'/>
<id>1c8e64a9536ed092af27279fa3f044cf031a4324</id>
<content type='text'>
* src/bignum.h (FASTER_BIGNUM): New macro.
(mpz_set_intmax, mpz_set_uintmax): Optimize only if FASTER_BIGNUM.
Also, use ckd_add to test for overflow instead of doing it by hand.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/bignum.h (FASTER_BIGNUM): New macro.
(mpz_set_intmax, mpz_set_uintmax): Optimize only if FASTER_BIGNUM.
Also, use ckd_add to test for overflow instead of doing it by hand.
</pre>
</div>
</content>
</entry>
<entry>
<title>; Add 2024 to copyright years</title>
<updated>2024-01-02T01:47:10+00:00</updated>
<author>
<name>Po Lu</name>
</author>
<published>2024-01-02T01:47:10+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=8e1c56ae46754dd7baedff49a464f078f0e9912d'/>
<id>8e1c56ae46754dd7baedff49a464f078f0e9912d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>; Add 2023 to copyright years.</title>
<updated>2023-01-01T10:31:12+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2023-01-01T10:31:12+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=cae528457cb862dc886a34240c9d4c73035b6659'/>
<id>cae528457cb862dc886a34240c9d4c73035b6659</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve random bignum generation</title>
<updated>2022-03-17T00:52:41+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2022-03-17T00:21:55+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=2ef037c0dd3510a51ad73fdead1ded09848166f4'/>
<id>2ef037c0dd3510a51ad73fdead1ded09848166f4</id>
<content type='text'>
* src/bignum.c (get_random_limb, get_random_limb_lim)
(get_random_bignum): New functions, for more-efficient
generation of random bignums without using Frem etc.
* src/fns.c (get_random_fixnum): New function.
(Frandom): Use it, and get_random_bignum.
Be consistent about signalling nonpositive integer arguments;
since zero is invalid, Qnatnump is not quite right here.
* src/sysdep.c (get_random_ulong): New function.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/bignum.c (get_random_limb, get_random_limb_lim)
(get_random_bignum): New functions, for more-efficient
generation of random bignums without using Frem etc.
* src/fns.c (get_random_fixnum): New function.
(Frandom): Use it, and get_random_bignum.
Be consistent about signalling nonpositive integer arguments;
since zero is invalid, Qnatnump is not quite right here.
* src/sysdep.c (get_random_ulong): New function.
</pre>
</div>
</content>
</entry>
<entry>
<title>; Add 2022 to copyright years.</title>
<updated>2022-01-01T07:45:51+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2022-01-01T07:45:51+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=19dcb237b5b02b36580294ab309124f346a66024'/>
<id>19dcb237b5b02b36580294ab309124f346a66024</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright year to 2021</title>
<updated>2021-01-01T09:13:56+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2021-01-01T09:13:56+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=ba05d005e5a81bc123ad8da928b1bccb6b160e7a'/>
<id>ba05d005e5a81bc123ad8da928b1bccb6b160e7a</id>
<content type='text'>
Run "TZ=UTC0 admin/update-copyright".
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Run "TZ=UTC0 admin/update-copyright".
</pre>
</div>
</content>
</entry>
<entry>
<title>Use Gnulib libgmp module</title>
<updated>2020-07-09T23:38:45+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2020-07-09T23:35:48+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=c8b6006d82196f9063581e988ea12d6c99c95536'/>
<id>c8b6006d82196f9063581e988ea12d6c99c95536</id>
<content type='text'>
Instead of doing GMP by hand, use the Gnulib libgmp module.
* .gitignore: Add lib/gmp.h.
* admin/merge-gnulib (GNULIB_MODULES): Add libgmp.
* configure.ac (GMP_LIB, GMP_OBJ): Remove.  Gnulib uses the name
LIB_GMP, so all uses changed.  All uses of GMP_OBJ removed.
(HAVE_GMP): Set this from Gnulib’s variables.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/mini-gmp-gnulib.c, lib/mini-gmp.c, lib/mini-gmp.h, m4/libgmp.m4:
New files, copied from Gnulib.
* src/bignum.h, test/data/emacs-module/mod-test.c:
Include gmp.h unconditionally.
* src/mini-gmp-emacs.c, src/mini-gmp.c, src/mini-gmp.h:
Remove.  This moves these files from src to lib, and
updates them to the current GMP version.
* test/Makefile.in (GMP_H): New macro.
($(test_module)): Use it to decide whether to compile
mini-gmp-gnulib.c too.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of doing GMP by hand, use the Gnulib libgmp module.
* .gitignore: Add lib/gmp.h.
* admin/merge-gnulib (GNULIB_MODULES): Add libgmp.
* configure.ac (GMP_LIB, GMP_OBJ): Remove.  Gnulib uses the name
LIB_GMP, so all uses changed.  All uses of GMP_OBJ removed.
(HAVE_GMP): Set this from Gnulib’s variables.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/mini-gmp-gnulib.c, lib/mini-gmp.c, lib/mini-gmp.h, m4/libgmp.m4:
New files, copied from Gnulib.
* src/bignum.h, test/data/emacs-module/mod-test.c:
Include gmp.h unconditionally.
* src/mini-gmp-emacs.c, src/mini-gmp.c, src/mini-gmp.h:
Remove.  This moves these files from src to lib, and
updates them to the current GMP version.
* test/Makefile.in (GMP_H): New macro.
($(test_module)): Use it to decide whether to compile
mini-gmp-gnulib.c too.
</pre>
</div>
</content>
</entry>
</feed>
