Allow suppressing the "lexical arg shadows dynbound var" warning
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 25 Jun 2023 15:11:03 +0000 (11:11 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 25 Jun 2023 15:14:03 +0000 (11:14 -0400)
commit0228421e349e77c00108ea9f6927285a6d04f4b5
treef6b7055bcd6e43d667a355dda900d016805010cf
parente85ebb3d82466c5838e9c6836e6d8b5c8d0a7c33
Allow suppressing the "lexical arg shadows dynbound var" warning

In most cases the right way to fix this warning is by renaming
the offending argument, but in some cases this is inconvenient, as is
the case in `cl-defstruct` where arg names are imposed by slot names.

This patch also happens to fix a few bugs along the way:
- miscompilation of (lambda (gcs-done) (lambda (x) (+ x gcs-done)))
- errors about void function `byte-compile-warn-x` if the warning was
  emitted via `cconv-fv` when bytecomp was not loaded.
Oh, and it improves the warning by making the location info slightly
more precise.

* lisp/emacs-lisp/cconv.el (cconv--analyze-function): Remove this warning.
* lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list):
Warn about it here instead.  Let `with-suppressed-warnings` control it
under `lexical`.
lisp/emacs-lisp/bytecomp.el
lisp/emacs-lisp/cconv.el