aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/emacs-lisp/bytecomp.el55
2 files changed, 27 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1ce417a5de6..6b3bdfa49b5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12013-08-08 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/bytecomp.el (byte-compile-function-warn): New function,
4 extracted from byte-compile-callargs-warn and byte-compile-normal-call.
5 (byte-compile-callargs-warn, byte-compile-function-form): Use it.
6 (byte-compile-normal-call): Remove obsolescence check.
7
12013-08-08 Juanma Barranquero <lekktu@gmail.com> 82013-08-08 Juanma Barranquero <lekktu@gmail.com>
2 9
3 * frameset.el (frameset-restore): Doc fix. 10 * frameset.el (frameset-restore): Doc fix.
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index ce377dc5caf..5baef042757 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1224,6 +1224,24 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1224 (format "%d" (car signature))) 1224 (format "%d" (car signature)))
1225 (t (format "%d-%d" (car signature) (cdr signature))))) 1225 (t (format "%d-%d" (car signature) (cdr signature)))))
1226 1226
1227(defun byte-compile-function-warn (f nargs def)
1228 (when (get f 'byte-obsolete-info)
1229 (byte-compile-warn-obsolete f))
1230
1231 ;; Check to see if the function will be available at runtime
1232 ;; and/or remember its arity if it's unknown.
1233 (or (and (or def (fboundp f)) ; might be a subr or autoload.
1234 (not (memq f byte-compile-noruntime-functions)))
1235 (eq f byte-compile-current-form) ; ## This doesn't work
1236 ; with recursion.
1237 ;; It's a currently-undefined function.
1238 ;; Remember number of args in call.
1239 (let ((cons (assq f byte-compile-unresolved-functions)))
1240 (if cons
1241 (or (memq nargs (cdr cons))
1242 (push nargs (cdr cons)))
1243 (push (list f nargs)
1244 byte-compile-unresolved-functions)))))
1227 1245
1228;; Warn if the form is calling a function with the wrong number of arguments. 1246;; Warn if the form is calling a function with the wrong number of arguments.
1229(defun byte-compile-callargs-warn (form) 1247(defun byte-compile-callargs-warn (form)
@@ -1261,21 +1279,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1261 "accepts only") 1279 "accepts only")
1262 (byte-compile-arglist-signature-string sig)))) 1280 (byte-compile-arglist-signature-string sig))))
1263 (byte-compile-format-warn form) 1281 (byte-compile-format-warn form)
1264 ;; Check to see if the function will be available at runtime 1282 (byte-compile-function-warn (car form) (length (cdr form)) def)))
1265 ;; and/or remember its arity if it's unknown.
1266 (or (and (or def (fboundp (car form))) ; might be a subr or autoload.
1267 (not (memq (car form) byte-compile-noruntime-functions)))
1268 (eq (car form) byte-compile-current-form) ; ## This doesn't work
1269 ; with recursion.
1270 ;; It's a currently-undefined function.
1271 ;; Remember number of args in call.
1272 (let ((cons (assq (car form) byte-compile-unresolved-functions))
1273 (n (length (cdr form))))
1274 (if cons
1275 (or (memq n (cdr cons))
1276 (push n (cdr cons)))
1277 (push (list (car form) n)
1278 byte-compile-unresolved-functions))))))
1279 1283
1280(defun byte-compile-format-warn (form) 1284(defun byte-compile-format-warn (form)
1281 "Warn if FORM is `format'-like with inconsistent args. 1285 "Warn if FORM is `format'-like with inconsistent args.
@@ -2960,8 +2964,6 @@ That command is designed for interactive use only" fn))
2960 '(custom-declare-group custom-declare-variable 2964 '(custom-declare-group custom-declare-variable
2961 custom-declare-face)) 2965 custom-declare-face))
2962 (byte-compile-nogroup-warn form)) 2966 (byte-compile-nogroup-warn form))
2963 (when (get (car form) 'byte-obsolete-info)
2964 (byte-compile-warn-obsolete (car form)))
2965 (byte-compile-callargs-warn form)) 2967 (byte-compile-callargs-warn form))
2966 (if byte-compile-generate-call-tree 2968 (if byte-compile-generate-call-tree
2967 (byte-compile-annotate-call-tree form)) 2969 (byte-compile-annotate-call-tree form))
@@ -3573,24 +3575,7 @@ discarding."
3573 (let ((f (nth 1 form))) 3575 (let ((f (nth 1 form)))
3574 (when (and (symbolp f) 3576 (when (and (symbolp f)
3575 (byte-compile-warning-enabled-p 'callargs)) 3577 (byte-compile-warning-enabled-p 'callargs))
3576 (when (get f 'byte-obsolete-info) 3578 (byte-compile-function-warn f t (byte-compile-fdefinition f nil)))
3577 (byte-compile-warn-obsolete (car form)))
3578
3579 ;; Check to see if the function will be available at runtime
3580 ;; and/or remember its arity if it's unknown.
3581 (or (and (or (fboundp f) ; Might be a subr or autoload.
3582 (byte-compile-fdefinition (car form) nil))
3583 (not (memq f byte-compile-noruntime-functions)))
3584 (eq f byte-compile-current-form) ; ## This doesn't work
3585 ; with recursion.
3586 ;; It's a currently-undefined function.
3587 ;; Remember number of args in call.
3588 (let ((cons (assq f byte-compile-unresolved-functions)))
3589 (if cons
3590 (or (memq t (cdr cons))
3591 (push t (cdr cons)))
3592 (push (list f t)
3593 byte-compile-unresolved-functions)))))
3594 3579
3595 (byte-compile-constant (if (eq 'lambda (car-safe f)) 3580 (byte-compile-constant (if (eq 'lambda (car-safe f))
3596 (byte-compile-lambda f) 3581 (byte-compile-lambda f)