summaryrefslogtreecommitdiff
path: root/src/module-env-28.h
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2018-02-11 21:38:22 +0100
committerPhilipp Stephani <phst@google.com>2020-01-03 19:24:10 +0100
commit48ffef5ef4b34799941a033591ea827d40025939 (patch)
tree67b00c1bc546f3c9ef601c10db634da3094f7f57 /src/module-env-28.h
parent2b6d702e5d2d572640c6bcd43f54138bacbe7ac8 (diff)
downloademacs-48ffef5ef4b34799941a033591ea827d40025939.tar.gz
emacs-48ffef5ef4b34799941a033591ea827d40025939.tar.bz2
emacs-48ffef5ef4b34799941a033591ea827d40025939.zip
Implement finalizers for module functions (Bug#30373)
* src/module-env-28.h: Add new module environment functions to module environment for Emacs 28. * src/emacs-module.h.in: Document that 'emacs_finalizer' also works for function finalizers. * src/emacs-module.c (CHECK_MODULE_FUNCTION): New function. (struct Lisp_Module_Function): Add finalizer data member. (module_make_function): Initialize finalizer. (module_get_function_finalizer) (module_set_function_finalizer): New module environment functions. (module_finalize_function): New function. (initialize_environment): Initialize new environment functions. * src/alloc.c (cleanup_vector): Call potential module function finalizer during garbage collection. * test/data/emacs-module/mod-test.c (signal_error): New helper function. (memory_full): Use it. (finalizer): New example function finalizer. (Fmod_test_make_function_with_finalizer) (Fmod_test_function_finalizer_calls): New test module functions. (emacs_module_init): Define them. * test/src/emacs-module-tests.el (module/function-finalizer): New unit test. * doc/lispref/internals.texi (Module Functions): Document new functionality. (Module Misc): Move description of 'emacs_finalizer' type to 'Module Functions' node, and add a reference to it. * etc/NEWS: Mention new functionality.
Diffstat (limited to 'src/module-env-28.h')
-rw-r--r--src/module-env-28.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/module-env-28.h b/src/module-env-28.h
index dec8704edde..a2479a8f744 100644
--- a/src/module-env-28.h
+++ b/src/module-env-28.h
@@ -1,3 +1,11 @@
/* Add module environment functions newly added in Emacs 28 here.
Before Emacs 28 is released, remove this comment and start
module-env-29.h on the master branch. */
+
+ void (*(*EMACS_ATTRIBUTE_NONNULL (1)
+ get_function_finalizer) (emacs_env *env,
+ emacs_value arg)) (void *) EMACS_NOEXCEPT;
+
+ void (*set_function_finalizer) (emacs_env *env, emacs_value arg,
+ void (*fin) (void *) EMACS_NOEXCEPT)
+ EMACS_ATTRIBUTE_NONNULL (1);