<feed xmlns='http://www.w3.org/2005/Atom'>
<title>emacs/src, branch scratch/static_assert</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>Prefer static_assert to verify</title>
<updated>2024-07-23T22:11:37+00:00</updated>
<author>
<name>Stefan Kangas</name>
</author>
<published>2024-07-23T22:09:49+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=e25655756315ac398d15b308511a8e9abf20bb0e'/>
<id>e25655756315ac398d15b308511a8e9abf20bb0e</id>
<content type='text'>
Although static_assert is C11-specific, and Emacs remains on C99, it
has been backported to older compilers by Gnulib.  Gnulib has already
changed to prefer static_assert, and we can do the same.

* lib-src/asset-directory-tool.c (main_2):
* src/alloc.c (BLOCK_ALIGN, aligned_alloc, lisp_align_malloc)
(vectorlike_nbytes, allocate_pseudovector):
* src/android.c (android_globalize_reference, android_set_dashes):
* src/android.h:
* src/androidfont.c (androidfont_draw, androidfont_text_extents):
* src/androidvfs.c:
* src/bidi.c (BIDI_CACHE_MAX_ELTS_PER_SLOT)
(bidi_find_bracket_pairs):
* src/buffer.c (init_buffer_once):
* src/casefiddle.c (do_casify_multibyte_string):
* src/dispnew.c (scrolling_window, scrolling):
* src/editfns.c (styled_format):
* src/emacs-module.c (module_extract_big_integer):
* src/fileio.c (Fdo_auto_save):
* src/fns.c (next_almost_prime, hash_string):
* src/fringe.c (init_fringe):
* src/keyboard.h (kbd_buffer_store_event_hold):
* src/keymap.c:
* src/lisp.h (u, memclear, reduce_emacs_uint_to_hash_hash)
(modiff_incr):
* src/lread.c (skip_lazy_string):
* src/pdumper.c (dump_bignum, Fdump_emacs_portable)
(dump_do_dump_relocation, pdumper_load):
* src/process.c (make_process, Fmake_process)
(connect_network_socket):
* src/regex-emacs.c:
* src/sort.c (tim_sort):
* src/sysdep.c (init_random, SSIZE_MAX):
* src/thread.c:
* src/timefns.c (trillion_factor):
* src/unexelf.c:
* src/xterm.c (x_send_scroll_bar_event): Prefer static_assert to Gnulib
verify.  Remove import of verify.h, except when used for other reasons.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Although static_assert is C11-specific, and Emacs remains on C99, it
has been backported to older compilers by Gnulib.  Gnulib has already
changed to prefer static_assert, and we can do the same.

* lib-src/asset-directory-tool.c (main_2):
* src/alloc.c (BLOCK_ALIGN, aligned_alloc, lisp_align_malloc)
(vectorlike_nbytes, allocate_pseudovector):
* src/android.c (android_globalize_reference, android_set_dashes):
* src/android.h:
* src/androidfont.c (androidfont_draw, androidfont_text_extents):
* src/androidvfs.c:
* src/bidi.c (BIDI_CACHE_MAX_ELTS_PER_SLOT)
(bidi_find_bracket_pairs):
* src/buffer.c (init_buffer_once):
* src/casefiddle.c (do_casify_multibyte_string):
* src/dispnew.c (scrolling_window, scrolling):
* src/editfns.c (styled_format):
* src/emacs-module.c (module_extract_big_integer):
* src/fileio.c (Fdo_auto_save):
* src/fns.c (next_almost_prime, hash_string):
* src/fringe.c (init_fringe):
* src/keyboard.h (kbd_buffer_store_event_hold):
* src/keymap.c:
* src/lisp.h (u, memclear, reduce_emacs_uint_to_hash_hash)
(modiff_incr):
* src/lread.c (skip_lazy_string):
* src/pdumper.c (dump_bignum, Fdump_emacs_portable)
(dump_do_dump_relocation, pdumper_load):
* src/process.c (make_process, Fmake_process)
(connect_network_socket):
* src/regex-emacs.c:
* src/sort.c (tim_sort):
* src/sysdep.c (init_random, SSIZE_MAX):
* src/thread.c:
* src/timefns.c (trillion_factor):
* src/unexelf.c:
* src/xterm.c (x_send_scroll_bar_event): Prefer static_assert to Gnulib
verify.  Remove import of verify.h, except when used for other reasons.
</pre>
</div>
</content>
</entry>
<entry>
<title>* src/comp.c (obj_to_reloc): Use eassume.</title>
<updated>2024-07-23T02:07:39+00:00</updated>
<author>
<name>Stefan Kangas</name>
</author>
<published>2024-07-23T02:03:58+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=1519c758a5a62b10f355097b066f4b88d3762bc4'/>
<id>1519c758a5a62b10f355097b066f4b88d3762bc4</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Use SBYTES instead of strlen in treesit.c</title>
<updated>2024-07-22T10:21:25+00:00</updated>
<author>
<name>Stefan Kangas</name>
</author>
<published>2024-07-22T10:21:25+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=d995429e7bc2bc5b5d87db45dbbaca121f8118e5'/>
<id>d995429e7bc2bc5b5d87db45dbbaca121f8118e5</id>
<content type='text'>
* src/treesit.c (treesit_ensure_query_compiled)
(Ftreesit_node_child_by_field_name, treesit_initialize_query):
Use SBYTES instead of strlen.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/treesit.c (treesit_ensure_query_compiled)
(Ftreesit_node_child_by_field_name, treesit_initialize_query):
Use SBYTES instead of strlen.
</pre>
</div>
</content>
</entry>
<entry>
<title>Prohibit unbinding of built-in variables</title>
<updated>2024-07-22T01:56:08+00:00</updated>
<author>
<name>Po Lu</name>
</author>
<published>2024-07-22T01:56:08+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=da0165a01e01dcb4334feee03b462ac09ceb0f8c'/>
<id>da0165a01e01dcb4334feee03b462ac09ceb0f8c</id>
<content type='text'>
* src/data.c (set_internal): Signal error if a BLV with a
redirect or a forwarded symbol is being unbound.

* test/src/data-tests.el (binding-test-makunbound-built-in): New
test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/data.c (set_internal): Signal error if a BLV with a
redirect or a forwarded symbol is being unbound.

* test/src/data-tests.el (binding-test-makunbound-built-in): New
test.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix segfault when deleting tree-sitter query (bug#72238)</title>
<updated>2024-07-21T23:51:59+00:00</updated>
<author>
<name>Yuan Fu</name>
</author>
<published>2024-07-21T23:50:59+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=4868a17396b6796b77285a3608b383aac32aee4f'/>
<id>4868a17396b6796b77285a3608b383aac32aee4f</id>
<content type='text'>
* src/treesit.c (treesit_delete_query): Only delete query and cursor
when they are non-NULL.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/treesit.c (treesit_delete_query): Only delete query and cursor
when they are non-NULL.
</pre>
</div>
</content>
</entry>
<entry>
<title>; Fix recent changes in pdumper.c</title>
<updated>2024-07-21T04:27:38+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2024-07-21T04:27:38+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=e63fa29b98f3be18b7c66c9ca289e787b172ec37'/>
<id>e63fa29b98f3be18b7c66c9ca289e787b172ec37</id>
<content type='text'>
* src/pdumper.c (dump_treesit_compiled_query, dump_vectorlike):
Minor copyedits.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/pdumper.c (dump_treesit_compiled_query, dump_vectorlike):
Minor copyedits.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix bool vector length overflow</title>
<updated>2024-07-20T23:16:22+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2024-07-20T22:52:05+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=515e5ad0de133f0a3d501bd6290ccc51d8462955'/>
<id>515e5ad0de133f0a3d501bd6290ccc51d8462955</id>
<content type='text'>
* src/alloc.c (make_clear_bool_vector): It’s now the caller’s
responsibility to make sure the bool vector length is in range.
Add an eassert to double-check this.  This lets some locals be
ptrdiff_t not EMACS_INT.
(Fmake_bool_vector, Fbool_vector):
Check that bool vector lengths are in range.
* src/lisp.h (BOOL_VECTOR_LENGTH_MAX): New macro.
(bool_vector_words, bool_vector_bytes): Avoid undefined
behavior if size == EMACS_INT_MAX - (BITS_PER_BITS_WORD - 1).
This is mostly theoretical but it’s easy to do it right.
* src/lread.c (read_bool_vector): Use EMACS_INT, not just ptrdiff_t.
Check that length doesn’t exceed BOOL_VECTOR_LENGTH_MAX.
This fixes an unlikely integer overflow where the calculated size
went negative.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/alloc.c (make_clear_bool_vector): It’s now the caller’s
responsibility to make sure the bool vector length is in range.
Add an eassert to double-check this.  This lets some locals be
ptrdiff_t not EMACS_INT.
(Fmake_bool_vector, Fbool_vector):
Check that bool vector lengths are in range.
* src/lisp.h (BOOL_VECTOR_LENGTH_MAX): New macro.
(bool_vector_words, bool_vector_bytes): Avoid undefined
behavior if size == EMACS_INT_MAX - (BITS_PER_BITS_WORD - 1).
This is mostly theoretical but it’s easy to do it right.
* src/lread.c (read_bool_vector): Use EMACS_INT, not just ptrdiff_t.
Check that length doesn’t exceed BOOL_VECTOR_LENGTH_MAX.
This fixes an unlikely integer overflow where the calculated size
went negative.
</pre>
</div>
</content>
</entry>
<entry>
<title>Change list-length intptr_t to ptrdiff_t</title>
<updated>2024-07-20T23:16:22+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2024-07-20T16:03:24+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=76497a01425e19a6c3a02c1e3031061fa0e7885b'/>
<id>76497a01425e19a6c3a02c1e3031061fa0e7885b</id>
<content type='text'>
* src/fns.c (list_length, Fsafe_length, Fproper_list_p):
Use ptrdiff_t not intptr_t for accumulator, since result is ptrdiff_t.
This fixes a minor glitch in 2019-01-11T05:35:31!eggert@cs.ucla.edu
where I removed unnecessary overflow checks but forgot to change types.
This change should alter generated code only on oddball platforms where
ptrdiff_t is narrower than intptr_t, e.g., CheriBSD.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/fns.c (list_length, Fsafe_length, Fproper_list_p):
Use ptrdiff_t not intptr_t for accumulator, since result is ptrdiff_t.
This fixes a minor glitch in 2019-01-11T05:35:31!eggert@cs.ucla.edu
where I removed unnecessary overflow checks but forgot to change types.
This change should alter generated code only on oddball platforms where
ptrdiff_t is narrower than intptr_t, e.g., CheriBSD.
</pre>
</div>
</content>
</entry>
<entry>
<title>Support dumping tree-sitter query (bug#69952)</title>
<updated>2024-07-20T21:00:47+00:00</updated>
<author>
<name>Yuan Fu</name>
</author>
<published>2024-07-20T20:56:32+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=1abf3bdd7edcd405d4ccb4ef4de38068348f4b95'/>
<id>1abf3bdd7edcd405d4ccb4ef4de38068348f4b95</id>
<content type='text'>
Previous commit allows Emacs to dump tree-sitter queries by simply
dumping the query string and language symbol, and left the query object
and cursor object as NULL.  This commit makes sure Emacs doesn't crash
when loading the dumped query, by make sure Emacs can handle the case
where the cursor is NULL.

* src/treesit.c (make_treesit_query): Initialize query with null cursor.
(treesit_ensure_query_cursor): New function.
(treesit_initialize_query): Ensure cursor is non-null.
* src/treesit.h (Lisp_TS_Query): Update documentation.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previous commit allows Emacs to dump tree-sitter queries by simply
dumping the query string and language symbol, and left the query object
and cursor object as NULL.  This commit makes sure Emacs doesn't crash
when loading the dumped query, by make sure Emacs can handle the case
where the cursor is NULL.

* src/treesit.c (make_treesit_query): Initialize query with null cursor.
(treesit_ensure_query_cursor): New function.
(treesit_initialize_query): Ensure cursor is non-null.
* src/treesit.h (Lisp_TS_Query): Update documentation.
</pre>
</div>
</content>
</entry>
<entry>
<title>Support compiled queries in pdump by dumping source (bug#69952)</title>
<updated>2024-07-20T21:00:36+00:00</updated>
<author>
<name>Sergey Vinokurov</name>
</author>
<published>2023-08-06T15:24:29+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=1eca867e1b60acef7f4343bc5c70340de58f1079'/>
<id>1eca867e1b60acef7f4343bc5c70340de58f1079</id>
<content type='text'>
* src/pdumper.c (dump_vectorlike): Dump compiled queries.
* src/pdumper.c (dump_treesit_compiled_query): New function.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/pdumper.c (dump_vectorlike): Dump compiled queries.
* src/pdumper.c (dump_treesit_compiled_query): New function.
</pre>
</div>
</content>
</entry>
</feed>
