diff lisp/emacs-lisp/bytecomp.el @ 46003:503e1f14ba3d

(byte-compile-callargs-warn): Check for `noruntime' even if the function has a known sig. (byte-compile-file, byte-compile-output-docform): Don't hard code point-min = 1.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 25 Jun 2002 01:09:52 +0000
parents 288c321d3282
children 9c0b15b35ce2
line wrap: on
line diff
--- a/lisp/emacs-lisp/bytecomp.el	Tue Jun 25 00:11:28 2002 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Tue Jun 25 01:09:52 2002 +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.98 $")
+(defconst byte-compile-version "$Revision: 2.99 $")
 
 ;; This file is part of GNU Emacs.
 
@@ -1113,21 +1113,23 @@
 	   (if (< ncall (car sig))
 	       "requires"
 	     "accepts only")
-	   (byte-compile-arglist-signature-string sig)))
-      (or (and (fboundp (car form))	; might be a subr or autoload.
-	       (not (get (car form) 'byte-compile-noruntime)))
-	  (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))
-		    (setcdr cons (cons n (cdr cons))))
-		(setq byte-compile-unresolved-functions
-		      (cons (list (car form) n)
-			    byte-compile-unresolved-functions))))))))
+	   (byte-compile-arglist-signature-string sig))))
+    ;; Check to see if the function will be available at runtime
+    ;; and/or remember its arity if it's unknown.
+    (or (and (or sig (fboundp (car form))) ; might be a subr or autoload.
+	     (not (get (car form) 'byte-compile-noruntime)))
+	(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))
+		  (setcdr cons (cons n (cdr cons))))
+	    (setq byte-compile-unresolved-functions
+		  (cons (list (car form) n)
+			byte-compile-unresolved-functions)))))))
 
 ;; Warn if the function or macro is being redefined with a different
 ;; number of arguments.
@@ -1492,7 +1494,7 @@
 		    ;; the build tree, without causing problems when emacs-lisp
 		    ;; files in the build tree are recompiled).
 		    (delete-file target-file))
-		  (write-region 1 (point-max) target-file))
+		  (write-region (point-min) (point-max) target-file))
 	      ;; This is just to give a better error message than write-region
 	      (signal 'file-error
 		      (list "Opening output file"
@@ -1809,7 +1811,7 @@
 		(setq position
 		      (byte-compile-output-as-comment
 		       (nth (nth 1 info) form) nil))
-		(setq position (position-bytes position))
+		(setq position (- (position-bytes position) (point-min) -1))
 		;; If the doc string starts with * (a user variable),
 		;; negate POSITION.
 		(if (and (stringp (nth (nth 1 info) form))
@@ -1843,7 +1845,7 @@
 			   (byte-compile-output-as-comment
 			    (cons (car form) (nth 1 form))
 			    t)))
-		      (setq position (position-bytes position))
+		      (setq position (- (position-bytes position) (point-min) -1))
 		      (princ (format "(#$ . %d) nil" position) outbuffer)
 		      (setq form (cdr form))
 		      (setq index (1+ index))))
@@ -2404,10 +2406,10 @@
 	 ;; constant was not optimized away because we chose to return it.
 	 (and (not (assq nil byte-compile-constants)) ; Nil is often there.
 	      (let ((tmp (reverse byte-compile-constants)))
-		(while (and tmp (not (or (symbolp (car (car tmp)))
-					 (numberp (car (car tmp))))))
+		(while (and tmp (not (or (symbolp (caar tmp))
+					 (numberp (caar tmp)))))
 		  (setq tmp (cdr tmp)))
-		(car (car tmp)))))))
+		(caar tmp))))))
   (byte-compile-out 'byte-return 0)
   (setq byte-compile-output (nreverse byte-compile-output))
   (if (memq byte-optimize '(t byte))