mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 18:40:39 -08:00
(byte-compile-inline-expand): Look
for function definition in symbol's function value slot first instead of first consulting byte-compile-function-environment. Fix byte-compiler warnings format.
This commit is contained in:
parent
d951f8cb75
commit
78ecf55a6a
1 changed files with 14 additions and 15 deletions
|
|
@ -264,11 +264,10 @@
|
||||||
name)
|
name)
|
||||||
form)
|
form)
|
||||||
;; else
|
;; else
|
||||||
(if (and (consp fn) (eq (car fn) 'autoload))
|
(when (and (consp fn) (eq (car fn) 'autoload))
|
||||||
(progn
|
(load (nth 2 fn))
|
||||||
(load (nth 2 fn))
|
(setq fn (or (and (fboundp name) (symbol-function name))
|
||||||
(setq fn (or (cdr (assq name byte-compile-function-environment))
|
(cdr (assq name byte-compile-function-environment)))))
|
||||||
(and (fboundp name) (symbol-function name))))))
|
|
||||||
(if (and (consp fn) (eq (car fn) 'autoload))
|
(if (and (consp fn) (eq (car fn) 'autoload))
|
||||||
(error "File `%s' didn't define `%s'" (nth 2 fn) name))
|
(error "File `%s' didn't define `%s'" (nth 2 fn) name))
|
||||||
(if (symbolp fn)
|
(if (symbolp fn)
|
||||||
|
|
@ -328,7 +327,7 @@
|
||||||
bindings)
|
bindings)
|
||||||
values nil))
|
values nil))
|
||||||
((and (not optionalp) (null values))
|
((and (not optionalp) (null values))
|
||||||
(byte-compile-warn "attempt to open-code %s with too few arguments" name)
|
(byte-compile-warn "Attempt to open-code `%s' with too few arguments" name)
|
||||||
(setq arglist nil values 'too-few))
|
(setq arglist nil values 'too-few))
|
||||||
(t
|
(t
|
||||||
(setq bindings (cons (list (car arglist) (car values))
|
(setq bindings (cons (list (car arglist) (car values))
|
||||||
|
|
@ -339,7 +338,7 @@
|
||||||
(progn
|
(progn
|
||||||
(or (eq values 'too-few)
|
(or (eq values 'too-few)
|
||||||
(byte-compile-warn
|
(byte-compile-warn
|
||||||
"attempt to open-code %s with too many arguments" name))
|
"Attempt to open-code `%s' with too many arguments" name))
|
||||||
form)
|
form)
|
||||||
(setq body (mapcar 'byte-optimize-form body))
|
(setq body (mapcar 'byte-optimize-form body))
|
||||||
(let ((newform
|
(let ((newform
|
||||||
|
|
@ -370,7 +369,7 @@
|
||||||
form))
|
form))
|
||||||
((eq fn 'quote)
|
((eq fn 'quote)
|
||||||
(if (cdr (cdr form))
|
(if (cdr (cdr form))
|
||||||
(byte-compile-warn "malformed quote form: %s"
|
(byte-compile-warn "Malformed quote form: `%s'"
|
||||||
(prin1-to-string form)))
|
(prin1-to-string form)))
|
||||||
;; map (quote nil) to nil to simplify optimizer logic.
|
;; map (quote nil) to nil to simplify optimizer logic.
|
||||||
;; map quoted constants to nil if for-effect (just because).
|
;; map quoted constants to nil if for-effect (just because).
|
||||||
|
|
@ -390,7 +389,7 @@
|
||||||
(if (symbolp binding)
|
(if (symbolp binding)
|
||||||
binding
|
binding
|
||||||
(if (cdr (cdr binding))
|
(if (cdr (cdr binding))
|
||||||
(byte-compile-warn "malformed let binding: %s"
|
(byte-compile-warn "Malformed let binding: `%s'"
|
||||||
(prin1-to-string binding)))
|
(prin1-to-string binding)))
|
||||||
(list (car binding)
|
(list (car binding)
|
||||||
(byte-optimize-form (nth 1 binding) nil))))
|
(byte-optimize-form (nth 1 binding) nil))))
|
||||||
|
|
@ -403,7 +402,7 @@
|
||||||
(cons
|
(cons
|
||||||
(byte-optimize-form (car clause) nil)
|
(byte-optimize-form (car clause) nil)
|
||||||
(byte-optimize-body (cdr clause) for-effect))
|
(byte-optimize-body (cdr clause) for-effect))
|
||||||
(byte-compile-warn "malformed cond form: %s"
|
(byte-compile-warn "Malformed cond form: `%s'"
|
||||||
(prin1-to-string clause))
|
(prin1-to-string clause))
|
||||||
clause))
|
clause))
|
||||||
(cdr form))))
|
(cdr form))))
|
||||||
|
|
@ -467,7 +466,7 @@
|
||||||
(cons fn (mapcar 'byte-optimize-form (cdr form)))))
|
(cons fn (mapcar 'byte-optimize-form (cdr form)))))
|
||||||
|
|
||||||
((eq fn 'interactive)
|
((eq fn 'interactive)
|
||||||
(byte-compile-warn "misplaced interactive spec: %s"
|
(byte-compile-warn "Misplaced interactive spec: `%s'"
|
||||||
(prin1-to-string form))
|
(prin1-to-string form))
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
|
|
@ -515,7 +514,7 @@
|
||||||
|
|
||||||
((not (symbolp fn))
|
((not (symbolp fn))
|
||||||
(or (eq 'mocklisp (car-safe fn)) ; ha!
|
(or (eq 'mocklisp (car-safe fn)) ; ha!
|
||||||
(byte-compile-warn "%s is a malformed function"
|
(byte-compile-warn "`%s' is a malformed function"
|
||||||
(prin1-to-string fn)))
|
(prin1-to-string fn)))
|
||||||
form)
|
form)
|
||||||
|
|
||||||
|
|
@ -523,7 +522,7 @@
|
||||||
(or byte-compile-delete-errors
|
(or byte-compile-delete-errors
|
||||||
(eq tmp 'error-free)
|
(eq tmp 'error-free)
|
||||||
(progn
|
(progn
|
||||||
(byte-compile-warn "%s called for effect"
|
(byte-compile-warn "`%s' called for effect"
|
||||||
(prin1-to-string form))
|
(prin1-to-string form))
|
||||||
nil)))
|
nil)))
|
||||||
(byte-compile-log " %s called for effect; deleted" fn)
|
(byte-compile-log " %s called for effect; deleted" fn)
|
||||||
|
|
@ -843,7 +842,7 @@
|
||||||
(defun byte-optimize-identity (form)
|
(defun byte-optimize-identity (form)
|
||||||
(if (and (cdr form) (null (cdr (cdr form))))
|
(if (and (cdr form) (null (cdr (cdr form))))
|
||||||
(nth 1 form)
|
(nth 1 form)
|
||||||
(byte-compile-warn "identity called with %d arg%s, but requires 1"
|
(byte-compile-warn "Identity called with %d arg%s, but requires 1"
|
||||||
(length (cdr form))
|
(length (cdr form))
|
||||||
(if (= 1 (length (cdr form))) "" "s"))
|
(if (= 1 (length (cdr form))) "" "s"))
|
||||||
form))
|
form))
|
||||||
|
|
@ -1045,7 +1044,7 @@
|
||||||
(nconc (list 'funcall fn) butlast
|
(nconc (list 'funcall fn) butlast
|
||||||
(mapcar '(lambda (x) (list 'quote x)) (nth 1 last))))
|
(mapcar '(lambda (x) (list 'quote x)) (nth 1 last))))
|
||||||
(byte-compile-warn
|
(byte-compile-warn
|
||||||
"last arg to apply can't be a literal atom: %s"
|
"Last arg to apply can't be a literal atom: `%s'"
|
||||||
(prin1-to-string last))
|
(prin1-to-string last))
|
||||||
nil))
|
nil))
|
||||||
form)))
|
form)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue