From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48264: [PATCH v3 15/15] Add and use BVAR_FIELD macros Date: Sat, 08 May 2021 16:58:17 +0300 Message-ID: <83a6p59vk6.fsf@gnu.org> References: <877dkbsj9d.fsf@catern.com> <20210506213346.9730-16-sbaugh@catern.com> <835yzudcvz.fsf@gnu.org> <87o8dmr96v.fsf@catern.com> <83tunebsiu.fsf@gnu.org> <87mtt6p6co.fsf@catern.com> <83sg2xaf4l.fsf@gnu.org> <87czu1pcv0.fsf@catern.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36295"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48264@debbugs.gnu.org To: Spencer Baugh , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 08 15:59:25 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 1lfNUL-0009Jg-UP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 May 2021 15:59:25 +0200 Original-Received: from localhost ([::1]:41962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfNUK-0003k6-5U for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 May 2021 09:59:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfNTy-0003jy-SK for bug-gnu-emacs@gnu.org; Sat, 08 May 2021 09:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfNTy-0007bC-6F for bug-gnu-emacs@gnu.org; Sat, 08 May 2021 09:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lfNTy-0001fA-0k for bug-gnu-emacs@gnu.org; Sat, 08 May 2021 09:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 May 2021 13:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48264 X-GNU-PR-Package: emacs Original-Received: via spool by 48264-submit@debbugs.gnu.org id=B48264.16204823086377 (code B ref 48264); Sat, 08 May 2021 13:59:01 +0000 Original-Received: (at 48264) by debbugs.gnu.org; 8 May 2021 13:58:28 +0000 Original-Received: from localhost ([127.0.0.1]:50462 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfNTP-0001en-K5 for submit@debbugs.gnu.org; Sat, 08 May 2021 09:58:27 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfNTO-0001eg-8n for 48264@debbugs.gnu.org; Sat, 08 May 2021 09:58:26 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34328) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfNTI-0007CA-Hh; Sat, 08 May 2021 09:58:20 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2584 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfNTH-0002Nk-Ej; Sat, 08 May 2021 09:58:20 -0400 In-Reply-To: <87czu1pcv0.fsf@catern.com> (message from Spencer Baugh on Sat, 08 May 2021 09:35:31 -0400) 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:206018 Archived-At: > From: Spencer Baugh > Cc: 48264@debbugs.gnu.org > Date: Sat, 08 May 2021 09:35:31 -0400 > > > So how about using _d_ of _def_instead? It's much shorter and > > expresses the purpose no worse than _defaulted_. > > Sure, that would work. > > >> Keep in mind though, this name isn't exposed to the programmer > >> anywhere - it might as well be _ABCDEFGHI_, nothing will change > >> outside the definition of the BVAR_DEFAULTED_FIELD macro. > > > > See above: I'd prefer to get rid of the macro for this purpose. > > Sure, we could mostly get rid of it, although it's important that the > argument to BVAR_OR_DEFAULT be "case_fold_search" rather than, say, > "case_fold_search_def", even if the field is named the latter. > Otherwise one might accidentally call BVAR with "case_fold_search_def", > which would compile but behave wrong at runtime - and preventing that is > the whole point of the different names. I agree, but I'm not sure I see the connection. Can you tell how getting rid of the macro in the likes of b->SOME_MACRO(foo) could run afoul of the argument to BVAR_OR_DEFAULT? > >> (eassert (EQ (buffer_defaults->field ## _)); (buf)->field ## _) > >> > >> Which would make sure that it's not used on anything with a default. > >> But of course that's substantially more annoying than a compile time > >> check... > > > > I'm not sure I understand why this is much more annoying, can you > > elaborate? We have similar assertions, conditioned on > > ENABLE_CHECKING, elsewhere in our macros, like XWINDOW etc, so why not > > here? > > I mean that it's annoying that merely compiling doesn't detect the usage > error, one has to actually run tests. Well, with eassert just running Emacs will sooner or later crash with SIGABRT, so I think it's acceptable. Again, we do that in other cases, quite a lot, actually, so there's no reason to treat this particular case differently. > If you think such a conditionally-compiled runtime check would be > acceptable for applying these changes, I can go ahead and write that. Yes, I think so. But if Lars or Stefan think differently, I might reconsider.