1008 |
(when (nth 2 new))) |
(when (nth 2 new))) |
1009 |
(byte-compile-set-symbol-position (car form)) |
(byte-compile-set-symbol-position (car form)) |
1010 |
(if (memq 'obsolete byte-compile-warnings) |
(if (memq 'obsolete byte-compile-warnings) |
1011 |
(byte-compile-warn "%s is an obsolete function%s; %s" (car form) |
(byte-compile-warn "`%s' is an obsolete function%s; %s" (car form) |
1012 |
(if when (concat " since " when) "") |
(if when (concat " since " when) "") |
1013 |
(if (stringp (car new)) |
(if (stringp (car new)) |
1014 |
(car new) |
(car new) |
1015 |
(format "use %s instead." (car new))))) |
(format "use `%s' instead." (car new))))) |
1016 |
(funcall (or handler 'byte-compile-normal-call) form))) |
(funcall (or handler 'byte-compile-normal-call) form))) |
1017 |
|
|
1018 |
;; Compiler options |
;; Compiler options |
2076 |
(defun byte-compile-file-form-defsubst (form) |
(defun byte-compile-file-form-defsubst (form) |
2077 |
(when (assq (nth 1 form) byte-compile-unresolved-functions) |
(when (assq (nth 1 form) byte-compile-unresolved-functions) |
2078 |
(setq byte-compile-current-form (nth 1 form)) |
(setq byte-compile-current-form (nth 1 form)) |
2079 |
(byte-compile-warn "defsubst %s was used before it was defined" |
(byte-compile-warn "defsubst `%s' was used before it was defined" |
2080 |
(nth 1 form))) |
(nth 1 form))) |
2081 |
(byte-compile-file-form |
(byte-compile-file-form |
2082 |
(macroexpand form byte-compile-macro-environment)) |
(macroexpand form byte-compile-macro-environment)) |
2206 |
(not (assq (nth 1 form) |
(not (assq (nth 1 form) |
2207 |
byte-compile-initial-macro-environment))) |
byte-compile-initial-macro-environment))) |
2208 |
(byte-compile-warn |
(byte-compile-warn |
2209 |
"%s defined multiple times, as both function and macro" |
"`%s' defined multiple times, as both function and macro" |
2210 |
(nth 1 form))) |
(nth 1 form))) |
2211 |
(setcdr that-one nil)) |
(setcdr that-one nil)) |
2212 |
(this-one |
(this-one |
2215 |
;; byte-compiler macros in byte-run.el... |
;; byte-compiler macros in byte-run.el... |
2216 |
(not (assq (nth 1 form) |
(not (assq (nth 1 form) |
2217 |
byte-compile-initial-macro-environment))) |
byte-compile-initial-macro-environment))) |
2218 |
(byte-compile-warn "%s %s defined multiple times in this file" |
(byte-compile-warn "%s `%s' defined multiple times in this file" |
2219 |
(if macrop "macro" "function") |
(if macrop "macro" "function") |
2220 |
(nth 1 form)))) |
(nth 1 form)))) |
2221 |
((and (fboundp name) |
((and (fboundp name) |
2222 |
(eq (car-safe (symbol-function name)) |
(eq (car-safe (symbol-function name)) |
2223 |
(if macrop 'lambda 'macro))) |
(if macrop 'lambda 'macro))) |
2224 |
(when (memq 'redefine byte-compile-warnings) |
(when (memq 'redefine byte-compile-warnings) |
2225 |
(byte-compile-warn "%s %s being redefined as a %s" |
(byte-compile-warn "%s `%s' being redefined as a %s" |
2226 |
(if macrop "function" "macro") |
(if macrop "function" "macro") |
2227 |
(nth 1 form) |
(nth 1 form) |
2228 |
(if macrop "macro" "function"))) |
(if macrop "macro" "function"))) |
2695 |
(handler (get fn 'byte-compile))) |
(handler (get fn 'byte-compile))) |
2696 |
(byte-compile-set-symbol-position fn) |
(byte-compile-set-symbol-position fn) |
2697 |
(when (byte-compile-const-symbol-p fn) |
(when (byte-compile-const-symbol-p fn) |
2698 |
(byte-compile-warn "%s called as a function" fn)) |
(byte-compile-warn "`%s' called as a function" fn)) |
2699 |
(if (and handler |
(if (and handler |
2700 |
(or (not (byte-compile-version-cond |
(or (not (byte-compile-version-cond |
2701 |
byte-compile-compatibility)) |
byte-compile-compatibility)) |
2730 |
(if (or (not (symbolp var)) |
(if (or (not (symbolp var)) |
2731 |
(byte-compile-const-symbol-p var (not (eq base-op 'byte-varref)))) |
(byte-compile-const-symbol-p var (not (eq base-op 'byte-varref)))) |
2732 |
(byte-compile-warn |
(byte-compile-warn |
2733 |
(cond ((eq base-op 'byte-varbind) "attempt to let-bind %s %s") |
(cond ((eq base-op 'byte-varbind) "attempt to let-bind %s `%s'") |
2734 |
((eq base-op 'byte-varset) "variable assignment to %s %s") |
((eq base-op 'byte-varset) "variable assignment to %s `%s'") |
2735 |
(t "variable reference to %s %s")) |
(t "variable reference to %s `%s'")) |
2736 |
(if (symbolp var) "constant" "nonvariable") |
(if (symbolp var) "constant" "nonvariable") |
2737 |
(prin1-to-string var)) |
(prin1-to-string var)) |
2738 |
(if (and (get var 'byte-obsolete-variable) |
(if (and (get var 'byte-obsolete-variable) |
2740 |
(not (eq var byte-compile-not-obsolete-var))) |
(not (eq var byte-compile-not-obsolete-var))) |
2741 |
(let* ((ob (get var 'byte-obsolete-variable)) |
(let* ((ob (get var 'byte-obsolete-variable)) |
2742 |
(when (cdr ob))) |
(when (cdr ob))) |
2743 |
(byte-compile-warn "%s is an obsolete variable%s; %s" var |
(byte-compile-warn "`%s' is an obsolete variable%s; %s" var |
2744 |
(if when (concat " since " when) "") |
(if when (concat " since " when) "") |
2745 |
(if (stringp (car ob)) |
(if (stringp (car ob)) |
2746 |
(car ob) |
(car ob) |
2747 |
(format "use %s instead." (car ob)))))) |
(format "use `%s' instead." (car ob)))))) |
2748 |
(if (memq 'free-vars byte-compile-warnings) |
(if (memq 'free-vars byte-compile-warnings) |
2749 |
(if (eq base-op 'byte-varbind) |
(if (eq base-op 'byte-varbind) |
2750 |
(push var byte-compile-bound-variables) |
(push var byte-compile-bound-variables) |
2753 |
(if (eq base-op 'byte-varset) |
(if (eq base-op 'byte-varset) |
2754 |
(or (memq var byte-compile-free-assignments) |
(or (memq var byte-compile-free-assignments) |
2755 |
(progn |
(progn |
2756 |
(byte-compile-warn "assignment to free variable %s" var) |
(byte-compile-warn "assignment to free variable `%s'" var) |
2757 |
(push var byte-compile-free-assignments))) |
(push var byte-compile-free-assignments))) |
2758 |
(or (memq var byte-compile-free-references) |
(or (memq var byte-compile-free-references) |
2759 |
(progn |
(progn |
2760 |
(byte-compile-warn "reference to free variable %s" var) |
(byte-compile-warn "reference to free variable `%s'" var) |
2761 |
(push var byte-compile-free-references)))))))) |
(push var byte-compile-free-references)))))))) |
2762 |
(let ((tmp (assq var byte-compile-variables))) |
(let ((tmp (assq var byte-compile-variables))) |
2763 |
(unless tmp |
(unless tmp |
2958 |
|
|
2959 |
(defun byte-compile-subr-wrong-args (form n) |
(defun byte-compile-subr-wrong-args (form n) |
2960 |
(byte-compile-set-symbol-position (car form)) |
(byte-compile-set-symbol-position (car form)) |
2961 |
(byte-compile-warn "%s called with %d arg%s, but requires %s" |
(byte-compile-warn "`%s' called with %d arg%s, but requires %s" |
2962 |
(car form) (length (cdr form)) |
(car form) (length (cdr form)) |
2963 |
(if (= 1 (length (cdr form))) "" "s") n) |
(if (= 1 (length (cdr form))) "" "s") n) |
2964 |
;; get run-time wrong-number-of-args error. |
;; get run-time wrong-number-of-args error. |
3124 |
(if (and (consp (car body)) |
(if (and (consp (car body)) |
3125 |
(not (eq 'byte-code (car (car body))))) |
(not (eq 'byte-code (car (car body))))) |
3126 |
(byte-compile-warn |
(byte-compile-warn |
3127 |
"A quoted lambda form is the second argument of fset. This is probably |
"A quoted lambda form is the second argument of `fset'. This is probably |
3128 |
not what you want, as that lambda cannot be compiled. Consider using |
not what you want, as that lambda cannot be compiled. Consider using |
3129 |
the syntax (function (lambda (...) ...)) instead."))))) |
the syntax (function (lambda (...) ...)) instead."))))) |
3130 |
(byte-compile-two-args form)) |
(byte-compile-two-args form)) |
3507 |
(byte-compile-set-symbol-position 'condition-case) |
(byte-compile-set-symbol-position 'condition-case) |
3508 |
(unless (symbolp var) |
(unless (symbolp var) |
3509 |
(byte-compile-warn |
(byte-compile-warn |
3510 |
"%s is not a variable-name or nil (in condition-case)" var)) |
"`%s' is not a variable-name or nil (in condition-case)" var)) |
3511 |
(byte-compile-push-constant var) |
(byte-compile-push-constant var) |
3512 |
(byte-compile-push-constant (byte-compile-top-level |
(byte-compile-push-constant (byte-compile-top-level |
3513 |
(nth 2 form) for-effect)) |
(nth 2 form) for-effect)) |
3525 |
(setq syms (cdr syms))) |
(setq syms (cdr syms))) |
3526 |
ok)))) |
ok)))) |
3527 |
(byte-compile-warn |
(byte-compile-warn |
3528 |
"%s is not a condition name or list of such (in condition-case)" |
"`%s' is not a condition name or list of such (in condition-case)" |
3529 |
(prin1-to-string condition))) |
(prin1-to-string condition))) |
3530 |
;; ((not (or (eq condition 't) |
;; ((not (or (eq condition 't) |
3531 |
;; (and (stringp (get condition 'error-message)) |
;; (and (stringp (get condition 'error-message)) |
3532 |
;; (consp (get condition 'error-conditions))))) |
;; (consp (get condition 'error-conditions))))) |
3533 |
;; (byte-compile-warn |
;; (byte-compile-warn |
3534 |
;; "%s is not a known condition name (in condition-case)" |
;; "`%s' is not a known condition name (in condition-case)" |
3535 |
;; condition)) |
;; condition)) |
3536 |
) |
) |
3537 |
(setq compiled-clauses |
(setq compiled-clauses |
3627 |
(and (eq fun 'defconst) (null (cddr form)))) |
(and (eq fun 'defconst) (null (cddr form)))) |
3628 |
(let ((ncall (length (cdr form)))) |
(let ((ncall (length (cdr form)))) |
3629 |
(byte-compile-warn |
(byte-compile-warn |
3630 |
"%s called with %d argument%s, but %s %s" |
"`%s' called with %d argument%s, but %s %s" |
3631 |
fun ncall |
fun ncall |
3632 |
(if (= 1 ncall) "" "s") |
(if (= 1 ncall) "" "s") |
3633 |
(if (< ncall 2) "requires" "accepts only") |
(if (< ncall 2) "requires" "accepts only") |
3644 |
`(push ',var current-load-list)) |
`(push ',var current-load-list)) |
3645 |
(when (> (length form) 3) |
(when (> (length form) 3) |
3646 |
(when (and string (not (stringp string))) |
(when (and string (not (stringp string))) |
3647 |
(byte-compile-warn "third arg to %s %s is not a string: %s" |
(byte-compile-warn "third arg to `%s %s' is not a string: %s" |
3648 |
fun var string)) |
fun var string)) |
3649 |
`(put ',var 'variable-documentation ,string)) |
`(put ',var 'variable-documentation ,string)) |
3650 |
(if (cddr form) ; `value' provided |
(if (cddr form) ; `value' provided |