aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2002-06-25 01:09:52 +0000
committerStefan Monnier2002-06-25 01:09:52 +0000
commitba76e7fac50d8ddf96360f467b90f8b48361bafd (patch)
treec1027f13a5acab34466023cf1f756b17b865f343
parent498ecddeeefea9c65e7fba35a0d8515bde1655dc (diff)
downloademacs-ba76e7fac50d8ddf96360f467b90f8b48361bafd.tar.gz
emacs-ba76e7fac50d8ddf96360f467b90f8b48361bafd.zip
(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.
-rw-r--r--lisp/emacs-lisp/bytecomp.el46
1 files changed, 24 insertions, 22 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 7b403c01e6c..91aa6c53d18 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -10,7 +10,7 @@
10 10
11;;; This version incorporates changes up to version 2.10 of the 11;;; This version incorporates changes up to version 2.10 of the
12;;; Zawinski-Furuseth compiler. 12;;; Zawinski-Furuseth compiler.
13(defconst byte-compile-version "$Revision: 2.98 $") 13(defconst byte-compile-version "$Revision: 2.99 $")
14 14
15;; This file is part of GNU Emacs. 15;; This file is part of GNU Emacs.
16 16
@@ -1113,21 +1113,23 @@ Each function's symbol gets marked with the `byte-compile-noruntime' property."
1113 (if (< ncall (car sig)) 1113 (if (< ncall (car sig))
1114 "requires" 1114 "requires"
1115 "accepts only") 1115 "accepts only")
1116 (byte-compile-arglist-signature-string sig))) 1116 (byte-compile-arglist-signature-string sig))))
1117 (or (and (fboundp (car form)) ; might be a subr or autoload. 1117 ;; Check to see if the function will be available at runtime
1118 (not (get (car form) 'byte-compile-noruntime))) 1118 ;; and/or remember its arity if it's unknown.
1119 (eq (car form) byte-compile-current-form) ; ## this doesn't work 1119 (or (and (or sig (fboundp (car form))) ; might be a subr or autoload.
1120 ; with recursion. 1120 (not (get (car form) 'byte-compile-noruntime)))
1121 ;; It's a currently-undefined function. 1121 (eq (car form) byte-compile-current-form) ; ## this doesn't work
1122 ;; Remember number of args in call. 1122 ; with recursion.
1123 (let ((cons (assq (car form) byte-compile-unresolved-functions)) 1123 ;; It's a currently-undefined function.
1124 (n (length (cdr form)))) 1124 ;; Remember number of args in call.
1125 (if cons 1125 (let ((cons (assq (car form) byte-compile-unresolved-functions))
1126 (or (memq n (cdr cons)) 1126 (n (length (cdr form))))
1127 (setcdr cons (cons n (cdr cons)))) 1127 (if cons
1128 (setq byte-compile-unresolved-functions 1128 (or (memq n (cdr cons))
1129 (cons (list (car form) n) 1129 (setcdr cons (cons n (cdr cons))))
1130 byte-compile-unresolved-functions)))))))) 1130 (setq byte-compile-unresolved-functions
1131 (cons (list (car form) n)
1132 byte-compile-unresolved-functions)))))))
1131 1133
1132;; Warn if the function or macro is being redefined with a different 1134;; Warn if the function or macro is being redefined with a different
1133;; number of arguments. 1135;; number of arguments.
@@ -1492,7 +1494,7 @@ The value is non-nil if there were no errors, nil if errors."
1492 ;; the build tree, without causing problems when emacs-lisp 1494 ;; the build tree, without causing problems when emacs-lisp
1493 ;; files in the build tree are recompiled). 1495 ;; files in the build tree are recompiled).
1494 (delete-file target-file)) 1496 (delete-file target-file))
1495 (write-region 1 (point-max) target-file)) 1497 (write-region (point-min) (point-max) target-file))
1496 ;; This is just to give a better error message than write-region 1498 ;; This is just to give a better error message than write-region
1497 (signal 'file-error 1499 (signal 'file-error
1498 (list "Opening output file" 1500 (list "Opening output file"
@@ -1809,7 +1811,7 @@ list that represents a doc string reference.
1809 (setq position 1811 (setq position
1810 (byte-compile-output-as-comment 1812 (byte-compile-output-as-comment
1811 (nth (nth 1 info) form) nil)) 1813 (nth (nth 1 info) form) nil))
1812 (setq position (position-bytes position)) 1814 (setq position (- (position-bytes position) (point-min) -1))
1813 ;; If the doc string starts with * (a user variable), 1815 ;; If the doc string starts with * (a user variable),
1814 ;; negate POSITION. 1816 ;; negate POSITION.
1815 (if (and (stringp (nth (nth 1 info) form)) 1817 (if (and (stringp (nth (nth 1 info) form))
@@ -1843,7 +1845,7 @@ list that represents a doc string reference.
1843 (byte-compile-output-as-comment 1845 (byte-compile-output-as-comment
1844 (cons (car form) (nth 1 form)) 1846 (cons (car form) (nth 1 form))
1845 t))) 1847 t)))
1846 (setq position (position-bytes position)) 1848 (setq position (- (position-bytes position) (point-min) -1))
1847 (princ (format "(#$ . %d) nil" position) outbuffer) 1849 (princ (format "(#$ . %d) nil" position) outbuffer)
1848 (setq form (cdr form)) 1850 (setq form (cdr form))
1849 (setq index (1+ index)))) 1851 (setq index (1+ index))))
@@ -2404,10 +2406,10 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2404 ;; constant was not optimized away because we chose to return it. 2406 ;; constant was not optimized away because we chose to return it.
2405 (and (not (assq nil byte-compile-constants)) ; Nil is often there. 2407 (and (not (assq nil byte-compile-constants)) ; Nil is often there.
2406 (let ((tmp (reverse byte-compile-constants))) 2408 (let ((tmp (reverse byte-compile-constants)))
2407 (while (and tmp (not (or (symbolp (car (car tmp))) 2409 (while (and tmp (not (or (symbolp (caar tmp))
2408 (numberp (car (car tmp)))))) 2410 (numberp (caar tmp)))))
2409 (setq tmp (cdr tmp))) 2411 (setq tmp (cdr tmp)))
2410 (car (car tmp))))))) 2412 (caar tmp))))))
2411 (byte-compile-out 'byte-return 0) 2413 (byte-compile-out 'byte-return 0)
2412 (setq byte-compile-output (nreverse byte-compile-output)) 2414 (setq byte-compile-output (nreverse byte-compile-output))
2413 (if (memq byte-optimize '(t byte)) 2415 (if (memq byte-optimize '(t byte))