From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#67483: Wrong warning position given by the byte compiler for a malformed function Date: Fri, 22 Dec 2023 14:12:46 +0100 Message-ID: <58AFDAEE-7E28-4896-B0C1-D5212C9ECB31@gmail.com> References: <59773797-CC64-4352-9528-4E7593DD3C1F@gmail.com> <522B6349-614D-48AD-963D-76CF59A30497@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_A8785F6F-E315-43E2-A05E-13A5E0487CD1" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14173"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , 67483@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 22 14:14:40 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 1rGfMN-0003Tf-Od for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 22 Dec 2023 14:14:39 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGfLq-00084a-Mg; Fri, 22 Dec 2023 08:14:06 -0500 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 1rGfLm-0007zo-1B for bug-gnu-emacs@gnu.org; Fri, 22 Dec 2023 08:14:03 -0500 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 1rGfLh-0004n0-Fc for bug-gnu-emacs@gnu.org; Fri, 22 Dec 2023 08:14:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rGfLl-00082V-JC for bug-gnu-emacs@gnu.org; Fri, 22 Dec 2023 08:14:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 Dec 2023 13:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67483 X-GNU-PR-Package: emacs Original-Received: via spool by 67483-submit@debbugs.gnu.org id=B67483.170325078530826 (code B ref 67483); Fri, 22 Dec 2023 13:14:01 +0000 Original-Received: (at 67483) by debbugs.gnu.org; 22 Dec 2023 13:13:05 +0000 Original-Received: from localhost ([127.0.0.1]:46212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGfKq-000818-Kc for submit@debbugs.gnu.org; Fri, 22 Dec 2023 08:13:04 -0500 Original-Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]:44451) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGfKl-00080a-9q for 67483@debbugs.gnu.org; Fri, 22 Dec 2023 08:13:03 -0500 Original-Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2ccae380df2so3842051fa.1 for <67483@debbugs.gnu.org>; Fri, 22 Dec 2023 05:12:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703250768; x=1703855568; darn=debbugs.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=wGnBdUJBZ0VK+u0ijPnZsVNF1kECkKAbvCt/jywFVKw=; b=XD/hbu+HTo7ZNjlXqaBn3iIvrZ5LWoX5gq9p28qqtF7S8rbx5ZTrGqe0puMF1xAnaX TcL6xjJKMjxsBW9bONVCJnVjnNt770Hh7cnFV1olaChGd7GqMsnU8ogTMp8yFQ+NMtDc h/nsyq+w4WA/oc504jyBJ2wOe8qDU0qOuRCU+3p/pvqeAZj4SliP5t16hKh/g1IN2WBa wI4dViFW5YWz8nynExW5RbeLO5WYbg/wZ2AKEY5Tq3yrL4sMd2x2hNAG5wv1jGApPUii rH7t+fO/B21rlKYw3zGI/MnbAjwhhzRlVLIpoW9MKHH5htROvRjYo0hxK0dSsc53NY+J MClg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703250768; x=1703855568; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wGnBdUJBZ0VK+u0ijPnZsVNF1kECkKAbvCt/jywFVKw=; b=cN/1o+4ktG+l+bc80cX632hl56szNH4DJC6drZy26lnK/frlUPCd29Q41mnL4WfEHQ pgMiWlm60RFmt1yhw/nD+gsXDomZgngQp/W12os6ReAzEpaDHb8T5AgQFKRlUdjUQXGp Om8ys2dRSMZXO2SfI7jz/7Gp0UoTdEmalxpiBgpvxkgcswH+T+GyNj7oPapHAeUHLgHO YsAa0OcOBfmps5AAE1Rfrm7KR6b92gkXWYWa0n+Y9SEZzRHOzB51jM0npo9BxUu5pGsc XXuX50mluENCS0w1rbl03BADxF8q+diDS1zduFb0cgJ9rJmomPS1zjs1uMlwQMGBm75t YyEg== X-Gm-Message-State: AOJu0Yy6zpxra7B/Fu4sx76z4RPRp8afHq4o98s/PY8Xhd/L7tVOqH5G bB4PB4oaq+E9GF0O9YsOWy/5N5FAaJo= X-Google-Smtp-Source: AGHT+IGxI2Y4B1IVZmUwyH3adrnSwi+sTwV9uCRxyGAwD0dTHUpVku8N1p59b4WH1U/GoVcYOE6GPg== X-Received: by 2002:a2e:2405:0:b0:2cc:73cf:82e9 with SMTP id k5-20020a2e2405000000b002cc73cf82e9mr577272ljk.48.1703250768064; Fri, 22 Dec 2023 05:12:48 -0800 (PST) Original-Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se. [80.217.1.132]) by smtp.gmail.com with ESMTPSA id a11-20020a2ebe8b000000b002ca0cb6f476sm580489ljr.60.2023.12.22.05.12.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Dec 2023 05:12:47 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3654.120.0.1.15) 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:276664 Archived-At: --Apple-Mail=_A8785F6F-E315-43E2-A05E-13A5E0487CD1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 22 dec. 2023 kl. 12.24 skrev Alan Mackenzie : > What's the process of converting to a closure > got to do with maintaining the stack of forms for error processing? Not much, but cconv has evolved to one major part of the compiler = front-end (the other being macroexp-all) and isn't restricted to just = closure conversion. In fact, it's now used for dynbound code as well. In particular it's a natural place for various front-end checks and = transforms, so don't let the place and name distract you. There are = plans to refactor it later on for other reasons. > Whoops! There was no patch. Attached it now, sorry. > You've put the new macro into macroexp.el. This file is purely about > macro handling. Actually macroexp.el does more than that, and in any case the file isn't = very important; the macro ended up there to be next to = byte-compile-form-stack. Nor is the name; it can be changed at any time. However, it probably needs to be in that file for bootstrap reasons. > And is the "--" in the name > appropriate, given that the macro is used by several files? I'm not > sure about that rule. The double-dash just means that users shouldn't get any funny ideas. = (The converse isn't true: a name without double-dash isn't automatically = fair game.) > Also, byte-compile-form-stack gets bound in cconv-closure-convert. = Why? It's just a backstop. Not strictly needed. It's probably fine to remove = it if you are worried, but then again there shouldn't be any (non-bug) = error signalling here. I'll have a look. --Apple-Mail=_A8785F6F-E315-43E2-A05E-13A5E0487CD1 Content-Disposition: attachment; filename=0001-Capture-byte-compile-form-stack-in-delayed-warnings-.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Capture-byte-compile-form-stack-in-delayed-warnings-.patch" Content-Transfer-Encoding: quoted-printable =46rom=200a4222090ee3b6690b3097a06dacd23546c7350b=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Wed,=2020=20Dec=202023=2011:11:56=20+0100=0A= Subject:=20[PATCH]=20Capture=20byte-compile-form-stack=20in=20delayed=20= warnings=0A=20(bug#67483)=0A=0A*=20lisp/emacs-lisp/macroexp.el=20= (macroexp--warn-wrap):=0AWhen=20recording=20a=20delayed=20warning,=20= capture=20the=20current=20value=20of=0A`byte-compile-form-stack`=20= because=20it=20is=20more=20likely=20to=20contain=20a=0Arelevant=20source=20= location=20than=20whatever=20we=20are=20traversing=20in=20codegen.=0A---=0A= =20lisp/emacs-lisp/macroexp.el=20|=2014=20++++++++------=0A=201=20file=20= changed,=208=20insertions(+),=206=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/emacs-lisp/macroexp.el=20b/lisp/emacs-lisp/macroexp.el=0Aindex=20= 2a646be9725..8cf6ad7256d=20100644=0A---=20a/lisp/emacs-lisp/macroexp.el=0A= +++=20b/lisp/emacs-lisp/macroexp.el=0A@@=20-168,12=20+168,14=20@@=20= macroexp-file-name=0A=20(defvar=20macroexp--warned=20(make-hash-table=20= :test=20#'equal=20:weakness=20'key))=0A=20=0A=20(defun=20= macroexp--warn-wrap=20(arg=20msg=20form=20category)=0A-=20=20(let=20= ((when-compiled=0A-=09=20(lambda=20()=0A-=20=20=20=20=20=20=20=20=20=20=20= (when=20(if=20(consp=20category)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(apply=20#'byte-compile-warning-enabled-p=20= category)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (byte-compile-warning-enabled-p=20category))=0A-=20=20=20=20=20=20=20=20=20= =20=20=20=20(byte-compile-warn-x=20arg=20"%s"=20msg)))))=0A+=20=20(let*=20= ((stack=20byte-compile-form-stack)=0A+=20=20=20=20=20=20=20=20=20= (when-compiled=0A+=09=20=20(lambda=20()=0A+=20=20=20=20=20=20=20=20=20=20= =20=20(when=20(if=20(consp=20category)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(apply=20= #'byte-compile-warning-enabled-p=20category)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(byte-compile-warning-enabled-p=20= category))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20(let=20= ((byte-compile-form-stack=20stack))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(byte-compile-warn-x=20arg=20"%s"=20msg))))))=0A=20=20=20=20=20= `(progn=0A=20=20=20=20=20=20=20=20(macroexp--funcall-if-compiled=20= ',when-compiled)=0A=20=20=20=20=20=20=20=20,form)))=0A--=20=0A2.32.0=20= (Apple=20Git-132)=0A=0A= --Apple-Mail=_A8785F6F-E315-43E2-A05E-13A5E0487CD1--