diff options
author | Paul Smith <psmith@gnu.org> | 2023-05-07 16:51:12 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2023-05-14 18:26:35 -0400 |
commit | 1748e6641419e8a48f830caad072ed5b298577af (patch) | |
tree | a0650a8ee54b5ec4020a5b1277bd70cd903d4ac2 /src/main.c | |
parent | 8e0e6c678f3cf1199751e3b097745531ceed34ed (diff) | |
download | make-git-1748e6641419e8a48f830caad072ed5b298577af.tar.gz |
[SV 63219] Support an "unload" function for loaded objects
If a loaded object defines a symbol <object>_gmk_unload, assume it's
a function and invoke it whenever the loaded object is unloaded.
Original implementation by Dmitry Goncharov <dgoncharov@users.sf.net>
* NEWS: Announce the change.
* doc/make.texi: Describe the behavior.
* src/gnumake.h: Add information to the comments.
* src/makeint.h (unload_all): Declare a new function.
* src/main.c (die): Invoke unload_all().
* src/load.c (unload_func_t): Declare a new type for unload.
(struct load_list): Remember the unload symbol if it exists.
(load_object): Move the parsing of the object name from load_file.
Check for the _gmk_unload symbol and if found, remember it.
(load_file): Allow load_object to do object filename parsing.
(unload_file): Remove the load_list entry when unloading the object.
(unload_all): Unload all the loaded objects.
* tests/scripts/features/loadapi: Test the unload function.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -3815,6 +3815,10 @@ die (int status) if (verify_flag) verify_file_data_base (); + /* Unload plugins before jobserver integrity check in case a plugin + * participates in jobserver. */ + unload_all (); + clean_jobserver (status); if (output_context) |