From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Dave Love Newsgroups: gmane.emacs.devel Subject: Re: cc-vars.el Date: 19 Nov 2002 16:59:18 +0000 Sender: emacs-devel-admin@gnu.org Message-ID: References: <200211180057.JAA24537@etlken.m17n.org> <5bbs4m8qz9.fsf@lister.roxen.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1037725349 24815 80.91.224.249 (19 Nov 2002 17:02:29 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 19 Nov 2002 17:02:29 +0000 (UTC) Cc: Martin Stjernholm , Kenichi Handa , rms@gnu.org, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18EBkz-0006PM-00 for ; Tue, 19 Nov 2002 18:01:49 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18EBnm-0002ih-00 for ; Tue, 19 Nov 2002 18:04:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18EBjf-0002bv-00; Tue, 19 Nov 2002 12:00:27 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18EBij-0001sH-00 for emacs-devel@gnu.org; Tue, 19 Nov 2002 11:59:29 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18EBif-0001rs-00 for emacs-devel@gnu.org; Tue, 19 Nov 2002 11:59:28 -0500 Original-Received: from albion.dl.ac.uk ([148.79.80.39]) by monty-python.gnu.org with esmtp (Exim 4.10) id 18EBiZ-0001p4-00; Tue, 19 Nov 2002 11:59:19 -0500 Original-Received: from fx by albion.dl.ac.uk with local (Exim 3.35 #1 (Debian)) id 18EBiY-0008G7-00; Tue, 19 Nov 2002 16:59:18 +0000 Original-To: Miles Bader Original-Lines: 83 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:9549 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:9549 Miles Bader writes: > _That_ sort of change is pretty easy, and has the advantage of working > even with old compilers that don't special case it (they'll just emit a > warning like before, but the generated code will be the same). Exactly. This was it. I think it was the only diff needed, but I'm not sure it didn't depend on another change. As far as I remember, someone didn't like it because it wasn't general, i.e. it doesn't work with all conditionals. I don't think that matters if it's documented. *** bytecomp.el 23 Jul 2001 16:02:49 -0000 2.84 --- bytecomp.el 19 Nov 2002 11:29:15 -0000 *************** If FORM is a lambda or a macro, byte-com *** 3213,3231 **** (defun byte-compile-if (form) (byte-compile-form (car (cdr form))) ! (if (null (nthcdr 3 form)) ! ;; No else-forms ! (let ((donetag (byte-compile-make-tag))) ! (byte-compile-goto-if nil for-effect donetag) ! (byte-compile-form (nth 2 form) for-effect) ! (byte-compile-out-tag donetag)) ! (let ((donetag (byte-compile-make-tag)) (elsetag (byte-compile-make-tag))) ! (byte-compile-goto 'byte-goto-if-nil elsetag) ! (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-out-tag donetag))) (setq for-effect nil)) (defun byte-compile-cond (clauses) --- 3213,3258 ---- (defun byte-compile-if (form) (byte-compile-form (car (cdr form))) ! ;; Check whether we have `(if (fboundp ...' or `(if (boundp ...' ! (let* ((clause (nth 1 form)) ! (fbound (if (eq 'fboundp (car-safe clause)) ! (and (eq 'quote (car-safe (nth 1 clause))) ! (nth 1 (nth 1 clause))))) ; the relevant symbol ! (bound (if (eq 'boundp (car-safe clause)) ! (and (eq 'quote (car-safe (nth 1 clause))) ! (nth 1 (nth 1 clause)))))) ; the relevant symbol ! (if (null (nthcdr 3 form)) ! ;; No else-forms ! (let ((donetag (byte-compile-make-tag))) ! (byte-compile-goto-if nil for-effect donetag) ! (cond (bound (let ((byte-compile-bound-variables ! (cons bound ! byte-compile-bound-variables))) ! (byte-compile-form (nth 2 form) for-effect))) ! (fbound (byte-compile-form (nth 2 form) for-effect) ! (setq byte-compile-unresolved-functions ! (delq (assq fbound ! byte-compile-unresolved-functions) ! byte-compile-unresolved-functions))) ! (t (byte-compile-form (nth 2 form) for-effect))) ! (byte-compile-out-tag donetag)) ! (let ((donetag (byte-compile-make-tag)) ! (elsetag (byte-compile-make-tag))) ! (byte-compile-goto 'byte-goto-if-nil elsetag) ! (cond (bound (let ((byte-compile-bound-variables ! (cons bound ! byte-compile-bound-variables))) ! (byte-compile-form (nth 2 form) for-effect))) ! (fbound (byte-compile-form (nth 2 form) for-effect) ! (setq byte-compile-unresolved-functions ! (delq (assq fbound ! byte-compile-unresolved-functions) ! byte-compile-unresolved-functions))) ! (t (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-out-tag donetag)))) (setq for-effect nil)) (defun byte-compile-cond (clauses)