Remove the remnants of old position mechanism from scratch/correct-warning-pos

Also correct one or two positions in macroexp-warn-and-return invocations.

* lisp/emacs-lisp/bytecomp.el (byte-compile-read-position)
(byte-compile-last-position, byte-compile-set-symbol-position): Remove.
(byte-compile-warning-prefix, byte-compile-function-warn)
(byte-compile-emit-callargs-warn, byte-compile-arglist-warn)
(byte-compile-warn-about-unresolved-functions, compile-defun)
(byte-compile-from-buffer, byte-compile-from-buffer)
(byte-compile-file-form-defmumble, byte-compile-check-lambda-list)
(byte-compile-lambda, byte-compile-form, byte-compile-normal-call)
(byte-compile-check-variable, byte-compile-push-constant)
(byte-compile-subr-wrong-args, byte-compile-negation-optimizer)
(byte-compile-condition-case, byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form): Remove the remnants of the old warning position
mechanism.
(byte-compile-function-warn): Replace byte-compile-last-position by a
symbol-with-pos-pos call.
(compile-defun): Use local variable start-read-position to fulfil purpose of
old byte-compile-read-position.  Push the just read FORM onto
byte-compile-form-stack.

* lisp/emacs-lisp/eieio.el (defclass): New mechanism to get the correct
source warning position to macroexp-warn-and-return.

* lisp/emacs-lisp/macroexp (macroexp--unfold-lambda): Correct the position
argument given to macroexp-warn-and-return.
This commit is contained in:
Alan Mackenzie 2022-01-15 17:36:12 +00:00
parent d87a34597c
commit 3023e7ca3d
3 changed files with 34 additions and 123 deletions

View file

@ -162,6 +162,8 @@ Other uses risk returning non-nil value that point to the wrong file."
#'macroexp-warn-and-return "28.1")
(defun macroexp-warn-and-return (arg msg form &optional category compile-only)
"Return code equivalent to FORM labeled with warning MSG.
ARG is a symbol (or a form) giving the source code position of FORM
for the message. It should normally be a symbol with position.
CATEGORY is the category of the warning, like the categories that
can appear in `byte-compile-warnings'.
COMPILE-ONLY non-nil means no warning should be emitted if the code
@ -287,7 +289,7 @@ is executed without being compiled first."
(setq arglist (cdr arglist)))
(if values
(macroexp-warn-and-return
name
arglist
(format (if (eq values 'too-few)
"attempt to open-code `%s' with too few arguments"
"attempt to open-code `%s' with too many arguments")