summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2005-07-08 22:49:47 +0000
committerRichard M. Stallman <rms@gnu.org>2005-07-08 22:49:47 +0000
commit82a726b4eea413c3cb05f4657eaea92818461282 (patch)
treee20d73d9b1970477106013863c538a9736b6c5c5 /lisp/emacs-lisp/bytecomp.el
parent185d43ee89e50224fb73b317ee739ac58e6fd6f8 (diff)
downloademacs-82a726b4eea413c3cb05f4657eaea92818461282.tar.gz
(byte-compile-maybe-guarded): Check for (featurep 'xemacs) and turn
off warnings in what it guards. Use unwind-protect to ensure byte-compile-unresolved-functions is updated.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el41
1 files changed, 24 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index bbb98364a0d..36ce227df91 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -3351,11 +3351,14 @@ That command is designed for interactive use only" fn))
(defmacro byte-compile-maybe-guarded (condition &rest body)
"Execute forms in BODY, potentially guarded by CONDITION.
-CONDITION is the test in an `if' form or in a `cond' clause.
-BODY is to compile the first arm of the if or the body of the
-cond clause. If CONDITION is of the form `(foundp 'foo)'
+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
-being undefined will be suppressed."
+being undefined will be suppressed.
+
+If CONDITION's value is `(featurep 'xemacs)', that suppresses all
+warnings during execution of BODY."
(declare (indent 1) (debug t))
`(let* ((fbound
(if (eq 'fboundp (car-safe ,condition))
@@ -3373,13 +3376,17 @@ being undefined will be suppressed."
(byte-compile-bound-variables
(if bound
(cons bound byte-compile-bound-variables)
- byte-compile-bound-variables)))
- (progn ,@body)
- ;; Maybe remove the function symbol from the unresolved list.
- (if fbound
- (setq byte-compile-unresolved-functions
- (delq (assq fbound byte-compile-unresolved-functions)
- byte-compile-unresolved-functions)))))
+ byte-compile-bound-variables))
+ (byte-compile-warnings
+ (if (equal ,condition '(featurep 'xemacs))
+ nil byte-compile-warnings)))
+ (unwind-protect
+ (progn ,@body)
+ ;; Maybe remove the function symbol from the unresolved list.
+ (if fbound
+ (setq byte-compile-unresolved-functions
+ (delq (assq fbound byte-compile-unresolved-functions)
+ byte-compile-unresolved-functions))))))
(defun byte-compile-if (form)
(byte-compile-form (car (cdr form)))
@@ -3420,12 +3427,12 @@ being undefined will be suppressed."
(if (null (cdr clause))
;; First clause is a singleton.
(byte-compile-goto-if t for-effect donetag)
- (setq nexttag (byte-compile-make-tag))
- (byte-compile-goto 'byte-goto-if-nil nexttag)
- (byte-compile-maybe-guarded (car clause)
- (byte-compile-body (cdr clause) for-effect))
- (byte-compile-goto 'byte-goto donetag)
- (byte-compile-out-tag nexttag)))))
+ (setq nexttag (byte-compile-make-tag))
+ (byte-compile-goto 'byte-goto-if-nil nexttag)
+ (byte-compile-maybe-guarded (car clause)
+ (byte-compile-body (cdr clause) for-effect))
+ (byte-compile-goto 'byte-goto donetag)
+ (byte-compile-out-tag nexttag)))))
;; Last clause
(let ((guard (car clause)))
(and (cdr clause) (not (eq guard t))