447 |
"Alist of functions defined in the file being compiled. |
"Alist of functions defined in the file being compiled. |
448 |
This is so we can inline them when necessary. |
This is so we can inline them when necessary. |
449 |
Each element looks like (FUNCTIONNAME . DEFINITION). It is |
Each element looks like (FUNCTIONNAME . DEFINITION). It is |
450 |
\(FUNCTIONNAME . nil) when a function is redefined as a macro.") |
\(FUNCTIONNAME . nil) when a function is redefined as a macro. |
451 |
|
It is \(FUNCTIONNAME . t) when all we know is that it was defined, |
452 |
|
and we don't know the definition.") |
453 |
|
|
454 |
(defvar byte-compile-unresolved-functions nil |
(defvar byte-compile-unresolved-functions nil |
455 |
"Alist of undefined functions to which calls have been compiled. |
"Alist of undefined functions to which calls have been compiled. |
1105 |
|
|
1106 |
;;; sanity-checking arglists |
;;; sanity-checking arglists |
1107 |
|
|
1108 |
|
;; If a function has an entry saying (FUNCTION . t). |
1109 |
|
;; that means we know it is defined but we don't know how. |
1110 |
|
;; If a function has an entry saying (FUNCTION . nil), |
1111 |
|
;; that means treat it as not defined. |
1112 |
(defun byte-compile-fdefinition (name macro-p) |
(defun byte-compile-fdefinition (name macro-p) |
1113 |
(let* ((list (if macro-p |
(let* ((list (if macro-p |
1114 |
byte-compile-macro-environment |
byte-compile-macro-environment |
1174 |
(defun byte-compile-callargs-warn (form) |
(defun byte-compile-callargs-warn (form) |
1175 |
(let* ((def (or (byte-compile-fdefinition (car form) nil) |
(let* ((def (or (byte-compile-fdefinition (car form) nil) |
1176 |
(byte-compile-fdefinition (car form) t))) |
(byte-compile-fdefinition (car form) t))) |
1177 |
(sig (if def |
(sig (if (and def (not (eq def t))) |
1178 |
(byte-compile-arglist-signature |
(byte-compile-arglist-signature |
1179 |
(if (eq 'lambda (car-safe def)) |
(if (eq 'lambda (car-safe def)) |
1180 |
(nth 1 def) |
(nth 1 def) |
1204 |
(byte-compile-format-warn form) |
(byte-compile-format-warn form) |
1205 |
;; Check to see if the function will be available at runtime |
;; Check to see if the function will be available at runtime |
1206 |
;; and/or remember its arity if it's unknown. |
;; and/or remember its arity if it's unknown. |
1207 |
(or (and (or sig (fboundp (car form))) ; might be a subr or autoload. |
(or (and (or def (fboundp (car form))) ; might be a subr or autoload. |
1208 |
(not (memq (car form) byte-compile-noruntime-functions))) |
(not (memq (car form) byte-compile-noruntime-functions))) |
1209 |
(eq (car form) byte-compile-current-form) ; ## this doesn't work |
(eq (car form) byte-compile-current-form) ; ## this doesn't work |
1210 |
; with recursion. |
; with recursion. |
1249 |
;; number of arguments. |
;; number of arguments. |
1250 |
(defun byte-compile-arglist-warn (form macrop) |
(defun byte-compile-arglist-warn (form macrop) |
1251 |
(let ((old (byte-compile-fdefinition (nth 1 form) macrop))) |
(let ((old (byte-compile-fdefinition (nth 1 form) macrop))) |
1252 |
(if old |
(if (and old (not (eq old t))) |
1253 |
(let ((sig1 (byte-compile-arglist-signature |
(let ((sig1 (byte-compile-arglist-signature |
1254 |
(if (eq 'lambda (car-safe old)) |
(if (eq 'lambda (car-safe old)) |
1255 |
(nth 1 old) |
(nth 1 old) |
3720 |
(if (and (consp (cdr form)) (consp (nth 1 form)) |
(if (and (consp (cdr form)) (consp (nth 1 form)) |
3721 |
(eq (car (nth 1 form)) 'quote) |
(eq (car (nth 1 form)) 'quote) |
3722 |
(consp (cdr (nth 1 form))) |
(consp (cdr (nth 1 form))) |
3723 |
(symbolp (nth 1 (nth 1 form))) |
(symbolp (nth 1 (nth 1 form)))) |
3724 |
(consp (nthcdr 2 form)) |
(let ((constant |
3725 |
(consp (nth 2 form)) |
(and (consp (nthcdr 2 form)) |
3726 |
(eq (car (nth 2 form)) 'quote) |
(consp (nth 2 form)) |
3727 |
(consp (cdr (nth 2 form))) |
(eq (car (nth 2 form)) 'quote) |
3728 |
(symbolp (nth 1 (nth 2 form)))) |
(consp (cdr (nth 2 form))) |
3729 |
(progn |
(symbolp (nth 1 (nth 2 form)))))) |
3730 |
(byte-compile-defalias-warn (nth 1 (nth 1 form))) |
(byte-compile-defalias-warn (nth 1 (nth 1 form))) |
3731 |
(setq byte-compile-function-environment |
(setq byte-compile-function-environment |
3732 |
(cons (cons (nth 1 (nth 1 form)) |
(cons (cons (nth 1 (nth 1 form)) |
3733 |
(nth 1 (nth 2 form))) |
(if constant (nth 1 (nth 2 form)) t)) |
3734 |
byte-compile-function-environment)))) |
byte-compile-function-environment)))) |
3735 |
(byte-compile-normal-call form)) |
(byte-compile-normal-call form)) |
3736 |
|
|
3934 |
(while rest |
(while rest |
3935 |
(or (nth 1 (car rest)) |
(or (nth 1 (car rest)) |
3936 |
(null (setq f (car (car rest)))) |
(null (setq f (car (car rest)))) |
3937 |
(byte-compile-fdefinition f t) |
(functionp (byte-compile-fdefinition f t)) |
3938 |
(commandp (byte-compile-fdefinition f nil)) |
(commandp (byte-compile-fdefinition f nil)) |
3939 |
(setq uncalled (cons f uncalled))) |
(setq uncalled (cons f uncalled))) |
3940 |
(setq rest (cdr rest))) |
(setq rest (cdr rest))) |