diff options
| author | Dave Love | 2002-12-12 20:27:43 +0000 |
|---|---|---|
| committer | Dave Love | 2002-12-12 20:27:43 +0000 |
| commit | b8234c844c7a191a236a2c618bf0553dcd47f080 (patch) | |
| tree | d87005c5491d78e0755ea2d559cc3e28e0778c52 | |
| parent | 64e9f9d927059d9402bd6225ecafc015437ae223 (diff) | |
| download | emacs-b8234c844c7a191a236a2c618bf0553dcd47f080.tar.gz emacs-b8234c844c7a191a236a2c618bf0553dcd47f080.zip | |
(byte-compile-if): Suppress warnings from
things protected by `(if (fboundp ...' or `(if (boundp ...'.
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 20ff6fed8c1..7f0513c4c46 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | ;;; This version incorporates changes up to version 2.10 of the | 11 | ;;; This version incorporates changes up to version 2.10 of the |
| 12 | ;;; Zawinski-Furuseth compiler. | 12 | ;;; Zawinski-Furuseth compiler. |
| 13 | (defconst byte-compile-version "$Revision: 2.118 $") | 13 | (defconst byte-compile-version "$Revision: 2.119 $") |
| 14 | 14 | ||
| 15 | ;; This file is part of GNU Emacs. | 15 | ;; This file is part of GNU Emacs. |
| 16 | 16 | ||
| @@ -3225,19 +3225,53 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 3225 | 3225 | ||
| 3226 | (defun byte-compile-if (form) | 3226 | (defun byte-compile-if (form) |
| 3227 | (byte-compile-form (car (cdr form))) | 3227 | (byte-compile-form (car (cdr form))) |
| 3228 | (if (null (nthcdr 3 form)) | 3228 | ;; Check whether we have `(if (fboundp ...' or `(if (boundp ...' |
| 3229 | ;; No else-forms | 3229 | ;; and avoid warnings about the relevent symbols in the consequent. |
| 3230 | (let ((donetag (byte-compile-make-tag))) | 3230 | (let* ((clause (nth 1 form)) |
| 3231 | (byte-compile-goto-if nil for-effect donetag) | 3231 | (fbound (if (eq 'fboundp (car-safe clause)) |
| 3232 | (byte-compile-form (nth 2 form) for-effect) | 3232 | (and (eq 'quote (car-safe (nth 1 clause))) |
| 3233 | (byte-compile-out-tag donetag)) | 3233 | ;; Ignore if the symbol is already on the |
| 3234 | (let ((donetag (byte-compile-make-tag)) (elsetag (byte-compile-make-tag))) | 3234 | ;; unresolved list. |
| 3235 | (byte-compile-goto 'byte-goto-if-nil elsetag) | 3235 | (not (assq |
| 3236 | (byte-compile-form (nth 2 form) for-effect) | 3236 | (nth 1 (nth 1 clause)) ; the relevant symbol |
| 3237 | (byte-compile-goto 'byte-goto donetag) | 3237 | byte-compile-unresolved-functions)) |
| 3238 | (byte-compile-out-tag elsetag) | 3238 | (nth 1 (nth 1 clause))))) |
| 3239 | (byte-compile-body (cdr (cdr (cdr form))) for-effect) | 3239 | (bound (if (eq 'boundp (car-safe clause)) |
| 3240 | (byte-compile-out-tag donetag))) | 3240 | (and (eq 'quote (car-safe (nth 1 clause))) |
| 3241 | (nth 1 (nth 1 clause))))) | ||
| 3242 | (donetag (byte-compile-make-tag))) | ||
| 3243 | (if (null (nthcdr 3 form)) | ||
| 3244 | ;; No else-forms | ||
| 3245 | (progn | ||
| 3246 | (byte-compile-goto-if nil for-effect donetag) | ||
| 3247 | ;; Maybe add to the bound list. | ||
| 3248 | (let ((byte-compile-bound-variables | ||
| 3249 | (if bound | ||
| 3250 | (cons bound byte-compile-bound-variables) | ||
| 3251 | byte-compile-bound-variables))) | ||
| 3252 | (byte-compile-form (nth 2 form) for-effect)) | ||
| 3253 | ;; Maybe remove the function symbol from the unresolved list. | ||
| 3254 | (if fbound | ||
| 3255 | (setq byte-compile-unresolved-functions | ||
| 3256 | (delq (assq fbound byte-compile-unresolved-functions) | ||
| 3257 | byte-compile-unresolved-functions))) | ||
| 3258 | (byte-compile-out-tag donetag)) | ||
| 3259 | (let ((elsetag (byte-compile-make-tag))) | ||
| 3260 | (byte-compile-goto 'byte-goto-if-nil elsetag) | ||
| 3261 | ;; As above for the first form. | ||
| 3262 | (let ((byte-compile-bound-variables | ||
| 3263 | (if bound | ||
| 3264 | (cons bound byte-compile-bound-variables) | ||
| 3265 | byte-compile-bound-variables))) | ||
| 3266 | (byte-compile-form (nth 2 form) for-effect)) | ||
| 3267 | (if fbound | ||
| 3268 | (setq byte-compile-unresolved-functions | ||
| 3269 | (delq (assq fbound byte-compile-unresolved-functions) | ||
| 3270 | byte-compile-unresolved-functions))) | ||
| 3271 | (byte-compile-goto 'byte-goto donetag) | ||
| 3272 | (byte-compile-out-tag elsetag) | ||
| 3273 | (byte-compile-body (cdr (cdr (cdr form))) for-effect) | ||
| 3274 | (byte-compile-out-tag donetag)))) | ||
| 3241 | (setq for-effect nil)) | 3275 | (setq for-effect nil)) |
| 3242 | 3276 | ||
| 3243 | (defun byte-compile-cond (clauses) | 3277 | (defun byte-compile-cond (clauses) |