Paul Eggert [Mon, 12 Jun 2017 17:38:27 +0000 (10:38 -0700)]
_Noreturn not noreturn
_Noreturn is more portable to non-C11 platforms. See:
https://www.gnu.org/software/gnulib/manual/html_node/stdnoreturn_002eh.html
* src/emacs-module.c: Use _Noreturn, not noreturn. No need to
include <stdnoreturn.h>. Reindent to fit in 80 columns.
Eli Zaretskii [Mon, 12 Jun 2017 15:04:04 +0000 (18:04 +0300)]
Avoid compilation warnings with pre-C99 libc
* src/emacs-module.c (module_free_global_ref)
(module_assert_runtime, module_assert_env, value_to_lisp): Use 'pD'
instead of C99 't' format descriptor.
Add a new command-line option '-module-assertions' that users can
enable developing or debugging a module. If this option is present,
Emacs performs additional checks to verify that modules fulfill their
requirements. These checks are expensive and crash Emacs if modules
are invalid, so disable them by default.
This is a command-line option instead of an ordinary variable because
changing it while Emacs is running would cause data structure
imbalances.
* src/emacs.c (main): New command line option '-module-assertions'.
* src/emacs-module.c (module_assert_main_thread)
(module_assert_runtime, module_assert_env, module_assert_value):
New functions to assert module requirements.
(syms_of_module): New uninterned variable 'module-runtimes'.
(init_module_assertions, in_main_thread, module_abort): New helper
functions.
(initialize_environment): Initialize value list. If assertions are
enabled, use a heap-allocated environment object.
(finalize_environment): Add assertion that environment list is never
empty.
(finalize_runtime_unwind): Pop module runtime object stack.
(value_to_lisp): Assert that the value is valid.
(lisp_to_value): Record new value if assertions are enabled.
(mark_modules): Mark allocated object list.
(MODULE_FUNCTION_BEGIN_NO_CATCH)
(module_non_local_exit_check, module_non_local_exit_clear)
(module_non_local_exit_get, module_non_local_exit_signal)
(module_non_local_exit_throw): Assert thread and environment.
(module_get_environment): Assert thread and runtime.
(module_make_function, module_funcall, module_intern)
(module_funcall, module_make_integer, module_make_float)
(module_make_string, module_make_user_ptr, module_vec_get)
(funcall_module, Fmodule_load): Adapt callers.
(module_make_global_ref): If assertions are enabled, use the global
environment to store global values.
(module_free_global_ref): Remove value from global value list.
* test/Makefile.in (EMACSOPT): Enable module assertions when testing
modules.
* test/data/emacs-module/mod-test.c (Fmod_test_invalid_store)
(Fmod_test_invalid_load): New functions to test module assertions.
(emacs_module_init): Bind the new functions.
* test/src/emacs-module-tests.el (mod-test-emacs): New constant for
the Emacs binary file.
(mod-test-file): New constant for the test module file name.
(module--test-assertions): New unit test.
Paul Eggert [Mon, 12 Jun 2017 00:29:21 +0000 (17:29 -0700)]
Merge from gnulib
This incorporates:
2017-06-11 getopt-posix: port to glibc 2.25.90
2017-06-04 same-inode: port better to VMS 8.2 and later
* doc/misc/texinfo.tex, lib/getopt-pfx-core.h, lib/getopt-pfx-ext.h:
* m4/sys_types_h.m4: Copy from gnulib.
Paul Eggert [Mon, 12 Jun 2017 00:05:03 +0000 (17:05 -0700)]
Remove Lisp_Misc_Float
* src/data.c (Ftype_of): Do not worry about Lisp_Misc_Float.
* src/lisp.h (Lisp_Misc_Float): Remove. This placeholder has been
unused for two decades; if we ever want to change floats to be a
misc type we can bring it back then.
Glenn Morris [Sun, 11 Jun 2017 23:20:40 +0000 (16:20 -0700)]
Merge from origin/emacs-25
eaa00584ceb Improve documentation of 'gnutls-verify-error' 908498cc01b ; etc/PROBLEMS: Describe GTK-related crashes on elementar... 741daec617e ; Describe the problem with ksh when resizing shell window
Simen Heggestøyl [Sun, 11 Jun 2017 15:41:09 +0000 (17:41 +0200)]
Fix highlighting of CSS selectors with double hyphens
* lisp/textmodes/css-mode.el (css--font-lock-keywords): Fix
highlighting of selectors that contain double hyphens. They would be
mistaken for a variable.
Philipp Stephani [Sun, 11 Jun 2017 12:50:20 +0000 (14:50 +0200)]
Allow non-local exits in module initializers
Previously signals, throws, and quits from module initialization
functions were ignored. These function aren't special, and better
errors can be reported using signals than with the initialization
return code, so allow non-local exits.
* src/emacs-module.c (module_signal_or_throw): New helper function.
(Fmodule_load, funcall_module): Use it.
(Fmodule_load): Also allow quitting.
Michael Albinus [Sat, 10 Jun 2017 08:57:19 +0000 (10:57 +0200)]
Fix domain port and handling in tramp-gvfs.el
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-byte-array-to-string):
Return nil if BYTE-ARRAY is nil.
(tramp-gvfs-url-file-name, tramp-gvfs-handler-mounted-unmounted)
(tramp-gvfs-connection-mounted-p, tramp-gvfs-mount-spec):
Fix domain and port handling.
Eli Zaretskii [Sat, 10 Jun 2017 08:29:58 +0000 (11:29 +0300)]
Fix handling of Python/Guile commands with arguments in gdb-mi.el
* lisp/progmodes/gdb-mi.el (gdb-python-guile-commands-regexp): New
variable.
(gdb-control-commands-regexp): Use it.
(gdb-send): Don't increment gdb-control-level if the command
matches gdb-python-guile-commands-regexp and has non-empty
arguments. Reported by David Boles <boles@ieee.org> in
http://lists.gnu.org/archive/html/emacs-devel/2017-06/msg00009.html.
Eli Zaretskii [Sat, 10 Jun 2017 08:22:50 +0000 (11:22 +0300)]
Preserve point in Dired windows under 'dired-auto-revert-buffer'
* lisp/dired.el (dired-find-file): When dired-auto-revert-buffer
is non-nil, bind switch-to-buffer-preserve-window-point to nil
while calling find-file. (Bug#27243)
Philipp Stephani [Fri, 19 May 2017 08:58:58 +0000 (10:58 +0200)]
Give test files a -tests.el suffix
Rename a couple of test files that have the same name as the library
they test. This harmonizes the naming pattern and makes it possible
to have the tests directories in the load path.
* lisp/emacs-lisp/cl-macs.el (cl--sm-macroexpand): Remove.
(cl-symbol-macrolet): Instead of adding each binding directly into the
main environment with a special key format, put all symbol macro
bindings into a single entry in the main environment under
`:cl-symbol-macros'.
(cl--sm-macroexpand): Look up symbol bindings in the
`:cl-symbol-macros' entry of the environment.
Glenn Morris [Tue, 6 Jun 2017 00:39:29 +0000 (20:39 -0400)]
Make authors.el report names that were ignored
* admin/authors.el (authors-ignored-names): New.
(authors-canonical-author-name): Add file and position arguments.
Record ignored authors.
(authors-scan-change-log, authors-scan-el):
Pass file and position to authors-canonical-author-name.
(authors): Also print authors that were ignored.
Eli Zaretskii [Mon, 5 Jun 2017 16:16:04 +0000 (19:16 +0300)]
Fix emacs-module-tests on MS-Windows
* src/print.c (print_vectorlike): Make sure module function's
address prints with a leading "0x". This fixes emacs-module-tests
on MS-Windows. Fix whitespace.
* src/dynlib.c (dynlib_addr): Remove unused variable. Update
commentary.
Use unwind protection to clean up data structures in modules
Reuse existing functionality and simplify the code a bit.
* src/emacs-module.c (Fmodule_load): Use unwind protection to clean up
runtime object.
(funcall_module): Use unwind protection to clean up environment
object.
(finalize_environment): Simplify signature.
(finalize_environment_unwind, finalize_runtime_unwind): New functions.
Michael Albinus [Mon, 5 Jun 2017 10:59:26 +0000 (12:59 +0200)]
Some minor tweaks in tramp-tests.el
* test/lisp/net/tramp-tests.el (tramp-test05-expand-file-name-relative):
Let it pass for all gfvs based methods.
(tramp-test24-file-name-completion): Run method and host
completion for all syntaxes only when expensive tests are enabled.
Do not check host completion for gvfs based methods.
(tramp--test-gvfs-p): Add optional METHOD argument.
(tramp--test-afp-or-smb-p): Remove.
Paul Eggert [Mon, 5 Jun 2017 06:52:10 +0000 (23:52 -0700)]
Remove easserts etc. from emacs-module.c
Most of these seem to run afoul of the comment "Do NOT use
'eassert' for checking validity of user code in the module."
* src/emacs-module.c (MODULE_FUNCTION_BEGIN_NO_CATCH)
(module_non_local_exit_check, module_non_local_exit_clear)
(module_non_local_exit_get, module_non_local_exit_signal)
(module_non_local_exit_throw, module_make_string):
Remove unnecessary easserts that pointers are nonnull.
Hardware checks this for us nowadays, and the checks
just clutter up the code.
(module_extract_integer): Remove unnecessary verify that
a C signed integer is in the range INTMAX_MIN..INTMAX_MAX.
The C standard guarantees this.
(module_copy_string_contents): Remove unnecessary eassert
that Lisp strings are null-terminated.
(module_function_arity): Remove unnecessary easserts that
function arities are in range.
Paul Eggert [Mon, 5 Jun 2017 06:52:10 +0000 (23:52 -0700)]
Remove unnecessary checking in emacs-module.c
* src/emacs-module.c (module_copy_string_contents):
Remove checking, as string lengths are always nonnegative and less
than STRING_BYTES_BOUND, and this is checked elsewhere.
(module_make_string): Check length against STRING_BYTES_BOUND, a
tighter bound than MOST_POSITIVE_FIXNUM. (funcall_module): Don't
assume that an out-of-range integer is nonnegative.
Paul Eggert [Mon, 5 Jun 2017 06:52:10 +0000 (23:52 -0700)]
SCHARS and STRING_BYTES are nonnegative
Tell the compiler that SCHARS and STRING_BYTES are nonnegative, in
the hopes that this will optimize a bit better. Also, check this
at runtime if ENABLE_CHECKING.
* src/lisp.h (SCHARS, STRING_BYTES):
eassume that these functions return nonnegative values.
(STRING_SET_CHARS) [ENABLE_CHECKING]:
eassert that newsize is nonnegative.
* src/emacs-module.c (Fmodule_load, funcall_module): Adapt callers.
(finalize_environment): Add parameter for public part of the
environment, like 'initialize_environment'. Add assertions.
Fix a FIXME in emacs-module.c. Put the printing into print.c, like
other types.
* src/print.c (print_vectorlike): Add code to print module functions.
* src/emacs-module.c (funcall_module): Stop calling
'module_format_fun_env'. Now that module functions are first-class
objects, they can be added to signal data directly.
(module_handle_signal): Remove now-unused function
'module_format_fun_env'.
* test/src/emacs-module-tests.el (mod-test-sum-test): Adapt unit test.
* src/eval.c (funcall_lambda): Adapt call to changed signature of
'funcall_module'.
* src/emacs-module.c (MODULE_FUNCTION_BEGIN_NO_CATCH): New helper
macro.
(MODULE_FUNCTION_BEGIN, module_type_of, module_is_not_nil, module_eq):
Use it.
Paul Eggert [Sun, 4 Jun 2017 15:39:37 +0000 (08:39 -0700)]
Tune ‘format’ after recent fix
* doc/lispref/strings.texi (Formatting Strings):
* src/editfns.c (Fformat): Format field numbers no longer need
to be unique, reverting the previous doc change since that has
now been fixed. Also, document that %% should not have modifiers.
* src/editfns.c (styled_format): Improve performance. Remove
the need for the new prepass over the format string, by using
a typically-more-generous bound for the info array size.
Initialize the info array lazily. Move string inspection to
the same area to help caching. Avoid the need for a
converted_to_string bitfield by using EQ. Cache arg in a
local and avoid some potential aliasing issues to help the
compiler. Info array is now 0-origin, not 1-origin.
Previously styled_format overwrite the argument vector. This is no
longer possible because there might be more than one specification per
argument. Use the existing auxiliary info array instead.
* src/editfns.c (styled_format): Record arguments in the info
structure instead of overwriting them.
* test/src/editfns-tests.el (format-with-field): Add unit test.