(byte-optimize-form (nth 1 form) for-effect)))
+ (cons 'prog1
(cons (byte-optimize-form (nth 1 form) for-effect)
(byte-optimize-body (cdr (cdr form)) t)))
(byte-optimize-form `(or ,(nth 1 form) nil) for-effect)))
(setq tmp (byte-optimize-side-effect-free-p form))
+ ;; XEmacs; GNU handles the expansion of (pop foo) specially
+ ;; here. We changed the macro to expand to (prog1 (car-safe
+ ;; PLACE) (setq PLACE (cdr PLACE))) , which has the same
+ ;; effect. (This only matters when
+ ;; byte-compile-delete-errors is nil, which is usually true
+ ;; for GNU and usually false for XEmacs.)
(byte-compile-warn "%s called for effect"
(defun byte-optimize-or (form)
;; Throw away unneeded nils, and simplify if less than 2 args.
;; XEmacs; change to be more careful about discarding multiple values.
- (let* ((memqueued (memq nil form))
- (trailing-nil (and (cdr memqueued)
- (equal '(nil) (last form))))
- ;; A trailing nil indicates to discard multiple values, and we need to
- (when (and memqueued (cdr memqueued))
- (setq form (delq nil (copy-sequence form)))
- (setcdr (last form) '(nil))))
- ;; If there is a literal non-nil constant in the args to `or', throw
- ;; away all following forms. We can do this because a literal non-nil
- ;; constant cannot be multiple.
+ (setq form (remove* nil form
+ ;; A trailing nil indicates to discard multiple
+ ;; values, and we need to respect that. No need if
+ ;; this is for-effect, though, multiple values
+ ;; will be discarded anyway.
+ :end (if (not for-effect) (1- (length form))))))
+ ;; If there is a literal non-nil constant in the args to `or', throw
+ ;; away all following forms. We can do this because a literal non-nil
+ ;; constant cannot be multiple.
(while (cdr (setq rest (cdr rest)))
(if (byte-compile-trueconstp (car rest))
(setq form (copy-sequence form)