diff options
| author | Paul Eggert | 2024-08-16 16:59:08 -0700 |
|---|---|---|
| committer | Paul Eggert | 2024-08-16 21:16:35 -0700 |
| commit | cfa5a634e91f5c232a71ec212679165074dc480b (patch) | |
| tree | 21c55015e23d8f501f376a16b2c784ebef8615c9 | |
| parent | 2169a9387a5ac22b969d37ece4ec1aaa0fd830d9 (diff) | |
| download | emacs-cfa5a634e91f5c232a71ec212679165074dc480b.tar.gz emacs-cfa5a634e91f5c232a71ec212679165074dc480b.zip | |
Don’t ignore -Wclobbered in emacs-module.c
This fix is also prompted by Emacs bug#71744.
* src/emacs-module.c: Do not ignore -Wclobbered.
(MODULE_HANDLE_NONLOCAL_EXIT): Fix violations of the C standard,
where setjmp clobbered env and internal_cleanup.
(module_extract_big_integer) [GCC_LINT && __GNUC__ && !__clang__]:
Work around GCC -Wclobbered false positive for ‘sign’.
| -rw-r--r-- | src/emacs-module.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index 05aa0baef74..5aa4cfa0ae8 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -96,11 +96,6 @@ To add a new module function, proceed as follows: | |||
| 96 | #include <intprops.h> | 96 | #include <intprops.h> |
| 97 | #include <verify.h> | 97 | #include <verify.h> |
| 98 | 98 | ||
| 99 | /* Work around GCC bug 83162. */ | ||
| 100 | #if GNUC_PREREQ (4, 3, 0) | ||
| 101 | # pragma GCC diagnostic ignored "-Wclobbered" | ||
| 102 | #endif | ||
| 103 | |||
| 104 | /* We use different strategies for allocating the user-visible objects | 99 | /* We use different strategies for allocating the user-visible objects |
| 105 | (struct emacs_runtime, emacs_env, emacs_value), depending on | 100 | (struct emacs_runtime, emacs_env, emacs_value), depending on |
| 106 | whether the user supplied the -module-assertions flag. If | 101 | whether the user supplied the -module-assertions flag. If |
| @@ -273,14 +268,17 @@ module_decode_utf_8 (const char *str, ptrdiff_t len) | |||
| 273 | module_out_of_memory (env); \ | 268 | module_out_of_memory (env); \ |
| 274 | return retval; \ | 269 | return retval; \ |
| 275 | } \ | 270 | } \ |
| 276 | struct handler *internal_cleanup \ | 271 | emacs_env *env_volatile = env; \ |
| 272 | struct handler *volatile internal_cleanup \ | ||
| 277 | = internal_handler; \ | 273 | = internal_handler; \ |
| 278 | if (sys_setjmp (internal_cleanup->jmp)) \ | 274 | if (sys_setjmp (internal_handler->jmp)) \ |
| 279 | { \ | 275 | { \ |
| 276 | emacs_env *env = env_volatile; \ | ||
| 277 | struct handler *internal_handler = internal_cleanup; \ | ||
| 280 | module_handle_nonlocal_exit (env, \ | 278 | module_handle_nonlocal_exit (env, \ |
| 281 | internal_cleanup->nonlocal_exit, \ | 279 | internal_handler->nonlocal_exit, \ |
| 282 | internal_cleanup->val); \ | 280 | internal_handler->val); \ |
| 283 | module_reset_handlerlist (internal_cleanup); \ | 281 | module_reset_handlerlist (internal_handler); \ |
| 284 | return retval; \ | 282 | return retval; \ |
| 285 | } \ | 283 | } \ |
| 286 | do { } while (false) | 284 | do { } while (false) |
| @@ -1045,6 +1043,15 @@ static bool | |||
| 1045 | module_extract_big_integer (emacs_env *env, emacs_value arg, int *sign, | 1043 | module_extract_big_integer (emacs_env *env, emacs_value arg, int *sign, |
| 1046 | ptrdiff_t *count, emacs_limb_t *magnitude) | 1044 | ptrdiff_t *count, emacs_limb_t *magnitude) |
| 1047 | { | 1045 | { |
| 1046 | #if GCC_LINT && __GNUC__ && !__clang__ | ||
| 1047 | /* These useless assignments pacify GCC 14.2.1 x86-64 | ||
| 1048 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21161>. */ | ||
| 1049 | { | ||
| 1050 | int *volatile sign_volatile = sign; | ||
| 1051 | sign = sign_volatile; | ||
| 1052 | } | ||
| 1053 | #endif | ||
| 1054 | |||
| 1048 | MODULE_FUNCTION_BEGIN (false); | 1055 | MODULE_FUNCTION_BEGIN (false); |
| 1049 | Lisp_Object o = value_to_lisp (arg); | 1056 | Lisp_Object o = value_to_lisp (arg); |
| 1050 | CHECK_INTEGER (o); | 1057 | CHECK_INTEGER (o); |