all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: emacs-devel@gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: master bf21025: * lisp/emacs-lisp/bytecomp.el: Remember location of unresolved calls
Date: Thu, 25 Mar 2021 17:06:37 +0000	[thread overview]
Message-ID: <87ft0j88o2.fsf@tcd.ie> (raw)
In-Reply-To: <20210319223537.784692101A@vcs0.savannah.gnu.org> (Stefan Monnier's message of "Fri, 19 Mar 2021 18:35:37 -0400 (EDT)")

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

monnier@iro.umontreal.ca (Stefan Monnier) writes:

> branch: master
> commit bf210251eadafafd1bf4176127b872030405baa3
> Author: Stefan Monnier <monnier@iro.umontreal.ca>
> Commit: Stefan Monnier <monnier@iro.umontreal.ca>
>
>     * lisp/emacs-lisp/bytecomp.el: Remember location of unresolved calls
>     
>     I've gotten tired of seeing the "function foo not known to be defined"
>     warning without any line number information.  So this patch adds as
>     line number the position of the first use of that function in the file
>     (well, approximately, as usual).
>     
>     (byte-compile-unresolved-functions): Add POSITIONs in the alist.
>     (byte-compile-function-warn): Store the current position in
>     `byte-compile-unresolved-functions`.
>     (byte-compile-arglist-warn): Adjust accordingly.
>     (byte-compile-print-syms): Delete unused function.
>     (byte-compile-warn-about-unresolved-functions): Use the stored position
>     to give more precise warnings.

Does that mean this part can be removed, or are its side effects still
needed somewhere?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bytecomp.diff --]
[-- Type: text/x-diff, Size: 572 bytes --]

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 0babbbb978..dd8d15e167 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2190,9 +2190,6 @@ byte-compile-from-buffer
 	    (byte-compile-toplevel-file-form form)))
 	;; Compile pending forms at end of file.
 	(byte-compile-flush-pending)
-	;; Make warnings about unresolved functions
-	;; give the end of the file as their position.
-	(setq byte-compile-last-position (point-max))
 	(byte-compile-warn-about-unresolved-functions)))
      byte-compile--outbuffer)))
 

[-- Attachment #3: Type: text/plain, Size: 798 bytes --]


BTW, would we like the effect of declare-function to be local to its
lexical scope?  Would this be feasible?

I guess we'd need a new var to keep track of unresolved fns per scope,
and merge its remaining contents with the global unresolved and
noruntime lists when popping scope, or something like that?

My motivating example is, had I declared tab-bar-height within
frame-notice-user-settings for --without-x builds, then that would have
shadowed its later unqualified use in frame-inner-height, leaving
bug#47234 unnoticed.  (Of course the same would be true if the
declaration were at top-level.)

Remembering to support a variety of build configurations is already
tricky enough, so maybe this will help prevent some subset of bugs.  Or
would it not be worth the effort?

Thanks,

-- 
Basil

       reply	other threads:[~2021-03-25 17:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210319223536.5620.7190@vcs0.savannah.gnu.org>
     [not found] ` <20210319223537.784692101A@vcs0.savannah.gnu.org>
2021-03-25 17:06   ` Basil L. Contovounesios [this message]
2021-03-25 17:42     ` master bf21025: * lisp/emacs-lisp/bytecomp.el: Remember location of unresolved calls Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ft0j88o2.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.