aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-12-26 01:28:59 +0000
committerRichard M. Stallman1994-12-26 01:28:59 +0000
commit9290191f09f64c28b7b5cef4ac09b387316693ed (patch)
treed354d19cfda4feab3b8fcc96a163d02a57a12408
parent13d76d1ca585fbdc1810970b247a2053a8f3cdcc (diff)
downloademacs-9290191f09f64c28b7b5cef4ac09b387316693ed.tar.gz
emacs-9290191f09f64c28b7b5cef4ac09b387316693ed.zip
(byte-compile-warning-types): Add obsolete.
(byte-compile-warnings): Doc fix. (byte-compile-obsolete): Check for obsolete in byte-compile-warnings. (byte-compile-variable-ref): Likewise.
-rw-r--r--lisp/emacs-lisp/bytecomp.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index e2b315f3868..f689ae39eff 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -97,6 +97,7 @@
97;;; 'redefine (function cell redefined from 97;;; 'redefine (function cell redefined from
98;;; a macro to a lambda or vice versa, 98;;; a macro to a lambda or vice versa,
99;;; or redefined to take other args) 99;;; or redefined to take other args)
100;;; 'obsolete (obsolete variables and functions)
100;;; byte-compile-compatibility Whether the compiler should 101;;; byte-compile-compatibility Whether the compiler should
101;;; generate .elc files which can be loaded into 102;;; generate .elc files which can be loaded into
102;;; generic emacs 18. 103;;; generic emacs 18.
@@ -277,7 +278,8 @@ If it is 'byte, then only byte-level optimizations will be logged.")
277(defvar byte-compile-error-on-warn nil 278(defvar byte-compile-error-on-warn nil
278 "*If true, the byte-compiler reports warnings with `error'.") 279 "*If true, the byte-compiler reports warnings with `error'.")
279 280
280(defconst byte-compile-warning-types '(redefine callargs free-vars unresolved)) 281(defconst byte-compile-warning-types
282 '(redefine callargs free-vars unresolved obsolete))
281(defvar byte-compile-warnings t 283(defvar byte-compile-warnings t
282 "*List of warnings that the byte-compiler should issue (t for all). 284 "*List of warnings that the byte-compiler should issue (t for all).
283Elements of the list may be be: 285Elements of the list may be be:
@@ -287,6 +289,7 @@ Elements of the list may be be:
287 callargs lambda calls with args that don't match the definition. 289 callargs lambda calls with args that don't match the definition.
288 redefine function cell redefined from a macro to a lambda or vice 290 redefine function cell redefined from a macro to a lambda or vice
289 versa, or redefined to take a different number of arguments. 291 versa, or redefined to take a different number of arguments.
292 obsolete obsolete variables and functions.
290 293
291See also the macro `byte-compiler-options'.") 294See also the macro `byte-compiler-options'.")
292 295
@@ -788,12 +791,13 @@ otherwise pop it")
788 791
789;;; Used by make-obsolete. 792;;; Used by make-obsolete.
790(defun byte-compile-obsolete (form) 793(defun byte-compile-obsolete (form)
791 (let ((new (get (car form) 'byte-obsolete-info))) 794 (if (memq 'obsolete byte-compile-warnings)
792 (byte-compile-warn "%s is an obsolete function; %s" (car form) 795 (let ((new (get (car form) 'byte-obsolete-info)))
793 (if (stringp (car new)) 796 (byte-compile-warn "%s is an obsolete function; %s" (car form)
794 (car new) 797 (if (stringp (car new))
795 (format "use %s instead." (car new)))) 798 (car new)
796 (funcall (or (cdr new) 'byte-compile-normal-call) form))) 799 (format "use %s instead." (car new))))
800 (funcall (or (cdr new) 'byte-compile-normal-call) form))))
797 801
798;; Compiler options 802;; Compiler options
799 803
@@ -2057,7 +2061,8 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2057 "Variable reference to %s %s") 2061 "Variable reference to %s %s")
2058 (if (symbolp var) "constant" "nonvariable") 2062 (if (symbolp var) "constant" "nonvariable")
2059 (prin1-to-string var)) 2063 (prin1-to-string var))
2060 (if (get var 'byte-obsolete-variable) 2064 (if (and (get var 'byte-obsolete-variable)
2065 (memq 'obsolete byte-compile-warnings))
2061 (let ((ob (get var 'byte-obsolete-variable))) 2066 (let ((ob (get var 'byte-obsolete-variable)))
2062 (byte-compile-warn "%s is an obsolete variable; %s" var 2067 (byte-compile-warn "%s is an obsolete variable; %s" var
2063 (if (stringp ob) 2068 (if (stringp ob)