X-Loop: help-debbugs@HIDDEN Subject: bug#66628: 30.0.50; EMACS_GENERATE_DYNVARS emits symbols with position Resent-From: "Basil L. Contovounesios" <contovob@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: acm@HIDDEN, mattias.engdegard@HIDDEN, bug-gnu-emacs@HIDDEN Resent-Date: Thu, 19 Oct 2023 06:34:03 +0000 Resent-Message-ID: <handler.66628.B.16976972248585 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 66628 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 66628 <at> debbugs.gnu.org Cc: "Alan Mackenzie" <acm@HIDDEN>, "Mattias =?UTF-8?Q?Engdeg=C3=A5rd?=" <mattias.engdegard@HIDDEN> X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN X-Debbugs-Original-Xcc: "Alan Mackenzie" <acm@HIDDEN>, "Mattias =?UTF-8?Q?Engdeg=C3=A5rd?=" <mattias.engdegard@HIDDEN> Received: via spool by submit <at> debbugs.gnu.org id=B.16976972248585 (code B ref -1); Thu, 19 Oct 2023 06:34:03 +0000 Received: (at submit) by debbugs.gnu.org; 19 Oct 2023 06:33:44 +0000 Received: from localhost ([127.0.0.1]:35585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qtMbH-0002EO-F4 for submit <at> debbugs.gnu.org; Thu, 19 Oct 2023 02:33:44 -0400 Received: from lists.gnu.org ([2001:470:142::17]:37498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <contovob@HIDDEN>) id 1qtMbE-0002E9-I9 for submit <at> debbugs.gnu.org; Thu, 19 Oct 2023 02:33:41 -0400 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 <contovob@HIDDEN>) id 1qtMah-0003Kb-UT for bug-gnu-emacs@HIDDEN; Thu, 19 Oct 2023 02:33:08 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <contovob@HIDDEN>) id 1qtMad-00013e-WB for bug-gnu-emacs@HIDDEN; Thu, 19 Oct 2023 02:33:07 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40839807e82so2225245e9.0 for <bug-gnu-emacs@HIDDEN>; Wed, 18 Oct 2023 23:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; t=1697697180; x=1698301980; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=d3aN8yhMwtcEGzg6kjhBMDABXsTWjt42hbcFnIPCn+M=; b=PEW79+A3jQy9+rmiAZuJGPWwZXccmhPnb1sFR24RP3+M6VQB6L+/LPQWmPn6DOSJvN LesX/3IEz912ITTxOm8jLqq6+d5BK5uCqUfkNNXTTbE3x1p3Cxl5IisV5Qg4SrS1KNhe ltQXmoNo1BOG1KYSTS/yb8G3Y5EMVn0b7ZTugWKvGs0Rnte2fk1l4sSz28pywX/w1kMO pnhyAkRnar1XiSN9eRGRfxUczcsNbP3aVTSTvlMf6CjPmpGrVWnbe1fpYtIlsrY42Z6l kIfSbbvFtdzfrYiiiHii3SqyvkZJI4tpFM9Zi5HDUm1bBeQ6hsSYhH5ROPp/feaDVWjN 72pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697697180; x=1698301980; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d3aN8yhMwtcEGzg6kjhBMDABXsTWjt42hbcFnIPCn+M=; b=um9incXCEwrdRs9Uv49Z3gRt1lIrXVomcCZMHqt/7S5bFkHRKcljYURlT9YcrNofwY E9WJKshbYVhBOwWdGorGzRgam/kDc4TB0CphbreAqAD2Jk8VfmpJevbrGPeQ/LN5DmZw 4wqMeNplhGQPJzuNhp+7PFjb5urirLR1Savx21HWOk3Ce0o0Won4WrSRSJdeXnnluUbD Zvk6Q7q3qn30t1+YPo48Or1MS2HwFyoXvj+ZCUtv1DdDiH6irQL9AKxCZ/sZ/g4OdSih 8uxU3lRR47iXbM10HtdMkFTW+FRoPExRiGF89mMR4221a/toTboI+fPw3ep14wyoB64x JBiQ== X-Gm-Message-State: AOJu0YwDLD+c5O6iHyef8ZklpRZcN0QDmaQKFYxG9cxzvXjetSVE0h4x rR9U5+7yxGnyg6LDyQ267wTmX2jj/+KPNbA7rxk= X-Google-Smtp-Source: AGHT+IGlwTnQUXJTEQOVxgv5935B/4pUsmHovpKi9m1xdA4nNA3FVf3x/FCG6WJ/yVII+GTZRBhjkQ== X-Received: by 2002:a05:600c:2a15:b0:400:5962:6aa9 with SMTP id w21-20020a05600c2a1500b0040059626aa9mr847862wme.11.1697697180325; Wed, 18 Oct 2023 23:33:00 -0700 (PDT) Received: from localhost ([2a02:aa12:b102:1b80:415e:345d:c031:c2fa]) by smtp.gmail.com with ESMTPSA id j22-20020a05600c1c1600b00405718cbeadsm1911604wms.1.2023.10.18.23.32.59 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 23:32:59 -0700 (PDT) From: "Basil L. Contovounesios" <contovob@HIDDEN> Date: Thu, 19 Oct 2023 08:32:58 +0200 Message-ID: <871qdr15r9.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=contovob@HIDDEN; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Severity: minor Tags: patch Given the following two files under /tmp: ;;; foo.el -*- lexical-binding: t -*- (defvar foo-x) (defvar foo-y) ;;; foo.el ends here ;;; bar.el -*- lexical-binding: t -*- (defun bar-x (foo-x) (ignore foo-x)) (let ((foo-y 1)) (ignore foo-y) (setq foo-y 2)) ;;; bar.el ends here $ EMACS_GENERATE_DYNVARS=1 emacs -Q -batch -f batch-byte-compile foo.el Generating /tmp/foo.elc.dynvars $ cat foo.elc.dynvars (#<symbol foo-y at 62> . "/tmp/foo.el") (#<symbol foo-x at 47> . "/tmp/foo.el") $ EMACS_DYNVARS_FILE=foo.elc.dynvars emacs -Q -batch -f batch-byte-compile bar.el Since the .dynvars file makes for some bad reading, the last step gives no diagnostic, though I would expect it to. Here's a patch that binds print-symbols-bare appropriately: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Print-bare-symbols-for-EMACS_GENERATE_DYNVARS.patch From 492ad0f4a97ca43409eb0fefacdfe84b0775cf15 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" <contovob@HIDDEN> Date: Wed, 18 Oct 2023 15:33:51 +0200 Subject: [PATCH] Print bare symbols for EMACS_GENERATE_DYNVARS * lisp/emacs-lisp/bytecomp.el (byte-compile--load-dynvars): Remove redundant goto-char. (byte-compile-file): Bind print-symbols-bare around .dynvars file generation. --- lisp/emacs-lisp/bytecomp.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 92abe6b4624..9d97678379c 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2069,7 +2069,6 @@ byte-compile--load-dynvars (and file (not (equal file "")) (with-temp-buffer (insert-file-contents file) - (goto-char (point-min)) (let ((vars nil) var) (while (ignore-errors (setq var (read (current-buffer)))) @@ -2284,7 +2283,8 @@ byte-compile-file (let ((gen-dynvars (getenv "EMACS_GENERATE_DYNVARS"))) (when (and gen-dynvars (not (equal gen-dynvars "")) byte-compile--seen-defvars) - (let ((dynvar-file (concat target-file ".dynvars"))) + (let ((dynvar-file (concat target-file ".dynvars")) + (print-symbols-bare t)) (message "Generating %s" dynvar-file) (with-temp-buffer (dolist (var (delete-dups byte-compile--seen-defvars)) -- 2.42.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Now I get the following, as expected: $ EMACS_GENERATE_DYNVARS=3D1 emacs -Q -batch -f batch-byte-compile foo.el Generating /tmp/foo.elc.dynvars $ cat foo.elc.dynvars (foo-y . "/tmp/foo.el") (foo-x . "/tmp/foo.el") $ EMACS_DYNVARS_FILE=3Dfoo.elc.dynvars emacs -Q -batch -f batch-byte-comp= ile bar.el In bar-x: bar.el:2:2: Warning: =E2=80=98foo-x=E2=80=99 lexically bound in lambda he= re but declared dynamic in: /tmp/foo.el bar.el:3:8: Warning: =E2=80=98foo-y=E2=80=99 lexically bound in let here = but declared dynamic in: /tmp/foo.el WDYT? Side question: if I replace (let ((foo-y 1)) (ignore foo-y) (setq foo-y 2)) with (let ((foo-y 1)) (ignore foo-y) (bar-x foo-y)) in bar.el (i.e. foo-y is only read, never set), the .dynvars warning about foo-y disappears. I assume this is due to an earlier cconv / constant propagation pass, is that right? If so, I'm curious whether/how the .dynvars feature could be adapted to cope, e.g. by taking place at an earlier stage. Thanks, --=20 Basil In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0, Xaw3d scroll bars) of 2023-10-18 built on tia Repository revision: 06fc5c24170b820939d3d51071b2957354edcb65 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101008 System Description: Debian GNU/Linux trixie/sid Configured using: 'configure 'CFLAGS=3D-O2 -ggdb3' -C --prefix=3D/home/blc/.local --enable-checking=3Dstructs --with-file-notification=3Dyes --with-x-toolkit=3Dlucid --with-x' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_IE.UTF-8 value of $XMODIFIERS: @im=3Dibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar make-network-process emacs) Memory information: ((conses 16 38082 9280) (symbols 48 5209 0) (strings 32 14036 1774) (string-bytes 1 387105) (vectors 16 10299) (vector-slots 8 156340 16868) (floats 8 23 23) (intervals 56 259 0) (buffers 992 10)) --=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: "Basil L. Contovounesios" <contovob@HIDDEN> Subject: bug#66628: Acknowledgement (30.0.50; EMACS_GENERATE_DYNVARS emits symbols with position) Message-ID: <handler.66628.B.16976972248585.ack <at> debbugs.gnu.org> References: <871qdr15r9.fsf@HIDDEN> X-Gnu-PR-Message: ack 66628 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 66628 <at> debbugs.gnu.org Date: Thu, 19 Oct 2023 06:34:03 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. As you requested using X-Debbugs-CC, your message was also forwarded to "Alan Mackenzie" <acm@HIDDEN>, "Mattias Engdeg=C3=A5rd" <mattias.engdegar= d@HIDDEN> (after having been given a bug report number, if it did not have one). Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 66628 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 66628: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D66628 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#66628: 30.0.50; EMACS_GENERATE_DYNVARS emits symbols with position Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 19 Oct 2023 09:51:02 +0000 Resent-Message-ID: <handler.66628.B66628.169770901013572 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 66628 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "Basil L. Contovounesios" <contovob@HIDDEN> Cc: Alan Mackenzie <acm@HIDDEN>, 66628 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN> Received: via spool by 66628-submit <at> debbugs.gnu.org id=B66628.169770901013572 (code B ref 66628); Thu, 19 Oct 2023 09:51:02 +0000 Received: (at 66628) by debbugs.gnu.org; 19 Oct 2023 09:50:10 +0000 Received: from localhost ([127.0.0.1]:35868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qtPfO-0003Wq-8c for submit <at> debbugs.gnu.org; Thu, 19 Oct 2023 05:50:10 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]:42199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mattias.engdegard@HIDDEN>) id 1qtPfL-0003Vf-ER for 66628 <at> debbugs.gnu.org; Thu, 19 Oct 2023 05:50:08 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5079f9ec8d9so655803e87.0 for <66628 <at> debbugs.gnu.org>; Thu, 19 Oct 2023 02:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697708975; x=1698313775; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=e8GxFzyxkV3i0r2YPLo+Oo+KMcP6UpNZCUTXyxYsePI=; b=Mixwy10jeYTjzpNm4g8m2xj6nFJZcPADVyT/jHeQKAGGvnfmIfbPpRGBElCMLa+cNR 3kYvTo+2dTBQU1s5gP9m565FECFG35CWs1eAVbbK5NV6CseQ3vwQhNei2nSlbny9EX1S 5Or8f1GGKdd3k0hwTzvWj/GMF8V5Z58KanoKrISqp61biBE6rYKBRmnoIUKUNCe9D+zT EMNm+WL+JOSiUbWwkxjrlzvApE+k8MC2S22Axgwi4UNEV0fQWP6JPwWGDdSWiklhubz5 OsjQZYIN4qIWUvuzcatY1WWIoyKZymEkpBDSZ3QbPCqgvkO3a/GJelQHPulZULwug/rg HYew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697708975; x=1698313775; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=e8GxFzyxkV3i0r2YPLo+Oo+KMcP6UpNZCUTXyxYsePI=; b=gFbAy15N0BqlYSuxXCnttYKXJVZFeB6h07iwhjvllBXE5/dZgvdaCGBxl8Ni0m+CkR mmgescqomAtCansLJTyoyb9NxpNq8yupH7i4Y/5I43oNXpTYmbt7FoLSW8dL+SE4Qgyk triY6N3V+K/ymfo5hJXnlHjOxDJpNLGjDJEXqZ/DSHnF7qlvaD0yroRH/U+Sgmf00qee VQvfrjV8gbhW9W8642lKaudGkSsYVN3ZyFmdA4ThoX6XJO3EGfwPt5Tu0MSyn0Rt+cwn hiFnCS7NlFzbitRW4JK+MhguuTjUCdqzLAx/1mZrE2eKxHNyPIwyFH3QFRivNhXGVaJE NlfA== X-Gm-Message-State: AOJu0YzN/FYXzuvJ2bu7gj1vqz8p1wbm6KxtkpbynspZObYOllQV5GSI wtJVdk3og/J8sn/bXYk6Ofo= X-Google-Smtp-Source: AGHT+IFfeFm5FRN2XidVQ3f2A4vlJI82rlcwasu17WocrfOM1PJYABjjbUfrd46biJEJZHJMmdsvZg== X-Received: by 2002:a05:6512:1113:b0:502:e0dd:628b with SMTP id l19-20020a056512111300b00502e0dd628bmr428820lfg.32.1697708974560; Thu, 19 Oct 2023 02:49:34 -0700 (PDT) Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id c13-20020a056512324d00b004fe333128c0sm1037041lfr.242.2023.10.19.02.49.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2023 02:49:33 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN> In-Reply-To: <871qdr15r9.fsf@HIDDEN> Date: Thu, 19 Oct 2023 11:49:32 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <EEE062D8-DF8B-4615-95F1-DD6D4B3CD6D8@HIDDEN> References: <871qdr15r9.fsf@HIDDEN> X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) 19 okt. 2023 kl. 08.32 skrev Basil L. Contovounesios <contovob@HIDDEN>: > $ EMACS_GENERATE_DYNVARS=3D1 emacs -Q -batch -f batch-byte-compile = foo.el > Generating /tmp/foo.elc.dynvars >=20 > $ cat foo.elc.dynvars > (#<symbol foo-y at 62> . "/tmp/foo.el") > (#<symbol foo-x at 47> . "/tmp/foo.el") Oops, good that you found this. The patch looks fine. Thank you! We could actually contemplate enriching the .dynvars format with source = locations of the declarations when available, but it's perhaps just = gold-plating at this point. > Side question: if I replace >=20 > (let ((foo-y 1)) > (ignore foo-y) > (setq foo-y 2)) >=20 > with >=20 > (let ((foo-y 1)) > (ignore foo-y) > (bar-x foo-y)) >=20 > in bar.el (i.e. foo-y is only read, never set), the .dynvars warning > about foo-y disappears. I assume this is due to an earlier cconv / > constant propagation pass, is that right? Yes, constant propagation will substitute 1 for `foo-y` in the second = case during Lisp-level optimisation because absent any dynamic = declaration the variable is assumed to be lexical there. The warning is = only emitted in the backend (codegen) which is admittedly a bit late. > If so, I'm curious > whether/how the .dynvars feature could be adapted to cope, e.g. by > taking place at an earlier stage. Yes, it might be possible to move it to the frontend and in fact it's = generally preferable to check for warnings at that stage. You could try = doing that if you wish; I would like to make a frontend refactoring to = make this sort of thing easier -- right now the frontend is part of = cconv, except for the bit that's in macroexp-all.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.