1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-18 08:51:45 -08:00
Commit graph

41663 commits

Author SHA1 Message Date
Paul Eggert
22213f0052 * src/systime.h (hz): #undef to work around AIX build issue. 2019-09-03 23:47:19 -07:00
Paul Eggert
d84b4f83a5 Prefer functions to macros in buffer.h
In buffer.h, prefer inline functions to function-like macros
when either will do.  This helps avoid confusion about how
many times an arg is evaluated.  On my platform, this patch
improves performance of ‘make compile-always’ by 5.7%.
Also, prefer enum constants to object-like macros
when either will do.
* src/buffer.h (BEG, BEG_BYTE, GAP_BYTES_DFL, GAP_BYTES_MIN)
(MAX_PER_BUFFER_VARS, NONEXISTENT_MODTIME_NSECS)
(UNKNOWN_MODTIME_NSECS, BUFFER_LISP_SIZE, BUFFER_REST_SIZE):
Now enum constants, instead of macros.
(BUFFER_CEILING_OF, BUFFER_FLOOR_OF, BUF_BEG, BUF_BEG_BYTE)
(BUF_BEGV, BUF_BEGV_BYTE, BUF_PT, BUF_PT_BYTE, BUF_ZV)
(BUF_ZV_BYTE, BUF_GPT_ADDR, BUF_Z_ADDR, BUF_GAP_END_ADDR)
(BUF_COMPUTE_UNCHANGED, SET_PT, TEMP_SET_PT, SET_PT_BOTH)
(TEMP_SET_PT_BOTH, BUF_TEMP_SET_PT, SET_BUF_BEGV, SET_BUF_ZV)
(SET_BUF_BEGV_BOTH, SET_BUF_ZV_BOTH, SET_BUF_PT_BOTH)
(BYTE_POS_ADDR, CHAR_POS_ADDR, CHAR_TO_BYTE, BYTE_TO_CHAR)
(PTR_BYTE_POS, FETCH_CHAR, FETCH_CHAR_AS_MULTIBYTE)
(BUF_BYTE_ADDRESS, BUF_CHAR_ADDRESS, BUF_PTR_BYTE_POS)
(BUF_FETCH_CHAR, BUF_FETCH_CHAR_AS_MULTIBYTE, BUF_FETCH_BYTE)
(BUFFER_PVEC_INIT, BUFFER_LIVE_P, BUFFER_HIDDEN_P)
(BUFFER_CHECK_INDIRECTION, OVERLAY_POSITION, PER_BUFFER_VALUE_P)
(SET_PER_BUFFER_VALUE_P, PER_BUFFER_IDX):
Now inline functions instead of macros.
2019-09-03 22:46:12 -07:00
Paul Eggert
bbe45091de * src/xdisp.c (hscroll_window_tree): Fix type typo. 2019-09-03 22:46:12 -07:00
Paul Eggert
97cfda2638 Take last_per_buffer_idx private
This will simplify future changes.  Turn the runtime check
into an eassert, since it’s not needed in production.
* src/buffer.c (last_per_buffer_idx): Now static.
(valid_per_buffer_idx): New function.
* src/buffer.h (PER_BUFFER_VALUE_P, SET_PER_BUFFER_VALUE_P): Use it.
2019-09-03 22:46:11 -07:00
Paul Eggert
9117a66790 Avoid macros in pdumper.c when it’s easy
Problem with DUMP_SET_REFERRER mentioned by Pip Cet at end of:
https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00548.html
* src/pdumper.c (DANGEROUS, EMACS_RELOC_TYPE_BITS)
(EMACS_RELOC_LENGTH_BITS, DUMP_RELOC_TYPE_BITS)
(DUMP_RELOC_ALIGNMENT_BITS, DUMP_RELOC_OFFSET_BITS)
(DUMP_RELOCATION_ALIGNMENT, DUMP_ALIGNMENT)
(WEIGHT_NONE, WEIGHT_NORMAL, WEIGHT_STRONG)
(PDUMPER_MAX_OBJECT_SIZE):
Now a constant, not a macro.
(divide_round_up): Now a function, not a macro DIVIDE_ROUND_UP.
All uses changed.
(enum link_weight_enum, WEIGHT_NONE_VALUE)
(WEIGHT_NORMAL_VALUE, WEIGHT_STRONG_VALUE): Remove.
(struct link_weight): Just use an int.
(dump_set_referrer): New function, replacing DUMP_SET_REFERRER
macro with a different API.  All uses changed.
(dump_clear_referrer): Rename from DUMP_CLEAR_REFERRER.
All uses changed.
(DEFINE_FROMLISP_FUNC, DEFINE_TOLISP_FUNC): Remove.
(intmax_t_from_lisp, intmax_t_to_lisp, dump_off_from_lisp)
(dump_off_to_lisp): Define without using macros,
(dump_off_from_lisp): Add an eassert range check.
(DUMP_FIELD_COPY): Simplify.
2019-09-03 22:46:11 -07:00
Paul Eggert
d20655669b Avoid casting -1 to possibly-unsigned enum
* src/alloc.c (mark_maybe_pointer):
* src/pdumper.h (pdumper_object_p_precise):
Use pdumper_valid_object_type_p.
* src/pdumper.c (pdumper_find_object_type_impl):
* src/pdumper.h (pdumper_find_object_type):
Return int, not enum Lisp_Type.  All callers changed.
* src/pdumper.h (PDUMPER_NO_OBJECT): Do not cast -1 to enum
Lisp_Type; in theory, C18 says this could yield 7, which would
mean PDUMPER_NO_OBJECT == Lisp_Float (!).
(pdumper_valid_object_type_p): New function.
2019-09-03 17:34:50 -07:00
Paul Eggert
97ffa339b6 Sync consing_until_gc with gc-cons-threshold
Add watchers for gc-cons-threshold and gc-cons-percentage
that update consing_until_gc accordingly.
Suggested by Eli Zaretskii (Bug#37006#52).
* src/alloc.c (consing_threshold, bump_consing_until_gc)
(watch_gc_cons_threshold, watch_gc_cons_percentage):
New functions.
(garbage_collect_1): Use consing_threshold.
(syms_of_alloc): Arrange to watch gc-cons-threshold and
gc-cons-percentage.
2019-09-03 13:03:47 -07:00
Paul Eggert
7791005544 Check instead of relying on NOTREACHED
NOTREACHED was designed for traditional lint decades ago,
and _Noreturn now normally subsumes its function.
In the one case in Emacs where NORETURN might help and _Noreturn does
not, check for NOTREACHED instead of assuming it.
* lib-src/etags.c (main):
* src/xterm.c (x_connection_closed):
Remove NOTREACHED after a call to a _Noreturn function, as NOTREACHED
is no longer needed there.  Also, one of the NOTREACHEDs was
misplaced, which defeated traditional lint checking anyway.
* lib-src/pop.c (pop_getline): Redo so as to not need NOTREACHED.
* src/emacs.c (main): Use eassume (false) rather than NOTREACHED,
so that running with ENABLE_CHECKING catches any internal error
causing the toplevel Frecursive_edit to return.
2019-08-31 11:01:46 -07:00
Andreas Schwab
172b99a43a Fix compilation with CHECK_STRUCTS
* src/pdumper.c (dump_hash_table): Update hash of Lisp_Hash_Table.
2019-08-31 12:41:53 +02:00
Eli Zaretskii
3608c5f27c ; * src/floatfns.c: Don't use non-ASCII characters in comments. 2019-08-31 09:58:45 +03:00
Mattias Engdegård
4a919b1bbc * src/floatfns.c: Check against __FINITE_MATH_ONLY__ (bug#37140) 2019-08-30 15:08:24 +02:00
Paul Eggert
fdccab473e Don't worry about pre-1.0.0 alsa-lib include
Problem reported by Ergus in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00563.html
* configure.ac (ALSA_SUBDIR_INCLUDE): Do not define.
* src/sound.c: Assume ALSA_SUBDIR_INCLUDE.
2019-08-28 11:35:19 -07:00
Paul Eggert
fa41fa70f1 Port recent gnutls fixes to gcc -Wpointer-sign
* src/gnutls.c (Fgnutls_format_certificate):
Fix pointer signedness problem.
2019-08-27 14:19:57 -07:00
Eli Zaretskii
b5e18f9fe5 ; Fix commentary of last change. 2019-08-27 19:13:39 +03:00
Eli Zaretskii
6769b64928 Fix crashes on MS-Windows when using GnuTLS connections
* src/gnutls.c (init_gnutls_functions) [WINDOWSNT]: Define and
load gnutls_free by an explicit call to GetProcAddress.
(gnutls_free) [WINDOWSNT]: Define as a macro that dereferences
a function pointer.  (Bug#31946)
(Fgnutls_format_certificate): Use make_string_from_bytes
instead of going through an intermediate malloc'ed buffer.
2019-08-27 18:47:24 +03:00
Juri Linkov
f600134a24 * src/keyboard.c (parse_tool_bar_item): Use CAPTION when HELP is unavailable
while adding equivalent key binding to the tooltip. (Bug#36156)
2019-08-27 01:38:19 +03:00
Eli Zaretskii
1071a4fac6 Fix crashes in networking with GnuTLS on MS-Windows
* src/gnutls.c (init_gnutls_functions) [WINDOWSNT]: Define and
load gnutls_free.
(Fgnutls_format_certificate): Use gnutls_free instead of
xfree.  This prevents crashes on MS-Windows, since the memory
being released was allocated inside GnuTLS.  (Bug#31946)
2019-08-26 19:06:13 +03:00
Paul Eggert
fffefeecc8 Fix bug with non-paletted transparent PNGs
Adapted from a fix by YAMAMOTO Mitsuharu (Bug#37153#77).
* src/image.c (png_load_body): Fix bug with non-paletted
transparent images.
2019-08-25 16:36:15 -07:00
Paul Eggert
8826beaf00 Fix misdisplay of PNG paletted images
Problem reported by Roland Winkler (Bug#37153).
Derived from a patch suggested by YAMAMOTO Mitsuharu (Bug#37153#62).
* src/image.c (png_get_valid) [WINDOWSNT]:
Do not dynamically link this function.
(png_get_tRNS) [WINDOWSNT && PNG_tRNS_SUPPORTED]:
Dynamically link this function instead.
(png_load_body): Do not assume that every paletted image supplies
only transparency data.  Fix typo in use of transparent_p.
2019-08-25 11:11:28 -07:00
Eli Zaretskii
543ae99fe8 Fix a recent change in coding.c
This partially reverts the changes in "extern function cleanup".
* src/coding.c (encode_string_utf_8, decode_string_utf_8): Now
extern again.  They should NOT be static, as they are intended
to be used by the likes of json.c, where we need
highly-optimized code for processing UTF-8 strings.  E.g.,
decode_string_utf_8 beats make_string_from_utf8 by a factor of
2 to 5 in a large number of scenarios.
2019-08-25 11:08:11 +03:00
Eli Zaretskii
26703b98f9 ; Improve a recent change.
* src/frame.c (Fx_parse_geometry): Improve the comment about
non-initialization of some locals.
2019-08-25 10:10:01 +03:00
Paul Eggert
84f1674ee8 Clarify Fx_parse_geometry initialization
* src/frame.c (Fx_parse_geometry): Clarify why local init
isn’t needed.
2019-08-24 17:49:57 -07:00
Paul Eggert
63906ab487 Tweak time arithmetic performance
* src/timefns.c (time_arith): Prefer mpz_divexact to mpz_tdiv_q
when either will do.
2019-08-24 15:55:09 -07:00
Paul Eggert
a050cf80f3 Speed up % and mod with fixnum denom
* src/data.c (integer_remainder): New function.  When the
numerator is a bignum and the denominator is small, this function
uses mpz_tdiv_ui, which should be faster than mpz_tdiv_r.
(Frem, Fmod): Use it.
2019-08-24 15:55:09 -07:00
Paul Eggert
2f7ca4020e Tweak integer mod performance
* src/data.c (integer_mod): Use mpz_tdiv_r not mpz_mod, as that’s
more similar to the fixnum case, is a bit more efficient, and
otherwise the later ‘sgn_r < 0’ code is useless anyway.
2019-08-24 15:55:09 -07:00
Paul Eggert
575179f74d Make (mod 1.0 0) consistent with (/ 1.0 0)
* src/data.c (Fmod): Do not signal an error for (mod 1.0 0), for
the same reason (/ 1.0 0) does not signal an error.
* test/src/data-tests.el (data-tests-mod-0): New test.
2019-08-24 15:55:08 -07:00
Paul Eggert
b62eac0f87 extern function cleanup
Most of these functions can be static.  A few are unused.
* src/coding.c (encode_string_utf_8, decode_string_utf_8):
Define only if ENABLE_UTF_8_CONVERTER_TEST, as they're
not needed otherwise.
* src/coding.c (encode_string_utf_8, decode_string_utf_8):
* src/data.c (integer_mod):
* src/fns.c (base64_encode_region_1, base64_encode_string_1):
* src/ftfont.c (ftfont_get_fc_charset):
Now static.
* src/sysdep.c (verrprintf): Remove; unused.
2019-08-24 15:55:08 -07:00
Paul Eggert
8037694595 Tweak gnutls-peer-status reporting
* src/gnutls.c (Fgnutls_peer_status): Report :compression and
:encrypt-then-mac only if the underlying GnuTLS library has
the corresponding features.  This give the Elisp caller a bit
more information about the peer status.
* lisp/net/nsm.el (nsm-protocol-check--compression):
Don’t worry about compression in newer GnuTLS versions
that do not support compression.
2019-08-23 11:52:03 -07:00
Paul Eggert
6cd5678784 Clarify compiler-pacifier in frame.c
* src/frame.c (Fx_parse_geometry): Pacify the compiler in a
different way, so that the human reader can more easily see
that the initializations are unnecessary.
2019-08-23 11:17:55 -07:00
Eli Zaretskii
ad9c8b029c Fix compilation --without--x
* src/xdisp.c (extend_face_to_end_of_line): Fix a recent
change that moved the initialization of default_face.
Reported by Glenn Morris <rgm@gnu.org>.
2019-08-23 19:21:33 +03:00
Eli Zaretskii
4b87169d11 Avoid a compilation warning in w32.c
* src/w32.c (logon_network_drive): Avoid compilation warning
about strncpy arguments.
2019-08-23 16:00:25 +03:00
Eli Zaretskii
c4dd5a73ce Avoid compilation warning in frame.c
* src/frame.c (Fx_parse_geometry): Avoid compilation warning
about x and y being used without initializing them.
2019-08-23 15:52:33 +03:00
Eli Zaretskii
f38901d431 ; Fix last change.
* src/process.c (network_lookup_address_info_1): A better fix for
compilation on platforms without HAVE_GAI_STRERROR.  (Bug#37158)
2019-08-23 15:30:45 +03:00
Robert Pluim
cbd536d6a9 Fix compilation of process.c
* src/process.c (network_lookup_address_info_1): [!HAVE_GAI_STRERROR]:
Use make_fixnum instead of make_number.  (Bug#37158).
2019-08-23 14:25:22 +02:00
Paul Eggert
49a8c8506a Get the Gnutls code compiling on Fedora 30
The recent changes caused the build to fail on Fedora 30 when built
with --enable-gcc-warnings, among other things with diagnostics that
gnutls_compression_get and gnutls_compression_get_name are deprecated
(this started with GnuTLS 3.6).  Fix this by refusing to call these
obsolescent and now-dummy functions in GnuTLS 3.6 and later.  However,
this is just a temporary workaround to get the build working; a real
fix is needed, as network-stream-tests fail.
* src/gnutls.c (HAVE_GNUTLS_COMPRESSION_GET): New macro.
(gnutls_compression_get, gnutls_compression_get_name):
Define only if HAVE_GNUTLS_COMPRESSION_GET.
(init_gnutls_functions): Load the two functions only if
HAVE_GNUTLS_COMPRESSION_GET.
(emacs_gnutls_certificate_export_pem): Use alloca instead of xmalloc.
(Fgnutls_peer_status): Just return "NULL" if the functions
are deprecated.
(Fgnutls_format_certificate): Fix pointer signedness glitches.
* src/process.c: Fix spacing.
2019-08-23 01:12:22 -07:00
Robert Pluim
ef49439ff9 Move default face lookup
* src/xdisp.c (extend_face_to_end_of_line): Move default face
lookup lower.
2019-08-23 10:06:40 +02:00
Eli Zaretskii
c3753a322a Fix recent changes in gnutls.c
* src/gnutls.c: Fix typos that broke the MS-Windows build.
(Fgnutls_peer_status_warning_describe): Fix incomplete error
message string.
2019-08-23 10:38:14 +03:00
Lars Ingebrigtsen
fbbc257190 Give a better error message when reading invalid "\unicode" escapes.
* src/lread.c (read_escape): Give a clearer error message on
Unicode escape sequences (bug#36988).
2019-08-23 06:20:41 +02:00
Lars Ingebrigtsen
53cb3d3e0d Merge remote-tracking branch 'origin/netsec' 2019-08-23 04:49:52 +02:00
Lars Ingebrigtsen
4982fd95c7 Signal `invalid-read-syntax' for "trailing garbage"
* src/minibuf.c (string_to_object): Signal `invalid-read-syntax'
instead of the generic `error' for "trailing garbage following
expression" (bug#24649).
2019-08-23 02:24:55 +02:00
Paul Eggert
e5defc3e0f Fix Qunbound-Qnil confusion in clrhash patch
Problem reported by Stefan Monnier.
* src/fns.c (hash_clear): Fix typo I introduced in my previous
patch here, by setting keys to Qunbound not Qnil.
2019-08-22 01:22:52 -07:00
Paul Eggert
7d15079c7e Remove no-longer-needed workaround for GC bug
* src/keymap.c (describe_vector): Remove old workaround for GC bug.
This workaround, introduced in 1993-02-19T05:43:54Z!rms@gnu.org,
has not been needed for some time.  Problem reported by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00316.html
2019-08-21 22:30:18 -07:00
Paul Eggert
2b552f3489 Don’t debug fset by default
This GC bug seems to have been fixed, so the check is no longer
needed in production code.  From a suggestion by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00316.html
* src/alloc.c (SUSPICIOUS_OBJECT_CHECKING) [!ENABLE_CHECKING]:
Do not define.
(find_suspicious_object_in_range, detect_suspicious_free):
Expand to proper dummy expressions if !SUSPICIOUS_OBJECT_CHECKING.
* src/data.c (Ffset): Convert test to an eassert.
2019-08-21 22:30:18 -07:00
Paul Eggert
ceebf3efbe Fix clrhash bug when hash table needs rehashing
Problem reported by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00316.html
* src/fns.c (maybe_resize_hash_table): Prefer ASET to gc_aset
where either will do.  Simplify appending of Qunbound values.
Put index_size calculation closer to where it’s needed.
(hash_clear): If hash_rehash_needed_p (h), don’t clear the
nonexistent hash vector.  Use memclear to speed up clearing.
* src/lisp.h (HASH_TABLE_SIZE): Check that the size is positive,
and tell that to the compiler.
2019-08-21 19:01:49 -07:00
Paul Eggert
c64c0230d6 * src/buffer.c: Fix comment typo. 2019-08-21 17:21:06 -07:00
Paul Eggert
951ea375d5 Don’t hard-loop on cycles in ‘read’ etc.
Problem for ‘read’ reported by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00316.html
* src/fns.c (Frequire): Protect against circular current-load-list.
* src/lread.c (Fget_load_suffixes):
Protect against circular load-suffixes or load-file-rep-suffixes.
(Fload): Protect against circular loads-in-progress.
(openp): Protect against circular PATH and SUFFIXES.
(build_load_history): Protect against circular load-history or
current-load-list.
(readevalloop_eager_expand_eval): Protect against circular SUBFORMS.
(read1): Protect against circular data.
* test/src/lread-tests.el (lread-circular-hash): New test.
2019-08-21 17:21:06 -07:00
Lars Ingebrigtsen
6224fce0d4 Fix the interactive spec for set-frame-width/height
* src/frame.c (Fset_frame_width):
(Fset_frame_height): Use `prefix-numeric-value' to get the proper
numeric value (bug#9970).
2019-08-21 13:05:18 -07:00
Martin Rudalics
9a28cb5a87 ; Fix typos in commentary section of xdisp.c 2019-08-21 10:24:25 +02:00
Paul Eggert
39fee20994 Be more careful about pointers to bignum vals
This uses ‘const’ to be better at catching bugs that
mistakenly attempt to modify a bignum value.
Lisp bignums are supposed to be immutable.
* src/alloc.c (make_pure_bignum):
* src/fns.c (sxhash_bignum):
Accept Lisp_Object instead of struct Lisp_Bignum *, as that’s
simpler now.  Caller changed.
* src/bignum.h (bignum_val, xbignum_val): New inline functions.
Prefer them to &i->value and XBIGNUM (i)->value, since they
apply ‘const’ to the result.
* src/timefns.c (lisp_to_timespec): Use mpz_t const *
to point to a bignum value.
2019-08-21 00:11:45 -07:00
Paul Eggert
3881542ede Update mini-gmp
* src/mini-gmp.c: Sync from upstream.  This incorporates:
2019-08-13 Silence a couple of warnings
2019-08-20 18:11:34 -07:00