351 |
(const callargs) (const redefine) |
(const callargs) (const redefine) |
352 |
(const obsolete) (const noruntime) (const cl-functions)))) |
(const obsolete) (const noruntime) (const cl-functions)))) |
353 |
|
|
354 |
|
(defvar byte-compile-not-obsolete-var nil |
355 |
|
"If non-nil, this is a variable that shouldn't be reported as obsolete.") |
356 |
|
|
357 |
(defcustom byte-compile-generate-call-tree nil |
(defcustom byte-compile-generate-call-tree nil |
358 |
"*Non-nil means collect call-graph information when compiling. |
"*Non-nil means collect call-graph information when compiling. |
359 |
This records functions were called and from where. |
This records functions were called and from where. |
985 |
;; Also log the current function and file if not already done. |
;; Also log the current function and file if not already done. |
986 |
(defun byte-compile-log-warning (string &optional fill level) |
(defun byte-compile-log-warning (string &optional fill level) |
987 |
(let ((warning-prefix-function 'byte-compile-warning-prefix) |
(let ((warning-prefix-function 'byte-compile-warning-prefix) |
988 |
(warning-group-format "") |
(warning-type-format "") |
989 |
(warning-fill-prefix (if fill " "))) |
(warning-fill-prefix (if fill " "))) |
990 |
(display-warning 'bytecomp string level "*Compile-Log*"))) |
(display-warning 'bytecomp string level "*Compile-Log*"))) |
991 |
|
|
2708 |
(if (symbolp var) "constant" "nonvariable") |
(if (symbolp var) "constant" "nonvariable") |
2709 |
(prin1-to-string var)) |
(prin1-to-string var)) |
2710 |
(if (and (get var 'byte-obsolete-variable) |
(if (and (get var 'byte-obsolete-variable) |
2711 |
(memq 'obsolete byte-compile-warnings)) |
(memq 'obsolete byte-compile-warnings) |
2712 |
|
(not (eq var byte-compile-not-obsolete-var))) |
2713 |
(let* ((ob (get var 'byte-obsolete-variable)) |
(let* ((ob (get var 'byte-obsolete-variable)) |
2714 |
(when (cdr ob))) |
(when (cdr ob))) |
2715 |
(byte-compile-warn "%s is an obsolete variable%s; %s" var |
(byte-compile-warn "%s is an obsolete variable%s; %s" var |
3612 |
fun var string)) |
fun var string)) |
3613 |
`(put ',var 'variable-documentation ,string)) |
`(put ',var 'variable-documentation ,string)) |
3614 |
(if (cddr form) ; `value' provided |
(if (cddr form) ; `value' provided |
3615 |
(if (eq fun 'defconst) |
(let ((byte-compile-not-obsolete-var var)) |
3616 |
;; `defconst' sets `var' unconditionally. |
(if (eq fun 'defconst) |
3617 |
(let ((tmp (make-symbol "defconst-tmp-var"))) |
;; `defconst' sets `var' unconditionally. |
3618 |
`(funcall '(lambda (,tmp) (defconst ,var ,tmp)) |
(let ((tmp (make-symbol "defconst-tmp-var"))) |
3619 |
,value)) |
`(funcall '(lambda (,tmp) (defconst ,var ,tmp)) |
3620 |
;; `defvar' sets `var' only when unbound. |
,value)) |
3621 |
`(if (not (default-boundp ',var)) (setq-default ,var ,value))) |
;; `defvar' sets `var' only when unbound. |
3622 |
|
`(if (not (default-boundp ',var)) (setq-default ,var ,value)))) |
3623 |
(when (eq fun 'defconst) |
(when (eq fun 'defconst) |
3624 |
;; This will signal an appropriate error at runtime. |
;; This will signal an appropriate error at runtime. |
3625 |
`(eval ',form))) |
`(eval ',form))) |