diff options
| author | Glenn Morris | 2009-09-16 03:13:03 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-09-16 03:13:03 +0000 |
| commit | 8480fc7c63f2bbea8a761ff4aab24cf61216268a (patch) | |
| tree | a7f08a77d0176eb7e72f54fd7b9d0e5129297055 | |
| parent | 124649922f929cd8194ca58ded6110a66064799f (diff) | |
| download | emacs-8480fc7c63f2bbea8a761ff4aab24cf61216268a.tar.gz emacs-8480fc7c63f2bbea8a761ff4aab24cf61216268a.zip | |
(byte-compile-not-obsolete-vars): Rename from byte-compile-not-obsolete-var.
It's a list now.
(byte-compile-not-obsolete-funcs): New variable.
(byte-compile-warn-obsolete): Don't warn about functions if they are in
byte-compile-not-obsolete-funcs.
(byte-compile-variable-ref, byte-compile-defvar): Update for
byte-compile-not-obsolete-vars name-change and list nature.
(byte-compile-maybe-guarded): Suppress warnings about obsolete functions
and variables behind (f)boundp tests.
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 421db38879f..34232fc6cb7 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -443,8 +443,11 @@ else the global value will be modified." | |||
| 443 | goto-line comint-run) | 443 | goto-line comint-run) |
| 444 | "List of commands that are not meant to be called from Lisp.") | 444 | "List of commands that are not meant to be called from Lisp.") |
| 445 | 445 | ||
| 446 | (defvar byte-compile-not-obsolete-var nil | 446 | (defvar byte-compile-not-obsolete-vars nil |
| 447 | "If non-nil, this is a variable that shouldn't be reported as obsolete.") | 447 | "If non-nil, a list of variables that shouldn't be reported as obsolete.") |
| 448 | |||
| 449 | (defvar byte-compile-not-obsolete-funcs nil | ||
| 450 | "If non-nil, a list of functions that shouldn't be reported as obsolete.") | ||
| 448 | 451 | ||
| 449 | (defcustom byte-compile-generate-call-tree nil | 452 | (defcustom byte-compile-generate-call-tree nil |
| 450 | "Non-nil means collect call-graph information when compiling. | 453 | "Non-nil means collect call-graph information when compiling. |
| @@ -1143,14 +1146,15 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." | |||
| 1143 | (obsolete (or funcp (get symbol 'byte-obsolete-variable))) | 1146 | (obsolete (or funcp (get symbol 'byte-obsolete-variable))) |
| 1144 | (instead (car obsolete)) | 1147 | (instead (car obsolete)) |
| 1145 | (asof (if funcp (nth 2 obsolete) (cdr obsolete)))) | 1148 | (asof (if funcp (nth 2 obsolete) (cdr obsolete)))) |
| 1146 | (byte-compile-warn "`%s' is an obsolete %s%s%s" symbol | 1149 | (unless (and funcp (memq symbol byte-compile-not-obsolete-funcs)) |
| 1147 | (if funcp "function" "variable") | 1150 | (byte-compile-warn "`%s' is an obsolete %s%s%s" symbol |
| 1148 | (if asof (concat " (as of Emacs " asof ")") "") | 1151 | (if funcp "function" "variable") |
| 1149 | (cond ((stringp instead) | 1152 | (if asof (concat " (as of Emacs " asof ")") "") |
| 1150 | (concat "; " instead)) | 1153 | (cond ((stringp instead) |
| 1151 | (instead | 1154 | (concat "; " instead)) |
| 1152 | (format "; use `%s' instead." instead)) | 1155 | (instead |
| 1153 | (t ".")))))) | 1156 | (format "; use `%s' instead." instead)) |
| 1157 | (t "."))))))) | ||
| 1154 | 1158 | ||
| 1155 | (defun byte-compile-report-error (error-info) | 1159 | (defun byte-compile-report-error (error-info) |
| 1156 | "Report Lisp error in compilation. ERROR-INFO is the error data." | 1160 | "Report Lisp error in compilation. ERROR-INFO is the error data." |
| @@ -1625,6 +1629,7 @@ Files in subdirectories of DIRECTORY are processed also." | |||
| 1625 | ;; of the boundp test in byte-compile-variable-ref. | 1629 | ;; of the boundp test in byte-compile-variable-ref. |
| 1626 | ;; http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg00237.html | 1630 | ;; http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg00237.html |
| 1627 | ;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-02/msg00134.html | 1631 | ;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-02/msg00134.html |
| 1632 | ;; Note that similar considerations apply to command-line-1 in startup.el. | ||
| 1628 | ;;;###autoload | 1633 | ;;;###autoload |
| 1629 | (defun byte-recompile-directory (bytecomp-directory &optional bytecomp-arg | 1634 | (defun byte-recompile-directory (bytecomp-directory &optional bytecomp-arg |
| 1630 | bytecomp-force) | 1635 | bytecomp-force) |
| @@ -3033,7 +3038,7 @@ That command is designed for interactive use only" bytecomp-fn)) | |||
| 3033 | (if (symbolp bytecomp-var) "constant" "nonvariable") | 3038 | (if (symbolp bytecomp-var) "constant" "nonvariable") |
| 3034 | (prin1-to-string bytecomp-var)) | 3039 | (prin1-to-string bytecomp-var)) |
| 3035 | (and (get bytecomp-var 'byte-obsolete-variable) | 3040 | (and (get bytecomp-var 'byte-obsolete-variable) |
| 3036 | (not (eq bytecomp-var byte-compile-not-obsolete-var)) | 3041 | (not (memq bytecomp-var byte-compile-not-obsolete-vars)) |
| 3037 | (byte-compile-warn-obsolete bytecomp-var)) | 3042 | (byte-compile-warn-obsolete bytecomp-var)) |
| 3038 | (if (byte-compile-warning-enabled-p 'free-vars) | 3043 | (if (byte-compile-warning-enabled-p 'free-vars) |
| 3039 | (if (eq base-op 'byte-varbind) | 3044 | (if (eq base-op 'byte-varbind) |
| @@ -3670,7 +3675,7 @@ CONDITION is a variable whose value is a test in an `if' or `cond'. | |||
| 3670 | BODY is the code to compile in the first arm of the if or the body of | 3675 | BODY is the code to compile in the first arm of the if or the body of |
| 3671 | the cond clause. If CONDITION's value is of the form (fboundp 'foo) | 3676 | the cond clause. If CONDITION's value is of the form (fboundp 'foo) |
| 3672 | or (boundp 'foo), the relevant warnings from BODY about foo's | 3677 | or (boundp 'foo), the relevant warnings from BODY about foo's |
| 3673 | being undefined will be suppressed. | 3678 | being undefined (or obsolete) will be suppressed. |
| 3674 | 3679 | ||
| 3675 | If CONDITION's value is (not (featurep 'emacs)) or (featurep 'xemacs), | 3680 | If CONDITION's value is (not (featurep 'emacs)) or (featurep 'xemacs), |
| 3676 | that suppresses all warnings during execution of BODY." | 3681 | that suppresses all warnings during execution of BODY." |
| @@ -3686,7 +3691,14 @@ that suppresses all warnings during execution of BODY." | |||
| 3686 | (append bound-list byte-compile-bound-variables) | 3691 | (append bound-list byte-compile-bound-variables) |
| 3687 | byte-compile-bound-variables))) | 3692 | byte-compile-bound-variables))) |
| 3688 | (unwind-protect | 3693 | (unwind-protect |
| 3689 | (progn ,@body) | 3694 | ;; If things not being bound at all is ok, so must them being obsolete. |
| 3695 | ;; Note that we add to the existing lists since Tramp (ab)uses | ||
| 3696 | ;; this feature. | ||
| 3697 | (let ((byte-compile-not-obsolete-vars | ||
| 3698 | (append byte-compile-not-obsolete-vars bound-list)) | ||
| 3699 | (byte-compile-not-obsolete-funcs | ||
| 3700 | (append byte-compile-not-obsolete-funcs fbound-list))) | ||
| 3701 | ,@body) | ||
| 3690 | ;; Maybe remove the function symbol from the unresolved list. | 3702 | ;; Maybe remove the function symbol from the unresolved list. |
| 3691 | (dolist (fbound fbound-list) | 3703 | (dolist (fbound fbound-list) |
| 3692 | (when fbound | 3704 | (when fbound |
| @@ -3814,7 +3826,8 @@ that suppresses all warnings during execution of BODY." | |||
| 3814 | (let ((byte-compile-bound-variables byte-compile-bound-variables) ;new scope | 3826 | (let ((byte-compile-bound-variables byte-compile-bound-variables) ;new scope |
| 3815 | (varlist (reverse (car (cdr form))))) | 3827 | (varlist (reverse (car (cdr form))))) |
| 3816 | (dolist (var varlist) | 3828 | (dolist (var varlist) |
| 3817 | (byte-compile-variable-ref 'byte-varbind (if (consp var) (car var) var))) | 3829 | (byte-compile-variable-ref 'byte-varbind |
| 3830 | (if (consp var) (car var) var))) | ||
| 3818 | (byte-compile-body-do-effect (cdr (cdr form))) | 3831 | (byte-compile-body-do-effect (cdr (cdr form))) |
| 3819 | (byte-compile-out 'byte-unbind (length (car (cdr form)))))) | 3832 | (byte-compile-out 'byte-unbind (length (car (cdr form)))))) |
| 3820 | 3833 | ||
| @@ -4030,7 +4043,7 @@ that suppresses all warnings during execution of BODY." | |||
| 4030 | fun var string)) | 4043 | fun var string)) |
| 4031 | `(put ',var 'variable-documentation ,string)) | 4044 | `(put ',var 'variable-documentation ,string)) |
| 4032 | (if (cddr form) ; `value' provided | 4045 | (if (cddr form) ; `value' provided |
| 4033 | (let ((byte-compile-not-obsolete-var var)) | 4046 | (let ((byte-compile-not-obsolete-vars (list var))) |
| 4034 | (if (eq fun 'defconst) | 4047 | (if (eq fun 'defconst) |
| 4035 | ;; `defconst' sets `var' unconditionally. | 4048 | ;; `defconst' sets `var' unconditionally. |
| 4036 | (let ((tmp (make-symbol "defconst-tmp-var"))) | 4049 | (let ((tmp (make-symbol "defconst-tmp-var"))) |