From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: sbaugh@catern.com Newsgroups: gmane.emacs.bugs Subject: bug#66326: 29.1.50; There should be a way to promote warnings to errors Date: Tue, 03 Oct 2023 19:16:09 +0000 (UTC) Message-ID: <87wmw3zfd3.fsf@catern.com> References: <83y1gj5ya9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37276"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Spencer Baugh , 66326@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 03 21:17:00 2023 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 1qnkt9-0009Lv-5C for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 03 Oct 2023 21:16:59 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnkt2-0002bF-Gs; Tue, 03 Oct 2023 15:16:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnkt0-0002aN-6A for bug-gnu-emacs@gnu.org; Tue, 03 Oct 2023 15:16:50 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qnksv-0003cm-83 for bug-gnu-emacs@gnu.org; Tue, 03 Oct 2023 15:16:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qnktC-00038D-Ep for bug-gnu-emacs@gnu.org; Tue, 03 Oct 2023 15:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: sbaugh@catern.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Oct 2023 19:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66326 X-GNU-PR-Package: emacs Original-Received: via spool by 66326-submit@debbugs.gnu.org id=B66326.169636059611992 (code B ref 66326); Tue, 03 Oct 2023 19:17:02 +0000 Original-Received: (at 66326) by debbugs.gnu.org; 3 Oct 2023 19:16:36 +0000 Original-Received: from localhost ([127.0.0.1]:40730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qnksl-00037M-II for submit@debbugs.gnu.org; Tue, 03 Oct 2023 15:16:35 -0400 Original-Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143]:3546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qnksj-000377-3i for 66326@debbugs.gnu.org; Tue, 03 Oct 2023 15:16:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=mJJ2QtiSXCyRH2bUJE58u32LpCXiHBHJaEXoH2moam8=; b=qgQK/rfiq9cYgWGZiqHfeNun7/L+mq6T3oCND1hdN9hCk5rWmt1B2avSSP+uyRy7SFfI X4YFMK8mJrOTpDIgyf8wIBwMmk9cKL1VSzYhc0nIetiRU+GiqWgSsvFOu7kDsiFoJf9A3r fNBxdWNxsI/VerGnRLxN5XjXy6dBMtJXd4SCNGZnW0XQO1oGLwTE3vpw6qkOG2C3hPokK+ bXdSxGuGetBgdBSdfI8sh4V7lZDcxTULZjcfsEPhVpzdUKm4pvzcla9AGB9/kzzBJmWFkv FcS7B0AsuO5YYD/eeys2RFfS6LhL6EWcIeuMWSLPPsAwslNa56jxGQF/4Jn5p1xA== Original-Received: by filterdrecv-8684c58db7-fnjnw with SMTP id filterdrecv-8684c58db7-fnjnw-1-651C6879-64 2023-10-03 19:16:09.666180311 +0000 UTC m=+12598670.700885501 Original-Received: from earth.catern.com (unknown) by geopod-ismtpd-4 (SG) with ESMTP id iJNwJsvtRf2CLEgAWiUHFg Tue, 03 Oct 2023 19:16:09.216 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Original-Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 678D262E99; Tue, 3 Oct 2023 15:16:08 -0400 (EDT) In-Reply-To: <83y1gj5ya9.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 03 Oct 2023 21:57:50 +0300") X-SG-EID: ZgbRq7gjGrt0q/Pjvxk7wM0yQFRdOkTJAtEbkjCkHbIkyEN1eRcRPUZS578lrjGm/pFqf3hccczSywezJ+PQzypgJMvDr/O50a5rtSqMiOAec+aLg3lxHmRUJpxmKuvgKaV4ZFrG7GRT1CZqOlhE/PGTvMRCI2ksMA6uaHl9Iu9iQKjEzQJetbXe9JLeDx8Rz9n7jjOpUtKu3sw3za2LQQ== X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:271732 Archived-At: Eli Zaretskii writes: >> From: Spencer Baugh >> Date: Tue, 03 Oct 2023 14:39:02 -0400 >> >> +(defcustom warning-to-error-types nil >> + "List of warning types to signal as an error instead. >> +If any element of this list matches the TYPE argument to `display-warning', >> +an error is signaled instead of logging a warning. > ^^^^^^^^^^^^^^^^^^^^ > Passive voice alert! > >> (defun display-warning (type message &optional level buffer-name) >> "Display a warning message, MESSAGE. >> @@ -263,105 +278,109 @@ display-warning >> disable automatic display of the warning or disable the warning >> entirely by setting `warning-suppress-types' or >> `warning-suppress-log-types' on their behalf." >> - (if (not (or after-init-time noninteractive (daemonp))) >> - ;; Ensure warnings that happen early in the startup sequence >> - ;; are visible when startup completes (bug#20792). >> - (delay-warning type message level buffer-name) >> - (unless level >> - (setq level :warning)) >> - (unless buffer-name >> - (setq buffer-name "*Warnings*")) >> + (unless level >> + (setq level :warning)) >> + (unless buffer-name >> + (setq buffer-name "*Warnings*")) >> + (cond >> + ((< (warning-numeric-level level) >> + (warning-numeric-level warning-minimum-log-level))) >> + ((warning-suppress-p type warning-suppress-log-types)) >> + ((warning-suppress-p type warning-to-error-types) >> + (warning-to-error type message level)) >> + ((not (or after-init-time noninteractive (daemonp))) >> + ;; Ensure warnings that happen early in the startup sequence >> + ;; are visible when startup completes (bug#20792). >> + (delay-warning type message level buffer-name)) >> + (t > > AFAICT, this reorders parts of the evaluation, and thus changes the > semantics/behavior. Please try to keep the order of the evaluation > the same as it was, to avoid unintended consequences. (It will also > make the patch review easier.) Unfortuantely it's not possible to avoid either reordering the evaluation or duplicating some parts of it. Because, of course we want a warning to not become an error if it's listed in warning-suppress-log-types, and we do want it to become an error even if it occurs early in the startup sequence. So the warning-suppress-log-types check has to happen before the to-error check, and the to-error check has to happen before the early-startup check. But currently the warning-suppress-log-types check is after the early-startup check. Reordering them doesn't actually change behavior, because the early-startup check just delays the warning, so it should be fine. I can separate out the reordering change into a separate patch if you like, then you can see that it should not change behavior.