unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Sergey Vinokurov <serg.foo@gmail.com>
Cc: Philipp Stephani <phst@google.com>,
	69953@debbugs.gnu.org, Daniel Colascione <dancol@dancol.org>
Subject: bug#69953: [PATCH] Remove duplicated asserts and checks
Date: Sat, 23 Mar 2024 09:15:04 +0200	[thread overview]
Message-ID: <86o7b5zafb.fsf@gnu.org> (raw)
In-Reply-To: <9378099f-76e1-45b4-8e4d-0f077cb28307@gmail.com> (message from Sergey Vinokurov on Sat, 23 Mar 2024 03:27:34 +0000)

> Date: Sat, 23 Mar 2024 03:27:34 +0000
> From: Sergey Vinokurov <serg.foo@gmail.com>
> 
> I noticed that emacs-module.c contains duplicate 
> module_non_local_exit_check() checks and 
> module_assert_thread/module_assert_env asserts, mostly performed at the 
> same point in program sequentially.
> 
> The module_non_local_exit_check() checks happen in 
> MODULE_HANDLE_NONLOCAL_EXIT and MODULE_FUNCTION_BEGIN_NO_CATCH macros. 
> The MODULE_HANDLE_NONLOCAL_EXIT is never used by itself, only as part of 
> MODULE_FUNCTION_BEGIN which starts with MODULE_FUNCTION_BEGIN_NO_CATCH 
> that performs the check.
> 
> In addition, there're 6 "Implementation of runtime and environment 
> functions" rules outlined where MODULE_HANDLE_NONLOCAL_EXIT should be 
> called at step 4 but module_non_local_exit_check() is supposed to have 
> already happened at step 3 so documentation does not seem to intend for 
> the check to be repeated in MODULE_HANDLE_NONLOCAL_EXIT.
> 
> Regarding asserts my observation is that module_non_local_exit_check() 
> already contains module_assert_thread and module_assert_env so there's 
> no need to do asserts if first thing we do is call 
> module_non_local_exit_check.

Thanks, but why is that a problem?  module_assertions is false by
default, and the function to turn on module assertions is not even
documented in the ELisp manual.  IOW, this is a debugging aid which
will rarely if at all activated, and if it is, that's on purpose by
the programmer who is investigating some tricky problem.  Why is it a
problem to have too many assertions, which might help that programmer
find a bug?

I added Daniel and Philipp to the discussion, in case they have
comments to this proposal.





  reply	other threads:[~2024-03-23  7:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-23  3:27 bug#69953: [PATCH] Remove duplicated asserts and checks Sergey Vinokurov
2024-03-23  7:15 ` Eli Zaretskii [this message]
2024-03-23 12:38   ` Sergey Vinokurov
2024-04-13  7:42   ` Eli Zaretskii
2024-04-27  8:27     ` Eli Zaretskii
2024-05-09  7:24       ` Eli Zaretskii
2024-05-09 14:16         ` Sergey Vinokurov
2024-05-11 10:02           ` Eli Zaretskii
2024-05-11 12:12             ` Sergey Vinokurov
2024-05-11 12:18               ` Eli Zaretskii
2024-05-11 12:57                 ` Sergey Vinokurov
2024-05-11 13:05                   ` Eli Zaretskii
2024-05-11 13:11           ` Daniel Colascione

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86o7b5zafb.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=69953@debbugs.gnu.org \
    --cc=dancol@dancol.org \
    --cc=phst@google.com \
    --cc=serg.foo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).