diff lisp/emacs-lisp/bytecomp.el @ 29239:86949998e6fd

(byte-compile-callargs-warn): Use subr-arity to check primitives. (byte-compile-flush-pending, byte-compile-file-form-progn) (byte-compile-normal-call, byte-compile-list, byte-compile-concat) (byte-compile-insert, byte-compile-funcall): Use mapc instead of mapcar.
author Dave Love <fx@gnu.org>
date Fri, 26 May 2000 10:33:55 +0000
parents a7b3ff772283
children fa490904bee0
line wrap: on
line diff
--- a/lisp/emacs-lisp/bytecomp.el	Fri May 26 10:28:09 2000 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Fri May 26 10:33:55 2000 +0000
@@ -10,7 +10,7 @@
 
 ;;; This version incorporates changes up to version 2.10 of the
 ;;; Zawinski-Furuseth compiler.
-(defconst byte-compile-version "$Revision: 2.68 $")
+(defconst byte-compile-version "$Revision: 2.69 $")
 
 ;; This file is part of GNU Emacs.
 
@@ -1028,13 +1028,21 @@
 (defun byte-compile-callargs-warn (form)
   (let* ((def (or (byte-compile-fdefinition (car form) nil)
 		  (byte-compile-fdefinition (car form) t)))
-	 (sig (and def (byte-compile-arglist-signature
-			 (if (eq 'lambda (car-safe def))
-			     (nth 1 def)
-			   (if (byte-code-function-p def)
-			       (aref def 0)
-			     '(&rest def))))))
+	 (sig (if def
+		  (byte-compile-arglist-signature
+		   (if (eq 'lambda (car-safe def))
+		       (nth 1 def)
+		     (if (byte-code-function-p def)
+			 (aref def 0)
+		       '(&rest def))))
+		(if (and (fboundp (car form))
+			 (subrp (symbol-function (car form))))
+		    (subr-arity (symbol-function (car form))))))
 	 (ncall (length (cdr form))))
+    ;; Check many or unevalled from subr-arity.
+    (if (and (cdr-safe sig)
+	     (not (numberp (cdr sig))))
+	(setcdr sig nil))
     (if sig
 	(if (or (< ncall (car sig))
 		(and (cdr sig) (> ncall (cdr sig))))
@@ -1759,7 +1767,7 @@
   (if byte-compile-output
       (let ((form (byte-compile-out-toplevel t 'file)))
 	(cond ((eq (car-safe form) 'progn)
-	       (mapcar 'byte-compile-output-file-form (cdr form)))
+	       (mapc 'byte-compile-output-file-form (cdr form)))
 	      (form
 	       (byte-compile-output-file-form form)))
 	(setq byte-compile-constants nil
@@ -1852,7 +1860,7 @@
 (put 'prog1 'byte-hunk-handler 'byte-compile-file-form-progn)
 (put 'prog2 'byte-hunk-handler 'byte-compile-file-form-progn)
 (defun byte-compile-file-form-progn (form)
-  (mapcar 'byte-compile-file-form (cdr form))
+  (mapc 'byte-compile-file-form (cdr form))
   ;; Return nil so the forms are not output twice.
   nil)
 
@@ -2363,7 +2371,7 @@
   (if byte-compile-generate-call-tree
       (byte-compile-annotate-call-tree form))
   (byte-compile-push-constant (car form))
-  (mapcar 'byte-compile-form (cdr form)) ; wasteful, but faster.
+  (mapc 'byte-compile-form (cdr form))	; wasteful, but faster.
   (byte-compile-out 'byte-call (length (cdr form))))
 
 (defun byte-compile-variable-ref (base-op var)
@@ -2687,19 +2695,19 @@
     (cond ((= count 0)
 	   (byte-compile-constant nil))
 	  ((< count 5)
-	   (mapcar 'byte-compile-form (cdr form))
+	   (mapc 'byte-compile-form (cdr form))
 	   (byte-compile-out
 	    (aref [byte-list1 byte-list2 byte-list3 byte-list4] (1- count)) 0))
 	  ((and (< count 256) (not (byte-compile-version-cond
 				    byte-compile-compatibility)))
-	   (mapcar 'byte-compile-form (cdr form))
+	   (mapc 'byte-compile-form (cdr form))
 	   (byte-compile-out 'byte-listN count))
 	  (t (byte-compile-normal-call form)))))
 
 (defun byte-compile-concat (form)
   (let ((count (length (cdr form))))
     (cond ((and (< 1 count) (< count 5))
-	   (mapcar 'byte-compile-form (cdr form))
+	   (mapc 'byte-compile-form (cdr form))
 	   (byte-compile-out
 	    (aref [byte-concat2 byte-concat3 byte-concat4] (- count 2))
 	    0))
@@ -2708,7 +2716,7 @@
 	   (byte-compile-form ""))
 	  ((and (< count 256) (not (byte-compile-version-cond
 				    byte-compile-compatibility)))
-	   (mapcar 'byte-compile-form (cdr form))
+	   (mapc 'byte-compile-form (cdr form))
 	   (byte-compile-out 'byte-concatN count))
 	  ((byte-compile-normal-call form)))))
 
@@ -2822,7 +2830,7 @@
 	((and (not (byte-compile-version-cond
 		    byte-compile-compatibility))
 	      (<= (length form) 256))
-	 (mapcar 'byte-compile-form (cdr form))
+	 (mapc 'byte-compile-form (cdr form))
 	 (if (cdr (cdr form))
 	     (byte-compile-out 'byte-insertN (length (cdr form)))
 	   (byte-compile-out 'byte-insert 0)))
@@ -3020,7 +3028,7 @@
     (setq for-effect nil)))
 
 (defun byte-compile-funcall (form)
-  (mapcar 'byte-compile-form (cdr form))
+  (mapc 'byte-compile-form (cdr form))
   (byte-compile-out 'byte-call (length (cdr (cdr form)))))