unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, emacs-devel@gnu.org
Subject: Re: Incorrect byte compiler error/warning message positions. A possible fix.
Date: Tue, 16 Nov 2021 17:05:42 +0000	[thread overview]
Message-ID: <YZPk5rCcLlYi+O//@ACM> (raw)
In-Reply-To: <jwv35nx2kbm.fsf-monnier+emacs@gnu.org>

Hello, Stefan.

On Mon, Nov 15, 2021 at 16:19:47 -0500, Stefan Monnier wrote:
> >> In my experience, the vast majority of the warning messages point to the
> >> correct position.  But, yes, it does sometimes give the wrong position.
> > On 2018-11-22 (before you destroyed my test dataset by fixing all the
> > warnings in Emacs ;-) there were 335 warnings.  81 gave the correct
> > location, 254 a wrong one.

> FWIW, I think the current code gives (statistically) slightly less bad
> positions, because of changes I've made to `cconv` and `bytecomp`.
> That may explain Lars's impression.

> Our positions are still too often poor.  Some of us have just grown used
> to missing or poor location info and don't notice them any more :-(

I'm now fundamentally opposed to the use of terms like "poor" and
"inaccurate" here.  I prefer "wrong".  ;-)

> > They should be fairly easy (if, perhaps, tedious) to solve, because
> > everything is under our control.

> Agreed.

> > It's macros where people outside of our control do wierd and wonderful
> > things.  I think I know how to compile macros so that they both work,
> > yet preserve the symbols with position on the code they generate.
> > These compiled macros won't work on earlier versions of Emacs, but
> > that's a bridge to cross when we come to it.

> I'm curious know how you intend to make it work,

While a macro is being compiled it will use a dynamically bound variable
called, say, byte-comp-use.  When non-nil, it indicates the macro
may/should return executable code (i.e. without symbols with position).
When nil, byte-comp-use instructs the macro to return "code" containing
symbols with position, enabling the calling byte compiler to output
these positions in warning messages.

As macros call other macros, special forms in a macro will be enhanced
to bind byte-comp-use appropriately.  For example, in a progn (whose
last form is the result code), byte-comp-use will be t for all subforms
except the last.  In an `if' whose two arms are alternative result
codes, the condition form would have b-c-use t, each of the arms would
have nil.

Or something like that.

An alternative/additional idea is to have things like the evaluator
handle a symbol with position natively.  This would not slow Emacs down
the way amending EQ did three years ago; it would merely slow down the
generation of code from macros, probably not by very much.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



      parent reply	other threads:[~2021-11-16 17:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-14 19:13 Incorrect byte compiler error/warning message positions. A possible fix Alan Mackenzie
2021-11-15  5:22 ` Lars Ingebrigtsen
2021-11-15  5:29   ` Po Lu
2021-11-15 11:52     ` Alan Mackenzie
2021-11-15 11:49   ` Alan Mackenzie
2021-11-15 21:19     ` Stefan Monnier
2021-11-16  7:32       ` Lars Ingebrigtsen
2021-11-16 17:05       ` Alan Mackenzie [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=YZPk5rCcLlYi+O//@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).