summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-12-26 01:28:59 +0000
committerRichard M. Stallman <rms@gnu.org>1994-12-26 01:28:59 +0000
commit9290191f09f64c28b7b5cef4ac09b387316693ed (patch)
treed354d19cfda4feab3b8fcc96a163d02a57a12408 /lisp/emacs-lisp
parent13d76d1ca585fbdc1810970b247a2053a8f3cdcc (diff)
downloademacs-9290191f09f64c28b7b5cef4ac09b387316693ed.tar.gz
emacs-9290191f09f64c28b7b5cef4ac09b387316693ed.tar.bz2
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.
Diffstat (limited to 'lisp/emacs-lisp')
-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 @@
;;; 'redefine (function cell redefined from
;;; a macro to a lambda or vice versa,
;;; or redefined to take other args)
+;;; 'obsolete (obsolete variables and functions)
;;; byte-compile-compatibility Whether the compiler should
;;; generate .elc files which can be loaded into
;;; generic emacs 18.
@@ -277,7 +278,8 @@ If it is 'byte, then only byte-level optimizations will be logged.")
(defvar byte-compile-error-on-warn nil
"*If true, the byte-compiler reports warnings with `error'.")
-(defconst byte-compile-warning-types '(redefine callargs free-vars unresolved))
+(defconst byte-compile-warning-types
+ '(redefine callargs free-vars unresolved obsolete))
(defvar byte-compile-warnings t
"*List of warnings that the byte-compiler should issue (t for all).
Elements of the list may be be:
@@ -287,6 +289,7 @@ Elements of the list may be be:
callargs lambda calls with args that don't match the definition.
redefine function cell redefined from a macro to a lambda or vice
versa, or redefined to take a different number of arguments.
+ obsolete obsolete variables and functions.
See also the macro `byte-compiler-options'.")
@@ -788,12 +791,13 @@ otherwise pop it")
;;; Used by make-obsolete.
(defun byte-compile-obsolete (form)
- (let ((new (get (car form) 'byte-obsolete-info)))
- (byte-compile-warn "%s is an obsolete function; %s" (car form)
- (if (stringp (car new))
- (car new)
- (format "use %s instead." (car new))))
- (funcall (or (cdr new) 'byte-compile-normal-call) form)))
+ (if (memq 'obsolete byte-compile-warnings)
+ (let ((new (get (car form) 'byte-obsolete-info)))
+ (byte-compile-warn "%s is an obsolete function; %s" (car form)
+ (if (stringp (car new))
+ (car new)
+ (format "use %s instead." (car new))))
+ (funcall (or (cdr new) 'byte-compile-normal-call) form))))
;; Compiler options
@@ -2057,7 +2061,8 @@ If FORM is a lambda or a macro, byte-compile it as a function."
"Variable reference to %s %s")
(if (symbolp var) "constant" "nonvariable")
(prin1-to-string var))
- (if (get var 'byte-obsolete-variable)
+ (if (and (get var 'byte-obsolete-variable)
+ (memq 'obsolete byte-compile-warnings))
(let ((ob (get var 'byte-obsolete-variable)))
(byte-compile-warn "%s is an obsolete variable; %s" var
(if (stringp ob)