emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8525be6d5ec: Move malformed-function warning from byte-opt to cco


From: Mattias Engdegård
Subject: master 8525be6d5ec: Move malformed-function warning from byte-opt to cconv (bug#67483)
Date: Thu, 30 Nov 2023 05:37:33 -0500 (EST)

branch: master
commit 8525be6d5eca0c75008ec1dc799cae537156feea
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Move malformed-function warning from byte-opt to cconv (bug#67483)
    
    We shouldn't be warning inside the optimiser in the first place.
    
    * lisp/emacs-lisp/byte-opt.el (byte-optimize-form):
    Remove byte-compile-form-stack manipulation.
    (byte-optimize-form-code-walker): Move malformed function warning
    from here...
    * lisp/emacs-lisp/cconv.el: ...to here.
---
 lisp/emacs-lisp/byte-opt.el |  6 ------
 lisp/emacs-lisp/cconv.el    | 14 +++++++++-----
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 06257a9a2da..7a61a8fce7e 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -485,10 +485,6 @@ There can be multiple entries for the same NAME if it has 
several aliases.")
       (`(,(pred byte-code-function-p) . ,exps)
        (cons fn (mapcar #'byte-optimize-form exps)))
 
-      (`(,(pred (not symbolp)) . ,_)
-       (byte-compile-warn-x form "`%s' is a malformed function" fn)
-       form)
-
       ((guard (when for-effect
                (if-let ((tmp (byte-opt--fget fn 'side-effect-free)))
                    (or byte-compile-delete-errors
@@ -514,7 +510,6 @@ There can be multiple entries for the same NAME if it has 
several aliases.")
     (byte-optimize-form form for-effect)))
 
 (defun byte-optimize-form (form &optional for-effect)
-  (push form byte-compile-form-stack)
   (while
       (progn
         ;; First, optimize all sub-forms of this one.
@@ -531,7 +526,6 @@ There can be multiple entries for the same NAME if it has 
several aliases.")
                      (byte-compile-log "  %s\t==>\t%s" old new)
                       (setq form new)
                       (not (eq new old))))))))
-  (pop byte-compile-form-stack)
   form)
 
 (defun byte-optimize--rename-var-body (var new-var body)
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index 3e75020a013..e65c39e3998 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -615,11 +615,15 @@ places where they originally did not directly appear."
      (cconv-convert exp env extend))
 
     (`(,func . ,forms)
-     ;; First element is function or whatever function-like forms are: or, and,
-     ;; if, catch, progn, prog1, while, until
-     `(,func . ,(mapcar (lambda (form)
-                          (cconv-convert form env extend))
-                        forms)))
+     (if (symbolp func)
+         ;; First element is function or whatever function-like forms are:
+         ;; or, and, if, catch, progn, prog1, while, until
+         `(,func . ,(mapcar (lambda (form)
+                              (cconv-convert form env extend))
+                            forms))
+       (macroexp--warn-wrap form (format-message "Malformed function `%S'"
+                                                 (car form))
+                            nil nil)))
 
     (_ (or (cdr (assq form env)) form))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]