emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113751: * lisp/emacs-lisp/bytecomp.el (byte-compile


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r113751: * lisp/emacs-lisp/bytecomp.el (byte-compile-function-warn): New function,
Date: Thu, 08 Aug 2013 01:37:52 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113751
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-08-07 21:37:47 -0400
message:
  * lisp/emacs-lisp/bytecomp.el (byte-compile-function-warn): New function,
  extracted from byte-compile-callargs-warn and byte-compile-normal-call.
  (byte-compile-callargs-warn, byte-compile-function-form): Use it.
  (byte-compile-normal-call): Remove obsolescence check.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/bytecomp.el    bytecomp.el-20091113204419-o5vbwnq5f7feedwu-492
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-08-08 01:19:11 +0000
+++ b/lisp/ChangeLog    2013-08-08 01:37:47 +0000
@@ -1,3 +1,10 @@
+2013-08-08  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/bytecomp.el (byte-compile-function-warn): New function,
+       extracted from byte-compile-callargs-warn and byte-compile-normal-call.
+       (byte-compile-callargs-warn, byte-compile-function-form): Use it.
+       (byte-compile-normal-call): Remove obsolescence check.
+
 2013-08-08  Juanma Barranquero  <address@hidden>
 
        * frameset.el (frameset-restore): Doc fix.

=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- a/lisp/emacs-lisp/bytecomp.el       2013-08-07 17:33:30 +0000
+++ b/lisp/emacs-lisp/bytecomp.el       2013-08-08 01:37:47 +0000
@@ -1224,6 +1224,24 @@
         (format "%d" (car signature)))
        (t (format "%d-%d" (car signature) (cdr signature)))))
 
+(defun byte-compile-function-warn (f nargs def)
+  (when (get f 'byte-obsolete-info)
+    (byte-compile-warn-obsolete f))
+
+  ;; Check to see if the function will be available at runtime
+  ;; and/or remember its arity if it's unknown.
+  (or (and (or def (fboundp f))         ; might be a subr or autoload.
+           (not (memq f byte-compile-noruntime-functions)))
+      (eq f byte-compile-current-form)  ; ## This doesn't work
+                                        ; with recursion.
+      ;; It's a currently-undefined function.
+      ;; Remember number of args in call.
+      (let ((cons (assq f byte-compile-unresolved-functions)))
+        (if cons
+            (or (memq nargs (cdr cons))
+                (push nargs (cdr cons)))
+          (push (list f nargs)
+                byte-compile-unresolved-functions)))))
 
 ;; Warn if the form is calling a function with the wrong number of arguments.
 (defun byte-compile-callargs-warn (form)
@@ -1261,21 +1279,7 @@
             "accepts only")
           (byte-compile-arglist-signature-string sig))))
     (byte-compile-format-warn form)
-    ;; Check to see if the function will be available at runtime
-    ;; and/or remember its arity if it's unknown.
-    (or (and (or def (fboundp (car form))) ; might be a subr or autoload.
-            (not (memq (car form) byte-compile-noruntime-functions)))
-       (eq (car form) byte-compile-current-form) ; ## This doesn't work
-                                                  ; with recursion.
-       ;; It's a currently-undefined function.
-       ;; Remember number of args in call.
-       (let ((cons (assq (car form) byte-compile-unresolved-functions))
-             (n (length (cdr form))))
-         (if cons
-             (or (memq n (cdr cons))
-                 (push n (cdr cons)))
-           (push (list (car form) n)
-                 byte-compile-unresolved-functions))))))
+    (byte-compile-function-warn (car form) (length (cdr form)) def)))
 
 (defun byte-compile-format-warn (form)
   "Warn if FORM is `format'-like with inconsistent args.
@@ -2960,8 +2964,6 @@
               '(custom-declare-group custom-declare-variable
                                      custom-declare-face))
         (byte-compile-nogroup-warn form))
-    (when (get (car form) 'byte-obsolete-info)
-      (byte-compile-warn-obsolete (car form)))
     (byte-compile-callargs-warn form))
   (if byte-compile-generate-call-tree
       (byte-compile-annotate-call-tree form))
@@ -3573,24 +3575,7 @@
   (let ((f (nth 1 form)))
     (when (and (symbolp f)
                (byte-compile-warning-enabled-p 'callargs))
-      (when (get f 'byte-obsolete-info)
-        (byte-compile-warn-obsolete (car form)))
-
-      ;; Check to see if the function will be available at runtime
-      ;; and/or remember its arity if it's unknown.
-      (or (and (or (fboundp f)          ; Might be a subr or autoload.
-                   (byte-compile-fdefinition (car form) nil))
-               (not (memq f byte-compile-noruntime-functions)))
-          (eq f byte-compile-current-form) ; ## This doesn't work
-                                           ; with recursion.
-          ;; It's a currently-undefined function.
-          ;; Remember number of args in call.
-          (let ((cons (assq f byte-compile-unresolved-functions)))
-            (if cons
-                (or (memq t (cdr cons))
-                    (push t (cdr cons)))
-              (push (list f t)
-                    byte-compile-unresolved-functions)))))
+      (byte-compile-function-warn f t (byte-compile-fdefinition f nil)))
 
     (byte-compile-constant (if (eq 'lambda (car-safe f))
                                (byte-compile-lambda f)


reply via email to

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