changeset 10256:83d56dd99a40

(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.
author Richard M. Stallman <rms@gnu.org>
date Mon, 26 Dec 1994 01:28:59 +0000
parents d4119f1137f9
children d530ba7eb471
files lisp/emacs-lisp/bytecomp.el
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/bytecomp.el	Mon Dec 26 01:24:38 1994 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Mon Dec 26 01:28:59 1994 +0000
@@ -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 @@
 (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 @@
   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 @@
 
 ;;; 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 @@
 			   "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)