Add new font backend drivers for text shaping by HarfBuzz
* etc/NEWS: Mention new font backend drivers xfthb and ftcrhb.
* src/font.h [HAVE_HARFBUZZ]: Include hb.h.
(struct font_driver) [HAVE_HARFBUZZ]: New members begin_hb_font and
end_hb_font.
(ftfont_match, ftfont_list): Remove externs.
(ftfont_match2, ftfont_list2):
(fthbfont_combining_capability, fthbfont_begin_hb_font)
(fthbfont_shape) [HAVE_HARFBUZZ]:
(xfthbfont_driver) [HAVE_XFT && HAVE_HARFBUZZ]:
(ftcrhbfont_driver) [USE_CAIRO && HAVE_HARFBUZZ]: Add externs.
* src/ftcrfont.c (ftcrfont_list): Use ftfont_list2.
(ftcrfont_match): Use ftfont_match2.
(ftcrfont_open): Get font type from entity.
(ftcrfont_open) [HAVE_HARFBUZZ]: Use HarfBuzz version of driver if specified.
(ftcrfont_shape) [HAVE_HARFBUZZ]: Make shaping fail.
(ftcrhbfont_list, ftcrhbfont_match)
(ftcrhbfont_begin_hb_font) [HAVE_HARFBUZZ]: New functions.
(ftcrhbfont_driver) [HAVE_HARFBUZZ]: New variable.
(syms_of_ftcrfont_for_pdumper) [HAVE_HARFBUZZ]: Initialize and register it.
(syms_of_ftcrfont) [HAVE_HARFBUZZ]: New symbol Qftcrhb.
* src/ftfont.c: Include math.h for lround.
(fthbfont_driver) [HAVE_HARFBUZZ]: New variable.
(ftfont_get_hb_font) [HAVE_HARFBUZZ]: Remove function.
(ftfont_list, ftfont_match): Make static.
(ftfont_list2, ftfont_match2): New functions.
(ftfont_open2) [HAVE_HARFBUZZ]: Use HarfBuzz version of driver if specified.
(ftfont_open): Get font type from entity.
(ftfont_shape, ftfont_combining_capability, ftfont_driver) [HAVE_HARFBUZZ]:
Move HarfBuzz specific part from here ...
(fthbfont_shape, fthbfont_combining_capability)
(fthbfont_driver) [HAVE_HARFBUZZ]: ... to here. New functions and variable.
(fthbfont_begin_hb_font) [HAVE_HARFBUZZ]: New function.
(fthbfont_shape_by_hb) [HAVE_HARFBUZZ]: Rename from ftfont_shape_by_hb.
Don't take FreeType specific arguments ft_face and matrix. Use begin_hb_font
and end_hb_font font driver functions. Use text_extents font driver functions
instead of ftfont_glyph_metrics.
(syms_of_ftfont) [HAVE_HARFBUZZ]: New symbol Qfreetypehb.
(syms_of_ftfont_for_pdumper) [HAVE_HARFBUZZ]: Initialize and register
fthbfont_drivert.
* src/ftxfont.c (ftxfont_list): Use ftfont_list2.
(ftxfont_match): Use ftfont_match2.
(ftxfont_driver) [HAVE_HARFBUZZ]: Don't initialize shape member explicitly.
* src/xfns.c (Fx_create_frame) [USE_CAIRO && HAVE_HARFBUZZ]:
(Fx_create_frame) [HAVE_XFT && HAVE_HARFBUZZ]: Register HarfBuzz versions of
font drivers.
* src/xftfont.c (xftfont_list): Use ftfont_list2.
(xftfont_match): Use ftfont_match2.
(xftfont_open): Get font type from entity.
(xftfont_open) [HAVE_HARFBUZZ]: Use HarfBuzz version of driver if specified.
(xftfont_shape) [HAVE_HARFBUZZ]: Make shaping fail.
(xfthbfont_list, xfthbfont_match, xfthbfont_begin_hb_font)
(xfthbfont_end_hb_font) [HAVE_HARFBUZZ]: New functions.
(xftfont_driver) [HAVE_HARFBUZZ]: Don't initialize shape member explicitly.
(xfthbfont_driver) [HAVE_HARFBUZZ]: New variable.
(syms_of_xftfont_for_pdumper) [HAVE_HARFBUZZ]: Initialize and register it.
(syms_of_xftfont) [HAVE_HARFBUZZ]: New symbol Qxfthb.
Eli Zaretskii [Fri, 26 Apr 2019 07:39:24 +0000 (10:39 +0300)]
Avoid compiler warning in dynlib.c
* src/dynlib.c (dynlib_addr) [WINDOWSNT]: Rename the first
argument to be consistent with other platforms. Cast it to
'void *' to avoid compiler warning as result of changing the
function's signature as part of the last recent change in
dynlib.c.
Alan Mackenzie [Fri, 26 Apr 2019 01:15:00 +0000 (01:15 +0000)]
Fix the formatting of '\' (including apostrophes) in CC Mode.
In particular, the second apostrophe must also get font-lock-warning-face.
* lisp/progmodes/cc-mode.el (c-parse-quotes-before-change)
(c-parse-quotes-after-change): Add cond arms to recognize and handle the
anomalous construct '\'. Correct the handling of c-new-BEG in
c-parse-quotes-before-change.
Paul Eggert [Thu, 25 Apr 2019 20:42:50 +0000 (13:42 -0700)]
Minor tweaks to recent UBSan-related fix
* src/alloc.c: No need to include stdalign.h; it’s pervasive.
(GC_STRING_OVERRUN_COOKIE_SIZE): Align to sdata’s alignment,
so that the code works even if alignof (sdata) exceeds 8.
Don’t require the cookie size to be 8, as this overly fattens
32-bit platforms and one DEADBEEF should be enough.
(GC_STRING_EXTRA): Omit now-unnecessary ‘verify’.
(allocate_string_data): Omit unnecessary cast.
Paul Eggert [Thu, 25 Apr 2019 20:21:39 +0000 (13:21 -0700)]
Port to Oracle Developer Studio 12.6
This compiler is a bit pickier about checking conformance to
the C standard, ranging from syntax trivia (no extra ";" at
the top level) to portability trivia (warnings re conversion
between function and data pointers) to more-important stuff
like lack of support for some __attribute__ usages.
* src/dynlib.c (dynlib_addr): First argument is a function
pointer, not a data pointer. All callers changed.
* src/emacs-module.c (module_function_address):
Return module_funcptr, not void *. All uses changed.
* src/lisp.h (module_funcptr) [HAVE_MODULES]: New type.
* src/lread.c (union ieee754_double): Don’t assume the usual
semantics for converting signed to unsigned int when initializing
a bitfield, as the Oracle compiler complains and the C standard
is unclear.
* src/pdumper.c (ALLOW_IMPLICIT_CONVERSION): Make it clearer
that -Wsign-conversion is disabled everywhere in this file.
(dump_trace, dump_tailq_prepend, dump_tailq_append):
Don’t assume __attribute__.
(dump_object_self_representing_p): Don’t disable conversion
warnings; it’s not needed here.
(DEFINE_FROMLISP_FUNC): Avoid possible signal in integer
conversion from unsigned to signed.
(DEFINE_FROMLISP_FUNC, finish_dump_pvec): Avoid warning about
unreachable statements on platforms not supporting the
__attribute__.
(intmax_t_from_lisp, intmax_t_to_lisp, dump_off_from_lisp)
(dump_off_to_lisp, dump_emacs_reloc_immediate_lv)
(dump_emacs_reloc_immediate_ptrdiff_t)
(dump_emacs_reloc_immediate_intmax_t)
(dump_emacs_reloc_immediate_int, dump_emacs_reloc_immediate_bool):
Omit stray semicolon that violates C standard.
(dump_metadata_for_pdumper): Add cast to pacify compiler complaining
about conversion from function pointer to data pointer.
(Fdump_emacs_portable): Do not use CALLN to call a function
with zero arguments, as C99 prohibits empty initializers.
* src/xdisp.c (syms_of_xdisp): Do not nest calls to pure_list,
to work around a bug in Oracle Developer Studio 12.6.
Stefan Monnier [Thu, 25 Apr 2019 18:36:03 +0000 (14:36 -0400)]
Use lexical-binding by default for M-:, --eval, and *scratch*
* lisp/startup.el (command-line): Default to lexical-binding in *scratch*.
(normal-no-mouse-startup-screen, command-line-1):
Use startup--get-buffer-create-scratch.
(command-line-1):
* lisp/simple.el (eval-expression):
* lisp/server.el (server-eval-and-print): Use lexical-binding to
evaluate the expression.
(server-execute): Use startup--get-buffer-create-scratch.
* lisp/ielm.el (inferior-emacs-lisp-mode): Default to lexical-binding.
Alan Mackenzie [Thu, 25 Apr 2019 18:00:15 +0000 (18:00 +0000)]
Restore fontification of delimiters of multiline CC Mode strings.
E.g., on typing the closing delimiter of a string continued onto a second
line, the opening delimiter retained its font-lock-warning-face.
* lisp/progmodes/cc-defs.el (c-c++-raw-string-opener-re)
(c-c++-raw-string-opener-1-re): New constants.
(c-sub-at-c++-raw-string-opener, c-at-c++-raw-string-opener): New macros.
* lisp/progmodes/cc-engine.el (c-raw-string-pos)
(c-depropertize-raw-strings-in-region, c-after-change-unmark-raw-strings):
Replace uses of open-coded raw string regexps by the new constants and macros
in cc-defs.el.
* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Set
c-new-BEG to the beginning of the string when we encounter its closing ".
When not in a raw string, but in a string, clear syntax-table properties from
its delimiters and set c-new-BEG/END to its limits.
(c-after-change-mark-abnormal-strings): When applying syntax-table properties
to string delimiters, also set c-new-BEG/END to ensure subsequent
fontification.
Stephen Berman [Thu, 25 Apr 2019 17:17:23 +0000 (19:17 +0200)]
Make wdired-mode ignore ls file indicators
* lisp/wdired.el (wdired--restore-dired-filename-prop): When
dired-listing-switches includes "F" or "classify", don't treat
appended indicator characters as part of the file name (bug#34915).
* test/lisp/wdired-tests.el (wdired-test-bug34915): New test.
Paul Eggert [Thu, 25 Apr 2019 15:50:50 +0000 (08:50 -0700)]
Port emacsclient euidaccess to Solaris 10
Without this fix, linking emacsclient fails with ‘Undefined
symbol eaccess’ on Solaris 10 sparc.
* lib-src/Makefile.in (LIB_EACCESS): New macro.
(emacsclient${EXEEXT}, emacsclientw${EXEEXT}): Use it.
Alan Mackenzie [Thu, 25 Apr 2019 15:18:12 +0000 (15:18 +0000)]
Fix some corner cases in the recognition of C++ raw strings.
These are where changing the identifier in a raw string delimiter causes
different delimiters to match eachother.
* lisp/progmodes/cc-engine.el (c-raw-string-end-delim-disrupted): New
variable.
(c-before-change-check-raw-strings): Use new variable.
(c-after-change-unmark-raw-strings): When typing into an opening delimiter or
altering its close delimiter causes the opening delimiter to match a later
closing delimiter, clear all syntax-table char properties from the opening
delimiter onwards, and set c-new-END to point max. Also, when changing a
closing delimiter, check whether its new value matches a previously open
opening delimiter earlier in the buffer, and amend the syntax-table text
properties appropriately.
* lisp/progmodes/sql.el
(sql-is-sqli-buffer-p): New function.
(sql-generate-unique-sqli-buffer-name): Refactor and use it.
(sql-product-interactive): Simplify name logic.
* test/lisp/progmodes/sql-tests.el
(sql-tests-placeholder-filter-harness): New macro.
(sql-tests-placeholder-filter-simple)
(sql-tests-placeholder-filter-ampersand)
(sql-tests-placeholder-filter-period): Refactored tests and use macro.
(sql-tests-buffer-naming-harness): New macro.
(sql-tests-buffer-naming-default)
(sql-tests-buffer-naming-multiple)
(sql-tests-buffer-naming-explicit)
(sql-tests-buffer-naming-universal-argument)
(sql-tests-buffer-naming-existing): New tests.
Paul Eggert [Thu, 25 Apr 2019 00:41:05 +0000 (17:41 -0700)]
Improve port to platforms lacking euidaccess (Bug#35406)
* lib-src/emacsclient.c (set_local_socket):
Use faccessat with AT_EACCESS instead of using euidaccess.
* admin/merge-gnulib, lib/gnulib.mk.in, m4/gnulib-comp.m4:
Revert previous change.
Mark Oteiza [Wed, 24 Apr 2019 23:38:20 +0000 (19:38 -0400)]
Change WordStar emulation into a minor mode (Bug#35148)
* lisp/obsolete/ws-mode.el: Turn on lexical-binding. Update commentary.
(wordstar): New custom group.
(wordstar-mode-lighter): New custom variable.
(wordstar-mode): Declare with define-minor-mode.
(turn-on-wordstar-mode): New function.
(global-wordstar-mode): New function. Use previous new function.
* lisp/progmodes/project.el (project--find-regexp-in-files):
Add an explicit '-e' before the pattern. Fixing the ability to
search for '--'. Reported by Juri Linkov <juri@linkov.net>.
Philipp Stephani [Wed, 24 Apr 2019 17:35:36 +0000 (19:35 +0200)]
Unbreak build when building without GMP support.
Add support for a new preprocessor macro EMACS_MODULE_HAVE_MPZ_T to
emacs-module.h. If this macro is defined, assume that mpz_t is
already defined and don’t include gmp.h.
Don’t document the new macro for now, as it’s unclear whether we want
to support this in modules outside the Emacs tree.
* src/emacs-module.h.in: Allow user to prevent inclusion of gmp.h.
* src/emacs-module.c: Use mini-gmp if GMP is unavailable. Don’t
include gmp.h.
* src/lisp.h: Don’t require gmp.h. It’s not needed for lisp.h.
* test/Makefile.in (GMP_LIB, GMP_OBJ): New variables.
($(test_module)): Use them.
* test/data/emacs-module/mod-test.c: Use mini-gmp if GMP is unavailable.
Philipp Stephani [Wed, 24 Apr 2019 21:12:35 +0000 (23:12 +0200)]
Move definition of Lisp_Module_Function to emacs-module.c.
* src/lisp.h: Remove include of emacs-module.h. Remove definition
of Lisp_Module_Function structure.
* src/emacs-module.c (module_function_documentation)
(module_function_address): New accessor functions for module function
fields.
(emacs_subr, struct Lisp_Module_Function): Move from lisp.h.
* src/print.c (print_vectorlike):
* src/doc.c (Fdocumentation): Use the new accessor functions.
Paul Eggert [Wed, 24 Apr 2019 20:35:14 +0000 (13:35 -0700)]
Simplify thread initialization and GC
* src/lisp.h (PVECHEADERSIZE): New macro.
(XSETPVECTYPESIZE): Use it.
* src/search.c (syms_of_search): No need to initialize or
staticpro last_thing_searched or saved_last_thing_searched, as
the thread code arranges for initialization and GC.
* src/thread.c (main_thread): Initialize statically.
(Fmake_mutex, Fmake_condition_variable, Fmake_thread):
Use ALLOCATE_ZEROED_PSEUDOVECTOR rather than zeroing by hand.
(mark_one_thread): No need to mark Lisp_Object members.
(init_main_thread, init_threads_once): Remove. All uses removed.
Eli Zaretskii [Wed, 24 Apr 2019 12:26:54 +0000 (15:26 +0300)]
Fix posn-at-point with line-number display and display properties
* src/xdisp.c (pos_visible_p): Account for line-number display
width when CHARPOS is covered by display property that begins
at the 2nd display element of a screen line. (Bug#35404)
Philipp Stephani [Thu, 18 Apr 2019 15:42:45 +0000 (17:42 +0200)]
Add conversions to and from struct timespec to module interface.
Time values are a fundamental data type, and such conversions are hard
to implement within modules because of the various forms of time
values in Emacs Lisp. Adding dedicated conversion functions can
significantly simplify module code dealing with times.
This approach uses nanosecond precision. While Emacs in theory has
support for higher-precision time values, in practice most languages
and standards, such as POSIX, C, Java, and Go, have settled on
nanosecond-precision integers to represent time.
* src/emacs-module.h.in: Add header for struct timespec.
* src/module-env-27.h: Add module functions for time conversion.
* src/emacs-module.c (module_extract_time, module_make_time): New
functions.
(initialize_environment): Use them.
* test/data/emacs-module/mod-test.c (Fmod_test_add_nanosecond): New
test function.
(emacs_module_init): Define it.
* test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid)
(mod-test-add-nanosecond/nil, mod-test-add-nanosecond/invalid): New
unit tests.
* doc/lispref/internals.texi (Module Values): Document time
conversion functions.
Rationale: any font-related code and comments, even if unused
for decades, serves as important source of useful information
in an area of Emacs code that is notoriously under-documented.
Please do NOT remove this stuff until we have an active
expert in this are on board, who will then decide whether
this can be retired.
Paul Eggert [Tue, 23 Apr 2019 20:51:07 +0000 (13:51 -0700)]
Remove some unnecessary #ifdef directives
These directives are in files that are compiled only if the
symbols are defined.
* src/gfilenotify.c: Remove unnecessary ‘#ifdef HAVE_GFILENOTIFY’.
* src/inotify.c: Remove unnecessary ‘#ifdef HAVE_INOTIFY’.
* src/kqueue.c: Remove unnecessary ‘#ifdef HAVE_KQUEUE’.
Paul Eggert [Tue, 23 Apr 2019 20:29:42 +0000 (13:29 -0700)]
Remove font.c code commented out for a decade
* src/font.c (LSTRING_HEADER_SIZE, LSTRING_GLYPH_SIZE, check_gstring)
(check_otf_features, otf_list, otf_tag_symbol, otf_open)
(font_otf_capability, generate_otf_features)
(font_otf_DeviceTable, font_otf_ValueRecord)
(font_otf_Anchor, Ffont_drive_otf, Ffont_otf_alternates)
(Fdraw_string, syms_of_font): Remove "experimental and not
tested much" code that has been "#if 0"-ed out for more than a
decade and which was getting in the way of maintenance.
* lisp/autorevert.el
(auto-revert-notify-watch-descriptor-hash-list):
Rename to auto-revert--buffers-by-watch-descriptor. Improved doc string.
(auto-revert-notify-rm-watch, auto-revert-notify-add-watch,
auto-revert-notify-handler): Use new name.
Eli Zaretskii [Tue, 23 Apr 2019 10:20:46 +0000 (13:20 +0300)]
Speed up JSON parsing
Thanks to Dmitry Gutov <dgutov@yandex.ru> for running many
benchmarks and for useful discussions.
* src/json.c (json_make_string): Speed up parsing of JSON
strings by optimizing the normal case of a valid UTF-8 string
being returned from libjansson. (Bug#31138)
Philipp Stephani [Tue, 23 Apr 2019 09:59:29 +0000 (11:59 +0200)]
Small fix for a JSON unit test.
* test/src/json-tests.el (json-parse-string/null): Make JSON object
syntactically valid. This test is supposed to check whether an
escaped null character causes an error, but without quoting the string
it would be syntactically invalid in any case.
Alan Mackenzie [Tue, 23 Apr 2019 09:16:05 +0000 (09:16 +0000)]
Optimize for typing characters into long C++ raw strings.
* lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare)
(c-font-lock-objc-methods) (c-font-lock-declarations, c-font-lock-enum-tail)
(c-font-lock-cut-off-declarators, c-font-lock-enclosing-decls): If the chunk
been fontified consists entirely of comments and strings, don't attempt to
perform the function's action.
* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Don't
expand (c-new-BEG c-new-END) unnecessarily to the entire raw string being
fontified.
(c-fl-decl-start, c-fl-decl-end): When in a (raw or otherwise) string, don't
return a position outside of the string (which used to cause unneeded
fontification).
Release xft_data in widget destroy callback to avoid visual distraction
* lwlib/lwlib-int.h (struct _widget_instance) [HAVE_XFT]: Remove nr_xft_data.
* lwlib/lwlib-Xaw.c (find_xft_data, xaw_update_one_widget) [HAVE_XFT]: Loop
while widget member is not NULL instead of using nr_xft_data.
(xaw_destroy_instance) [HAVE_XFT]: Move xft_data release code from here ...
(destroy_xft_data) [HAVE_XFT]: ... to here.
(make_dialog) [HAVE_XFT]: Add destroy_xft_data as destroy callback for dialog.
Paul Eggert [Tue, 23 Apr 2019 03:44:11 +0000 (20:44 -0700)]
Let plain ‘make’ work even not GNU Make
* Makefile.in (top_distclean): Clean makefile as well as Makefile.
* configure.ac: If not using plain ‘make’, create a makefile
so that plain ‘make’ simply calls $(MAKE).
Paul Eggert [Tue, 23 Apr 2019 03:02:20 +0000 (20:02 -0700)]
Revert Vinternal_interpreter_environment tweak
Stefan Monnier pointed out examples like (funcall `(closure
,(let ((cycle (list nil))) (setcdr cycle cycle)) () a)),
where the user can set Vinternal_interpreter_environment
indirectly.
* src/eval.c (Fsetq): Revert recent change, going back to Fassq.
Paul Eggert [Mon, 22 Apr 2019 18:40:13 +0000 (11:40 -0700)]
Go back to old way of checking json int range
Although the lisp.h macros really need improvement,
INTEGER_TO_INT is not the right way to go about it, as it
causes conversion from intmax_t to uintmax_t and back again,
which can cause a signal if the value is negative.
* src/lisp.h (INTEGER_TO_INT, ranged_integer_to_int)
(ranged_integer_to_uint): Remove, reverting recent changes to
this file.
* src/json.c (lisp_to_json): Revert to previous code,
as the change messes up with uintmax_t<->intmax_t conversion.
* lisp/autorevert.el (auto-revert-notify-handler):
When getting a `stopped' event, deal with it for the buffers it applies to,
rather than for all buffers in auto-revert mode.
Allow file-notify callbacks to call `file-notify-rm-watch', harmlessly,
after receiving a `stopped' event without triggering recursion.
* lisp/filenotify.el (file-notify--watch): Note that `callback' can be nil.
(file-notify--rm-descriptor): Set the `callback' field to nil before
sending `stopped'.
(file-notify-rm-watch): Don't do anything if the `callback' field is nil.
Philipp Stephani [Sun, 21 Apr 2019 16:09:38 +0000 (18:09 +0200)]
Improve documentation around standard error pipes (Bug#35328).
* doc/lispref/processes.texi (Asynchronous Processes): Document
existence and properties of the standard error process.
(Accepting Output): Document that one has to accept output from the
standard error process separately.
Philipp Stephani [Mon, 22 Apr 2019 13:43:52 +0000 (15:43 +0200)]
Module API: Don’t require null-terminated strings in make_string.
* emacs-module.c (module_make_string): Use make_unibyte_string, which
doesn’t require its argument to be null-terminated. Since it always
returns a heap-allocated string, we don’t have to copy it any more
while decoding.
(module_decode): New helper function.
For discussion, see thread starting at:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00316.html
* doc/lispref/customize.texi (Composite Types): Do not overspecify
:match-alternatives predicates.
* doc/lispref/eval.texi (Intro Eval): Anchor definition of "side
effect" for cross-referencing...
* doc/lispref/functions.texi (What Is a Function): ...from here.
Define what a pure function is.
* doc/lispref/internals.texi (Writing Emacs Primitives): Describe
currently preferred approach to marking primitives as pure and
side-effect-free.
* doc/lispref/symbols.texi (Standard Properties): Expand description
of pure and side-effect-free properties.
Michael Albinus [Mon, 22 Apr 2019 07:58:37 +0000 (09:58 +0200)]
Some changes in tramp-tests
* test/lisp/net/tramp-tests.el (tramp-test32-shell-command):
Check for backward compatibility.
(tramp-test33-environment-variables): Apply a better check for
unset variable.
Paul Eggert [Mon, 22 Apr 2019 04:47:10 +0000 (21:47 -0700)]
Remove --enable-checking=xmallocoverrun
It doesn’t work anymore, and these days ‘gcc -fsanitize=address’
does a better job anyway.
* configure.ac: Remove the option.
* configure.ac (ac_xmalloc_overrun, XMALLOC_OVERRUN_CHECK):
* src/alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD)
(XMALLOC_OVERRUN_CHECK_SIZE, XMALLOC_OVERRUN_SIZE_SIZE)
(xmalloc_overrun_check_header, xmalloc_overrun_check_trailer)
(xmalloc_put_size, xmalloc_get_size, overrun_check_malloc)
(overrun_check_realloc, overrun_check_free):
Remove. All uses removed.
* etc/NEWS: Mention this.
Paul Eggert [Mon, 22 Apr 2019 04:45:04 +0000 (21:45 -0700)]
Simplify XPNTR
Because XPNTR now uses ATTRIBUTE_NO_SANITIZE_UNDEFINED,
it can be simplified.
* src/alloc.c (macro_PNTR_ADD, PNTR_ADD, macro_XPNTR): Remove.
(XPNTR): Open-code rather than using the removed macros and
functions. Also, simplify by using LISP_WORD_TAG.
Paul Eggert [Mon, 22 Apr 2019 04:16:03 +0000 (21:16 -0700)]
Fix drain_reloc_list alignment bug
* src/pdumper.c (dump_charset): Use alignof (struct charset),
not alignof (int), since struct charset might be more strictly
aligned than int. I think this is just a minor performance
issue, but we might as well use the correct alignment.
(drain_reloc_list): Use an alignment instead of a size for the
output alignment. This prevents undefined behavior when
alignof (struct emacs_reloc) == 8 and sizeof (dump_off) == 4
when building on x86-64 with gcc -fsanitize=undefined.
Paul Eggert [Mon, 22 Apr 2019 03:36:56 +0000 (20:36 -0700)]
Port dump_bitset_clear to -fsanitize=undefined
* src/pdumper.c (dump_bitset_clear):
Pacify -fsanitize=undefined by avoiding memset (NULL, x, 0),
which strictly speaking has undefined behavior although it
works on all production platforms I know.
Paul Eggert [Mon, 22 Apr 2019 03:34:03 +0000 (20:34 -0700)]
Port to recent gcc -fsanitize=undefined
* src/alloc.c (XPNTR): Add ATTRIBUTE_NO_SANITIZE_UNDEFINED and
remove ATTRIBUTE_UNUSED. Do not define as a macro, so that
ATTRIBUTE_NO_SANITIZE_UNDEFINED works.
* src/lisp.h (lisp_h_XSYMBOL): Remove. All uses removed.
With recent GCC the macro does not work with -fsanitize=undefined,
and the macro can be omitted as its only function is to optimize -O0.