From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.bugs Subject: bug#46988: 28.0.50; Documenting and verifying assumptions about C code not calling quit or GCing Date: Wed, 10 Mar 2021 10:28:52 -0800 Message-ID: <87a6ra7ti3.fsf@rfc20.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15457"; mail-complaints-to="usenet@ciao.gmane.io" To: Pip Cet , 46988@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 10 19:30:22 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lK3bA-0003tZ-Fv for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Mar 2021 19:30:20 +0100 Original-Received: from localhost ([::1]:51374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lK3b9-0004Z2-FI for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Mar 2021 13:30:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lK3as-0004Ym-Py for bug-gnu-emacs@gnu.org; Wed, 10 Mar 2021 13:30:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40281) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lK3as-0002SH-Ht for bug-gnu-emacs@gnu.org; Wed, 10 Mar 2021 13:30:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lK3as-0004bv-Da for bug-gnu-emacs@gnu.org; Wed, 10 Mar 2021 13:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Matt Armstrong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Mar 2021 18:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46988 X-GNU-PR-Package: emacs Original-Received: via spool by 46988-submit@debbugs.gnu.org id=B46988.161540094517634 (code B ref 46988); Wed, 10 Mar 2021 18:30:02 +0000 Original-Received: (at 46988) by debbugs.gnu.org; 10 Mar 2021 18:29:05 +0000 Original-Received: from localhost ([127.0.0.1]:51827 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lK3Zx-0004aM-Df for submit@debbugs.gnu.org; Wed, 10 Mar 2021 13:29:05 -0500 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:57499) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lK3Zu-0004Zr-S1 for 46988@debbugs.gnu.org; Wed, 10 Mar 2021 13:29:03 -0500 Original-Received: from mdeb (24-113-169-116.wavecable.com [24.113.169.116]) (Authenticated sender: matt@rfc20.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id B541B100004; Wed, 10 Mar 2021 18:28:55 +0000 (UTC) Original-Received: from matt by mdeb with local (Exim 4.94) (envelope-from ) id 1lK3Zk-000mlB-41; Wed, 10 Mar 2021 10:28:52 -0800 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:202025 Archived-At: Pip Cet writes: Hey Pip, just minor comments from me. (I assume you already plan to put the use of the cleanup attribute behind conditional macros for portability) Why a linked list/stack implementation? How about a global count var that is incremented, decremented, and asserted zero? You wrote that this impl depends on the stack direction, but I can't figure out why. If it is indeed the case, add a comment explaining this? As a macro name, I think something like ASSERT_NO_GC_IN_SCOPE would be clearer. Signaling that this is a "magical" scope based construct is useful because this sort of thing is so unusual in C. The first thing I looked for was an "END_SCOPE" macro and started scratching my head. I'd also use a clear that indicates a debug time check (ASSERT, CRASH_IF, etc.) "Don't allow" states an invariant but does not clearly indicate a consequence or other intent. It could imply something as polite as "GC is disabled for this scope". For the C level stuff, maybe call it gc_forbidden_scope? > + /* Do not wrap into do { } while (0). */ Move the comment next to the #define. Ideally, don't issue a command for the next programmer but instead explain why the code is the way is.