[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: __attribute__ ((cleanup)) and emacs-module.c
From: |
Po Lu |
Subject: |
Re: __attribute__ ((cleanup)) and emacs-module.c |
Date: |
Sun, 12 Mar 2023 08:42:41 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Paul Eggert <eggert@cs.ucla.edu> writes:
> On 2023-03-10 17:37, Po Lu wrote:
>
>> +#define MODULE_INTERNAL_CLEANUP \
>> + module_reset_handlerlist (&internal_cleanup)
>
> No need for the "&" here. Omit it, and change the type of
> module_reset_handlerlist to take 'struct handler *' instead of 'struct
> handler **'.
>
> Also, please make this macro a parameterless function-style macro
> called via 'MODULE_INTERNAL_CLEANUP ()' as it acts like a function.
OK, will do.
> Also, please define a macro MODULE_FUNCTION_END something like this:
>
> #define MODULE_FUNCTION_END(retval) \
> (MODULE_INTERNAL_CLEANUP (), retval)
>
> and use 'return MODULE_FUNCTION_END (<simple-expression>);' when the
> cleanup is immediately followed by a return of a value of a simple
> expression. For complex expressions that can throw exceptions, you can
> use something like:
>
> <type> r = <complex-expression>;
> return MODULE_FUNCTION_END (r);
I think this is likely to be confusing, because people won't realize the
situations in which it cannot be used, and we will end up with code
like:
return MODULE_FUNCTION_END (Fthis_thing_that_calls_xmalloc ())
- Re: Merging feature/android, (continued)
- Re: Merging feature/android, Po Lu, 2023/03/08
- Re: Merging feature/android, Eli Zaretskii, 2023/03/09
- Re: Merging feature/android, Po Lu, 2023/03/09
- Re: Merging feature/android, Eli Zaretskii, 2023/03/09
- __attribute__ ((cleanup)) and emacs-module.c, Po Lu, 2023/03/09
- Re: __attribute__ ((cleanup)) and emacs-module.c, Philipp Stephani, 2023/03/09
- Re: __attribute__ ((cleanup)) and emacs-module.c, Po Lu, 2023/03/09
- Re: __attribute__ ((cleanup)) and emacs-module.c, Paul Eggert, 2023/03/10
- Re: __attribute__ ((cleanup)) and emacs-module.c, Po Lu, 2023/03/10
- Re: __attribute__ ((cleanup)) and emacs-module.c, Paul Eggert, 2023/03/11
- Re: __attribute__ ((cleanup)) and emacs-module.c,
Po Lu <=
- Re: __attribute__ ((cleanup)) and emacs-module.c, Paul Eggert, 2023/03/11
- Re: Merging feature/android, Eli Zaretskii, 2023/03/08
- Re: Merging feature/android, Arsen Arsenović, 2023/03/06
- Re: Merging feature/android, Po Lu, 2023/03/06
- Re: Merging feature/android, Arsen Arsenović, 2023/03/06
- Re: Merging feature/android, Po Lu, 2023/03/06
- Re: Merging feature/android, Eli Zaretskii, 2023/03/05
- Re: Merging feature/android, Po Lu, 2023/03/05
- Re: Merging feature/android, Richard Stallman, 2023/03/04
- Re: Merging feature/android, Po Lu, 2023/03/05