diff lisp/emacs-lisp/bytecomp.el @ 90203:187d6a1f84f7

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-71 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 485-492) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 92-94) - Merge from emacs--cvs-trunk--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Fri, 22 Jul 2005 08:27:27 +0000
parents fbb2bea03df9 9fcfa0b883d4
children edf295560b5a
line wrap: on
line diff
--- a/lisp/emacs-lisp/bytecomp.el	Tue Jul 19 02:58:20 2005 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Fri Jul 22 08:27:27 2005 +0000
@@ -358,7 +358,7 @@
 
 (defvar byte-compile-interactive-only-functions
   '(beginning-of-buffer end-of-buffer replace-string replace-regexp
-			insert-file)
+    insert-file insert-buffer insert-file-literally)
   "List of commands that are not meant to be called from Lisp.")
 
 (defvar byte-compile-not-obsolete-var nil
@@ -3355,12 +3355,12 @@
   "Execute forms in BODY, potentially guarded by CONDITION.
 CONDITION is a variable whose value is a test in an `if' or `cond'.
 BODY is the code to compile  first arm of the if or the body of the
-cond clause.  If CONDITION's value is of the form `(foundp 'foo)'
-or `(boundp 'foo)', the relevant warnings from BODY about foo
+cond clause.  If CONDITION's value is of the form (fboundp 'foo)
+or (boundp 'foo), the relevant warnings from BODY about foo's
 being undefined will be suppressed.
 
-If CONDITION's value is `(featurep 'xemacs)', that suppresses all
-warnings during execution of BODY."
+If CONDITION's value is (not (featurep 'emacs)) or (featurep 'xemacs),
+that suppresses all warnings during execution of BODY."
   (declare (indent 1) (debug t))
   `(let* ((fbound
 	   (if (eq 'fboundp (car-safe ,condition))
@@ -3379,8 +3379,10 @@
 	   (if bound
 	       (cons bound byte-compile-bound-variables)
 	     byte-compile-bound-variables))
+	  ;; Suppress all warnings, for code not used in Emacs.
 	  (byte-compile-warnings
-	   (if (equal ,condition '(featurep 'xemacs))
+	   (if (member ,condition '((featurep 'xemacs)
+				    (not (featurep 'emacs))))
 	       nil byte-compile-warnings)))
      (unwind-protect
 	 (progn ,@body)
@@ -3409,7 +3411,8 @@
 	  (byte-compile-form (nth 2 form) for-effect))
 	(byte-compile-goto 'byte-goto donetag)
 	(byte-compile-out-tag elsetag)
-	(byte-compile-body (cdr (cdr (cdr form))) for-effect)
+	(byte-compile-maybe-guarded (list 'not clause)
+	  (byte-compile-body (cdr (cdr (cdr form))) for-effect))
 	(byte-compile-out-tag donetag))))
   (setq for-effect nil))
 
@@ -3450,24 +3453,38 @@
 	(args (cdr form)))
     (if (null args)
 	(byte-compile-form-do-effect t)
-      (while (cdr args)
-	(byte-compile-form (car args))
+      (byte-compile-and-recursion args failtag))))
+
+;; Handle compilation of a nontrivial `and' call.
+;; We use tail recursion so we can use byte-compile-maybe-guarded.
+(defun byte-compile-and-recursion (rest failtag)
+  (if (cdr rest)
+      (progn
+	(byte-compile-form (car rest))
 	(byte-compile-goto-if nil for-effect failtag)
-	(setq args (cdr args)))
-      (byte-compile-form-do-effect (car args))
-      (byte-compile-out-tag failtag))))
+	(byte-compile-maybe-guarded (car rest)
+	  (byte-compile-and-recursion (cdr rest) failtag)))
+    (byte-compile-form-do-effect (car rest))
+    (byte-compile-out-tag failtag)))
 
 (defun byte-compile-or (form)
   (let ((wintag (byte-compile-make-tag))
 	(args (cdr form)))
     (if (null args)
 	(byte-compile-form-do-effect nil)
-      (while (cdr args)
-	(byte-compile-form (car args))
+      (byte-compile-or-recursion args wintag))))
+
+;; Handle compilation of a nontrivial `or' call.
+;; We use tail recursion so we can use byte-compile-maybe-guarded.
+(defun byte-compile-or-recursion (rest wintag)
+  (if (cdr rest)
+      (progn
+	(byte-compile-form (car rest))
 	(byte-compile-goto-if t for-effect wintag)
-	(setq args (cdr args)))
-      (byte-compile-form-do-effect (car args))
-      (byte-compile-out-tag wintag))))
+	(byte-compile-maybe-guarded (list 'not (car rest))
+	  (byte-compile-or-recursion (cdr rest) wintag)))
+    (byte-compile-form-do-effect (car rest))
+    (byte-compile-out-tag wintag)))
 
 (defun byte-compile-while (form)
   (let ((endtag (byte-compile-make-tag))