1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-16 17:19:41 +00:00
emacs/etc
Philipp Stephani cf97132764 Implement module assertions for users
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.
2017-06-12 15:22:27 +02:00
..
charsets Update copyright year to 2017 2016-12-31 19:42:26 -08:00
e
forms Update copyright year to 2017 2016-12-31 19:42:26 -08:00
gnus
images Merge from origin/emacs-25 2017-01-01 01:10:47 -08:00
nxml
org Update copyright year to 2017 2016-12-31 19:42:26 -08:00
refcards Merge from origin/emacs-25 2017-01-17 07:34:25 -08:00
schema Update copyright year to 2017 2016-12-31 19:42:26 -08:00
srecode Update copyright year to 2017 2016-12-31 19:42:26 -08:00
themes Fix linum under text-scaling when leuven-theme is used 2017-06-01 17:55:25 +03:00
tutorials * etc/tutorials/TUTORIAL.sv: synced with TUTORIAL (Bug#20371) 2017-06-02 22:16:01 +02:00
AUTHORS ; Update contributor name 2017-05-06 18:38:18 -07:00
CALC-NEWS Update copyright year to 2017 2016-12-31 19:42:26 -08:00
CENSORSHIP
ChangeLog.1 Update copyright year to 2017 2016-12-31 19:42:26 -08:00
compilation.txt Merge from origin/emacs-25 2017-01-01 01:10:47 -08:00
COPYING
DEBUG Replace QUIT with maybe_quit 2017-01-25 21:25:37 -08:00
DEVEL.HUMOR
DISTRIB Update copyright year to 2017 2016-12-31 19:42:26 -08:00
edt-user.el Update copyright year to 2017 2016-12-31 19:42:26 -08:00
emacs-buffer.gdb Merge etc/emacs-buffer.gdb from emacs-25 to master. 2017-06-05 14:08:22 -07:00
emacs.appdata.xml Update copyright year to 2017 2016-12-31 19:42:26 -08:00
emacs.desktop
emacs.icon
emacs.service Rename '--new-daemon' to 'fg-daemon' and '--old-daemon' to '--bg-daemon' 2017-05-29 22:18:55 -04:00
enriched.txt Update copyright year to 2017 2016-12-31 19:42:26 -08:00
ERC-NEWS Update copyright year to 2017 2016-12-31 19:42:26 -08:00
ETAGS.EBNF Update copyright year to 2017 2016-12-31 19:42:26 -08:00
ETAGS.README Update copyright year to 2017 2016-12-31 19:42:26 -08:00
FTP
future-bug
GNU
GNUS-NEWS Merge from origin/emacs-25 2017-01-01 01:10:47 -08:00
gnus-tut.txt Update copyright year to 2017 2016-12-31 19:42:26 -08:00
grep.txt Update copyright year to 2017 2016-12-31 19:42:26 -08:00
HELLO Update copyright year to 2017 2016-12-31 19:42:26 -08:00
HISTORY Set Emacs version to 25.2 and update AUTHORS file 2017-04-20 17:29:11 +02:00
JOKES
LINUX-GNU
MACHINES Merge from origin/emacs-25 2017-01-01 01:10:47 -08:00
MH-E-NEWS ; Spelling fixes for "SpamAssassin" 2017-05-30 08:29:34 -07:00
MORE.STUFF
NEWS Implement module assertions for users 2017-06-12 15:22:27 +02:00
NEWS.1-17 Update copyright year to 2017 2016-12-31 19:42:26 -08:00
NEWS.18 Update copyright year to 2017 2016-12-31 19:42:26 -08:00
NEWS.19 Update copyright year to 2017 2016-12-31 19:42:26 -08:00
NEWS.20 Update copyright year to 2017 2016-12-31 19:42:26 -08:00
NEWS.21 Update copyright year to 2017 2016-12-31 19:42:26 -08:00
NEWS.22 Update copyright year to 2017 2016-12-31 19:42:26 -08:00
NEWS.23 Update copyright year to 2017 2016-12-31 19:42:26 -08:00
NEWS.24 Update copyright year to 2017 2016-12-31 19:42:26 -08:00
NEWS.25 Fixups after merge from emacs-25 2017-03-19 12:39:16 -07:00
NEXTSTEP Update copyright year to 2017 2016-12-31 19:42:26 -08:00
NXML-NEWS Update copyright year to 2017 2016-12-31 19:42:26 -08:00
ORDERS
ORG-NEWS Update copyright year to 2017 2016-12-31 19:42:26 -08:00
package-keyring.gpg
PROBLEMS Merge from origin/emacs-25 2017-06-11 16:20:41 -07:00
ps-prin0.ps Update copyright year to 2017 2016-12-31 19:42:26 -08:00
ps-prin1.ps Update copyright year to 2017 2016-12-31 19:42:26 -08:00
publicsuffix.txt Update publicsuffix.txt. 2016-02-06 16:11:18 +11:00
README Update copyright year to 2017 2016-12-31 19:42:26 -08:00
rgb.txt
ses-example.ses Update copyright year to 2017 2016-12-31 19:42:26 -08:00
spook.lines
TERMS Update copyright year to 2017 2016-12-31 19:42:26 -08:00
THE-GNU-PROJECT
TODO Fix obsolete ‘test/automated’ references 2017-03-27 11:30:08 -07:00
WHY-FREE
yow.lines

This directory contains the architecture-independent files used by or
with Emacs.  This includes some text files of documentation for GNU
Emacs or of interest to Emacs users, and the file of dumped docstrings
for Emacs functions and variables.

COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES

File: emacs.icon
  Author: Sun Microsystems, Inc
  Copyright (C) 1999, 2001-2017 Free Software Foundation, Inc.
  License: GNU General Public License version 3 or later (see COPYING)