From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.devel Subject: Re: Bogus byte-compiler warnings Date: Sat, 01 Dec 2007 12:29:27 +0100 Message-ID: References: <87zmar47tm.fsf@cyd.mit.edu> <87mz6nfos7.fsf@furball.mit.edu> Reply-To: Reiner Steib NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1196508648 24462 80.91.229.12 (1 Dec 2007 11:30:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Dec 2007 11:30:48 +0000 (UTC) Cc: Richard Stallman , emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 01 12:30:55 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IyQYg-0002Jl-IW for ged-emacs-devel@m.gmane.org; Sat, 01 Dec 2007 12:30:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IyQYQ-0008Jo-6u for ged-emacs-devel@m.gmane.org; Sat, 01 Dec 2007 06:30:38 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IyQYM-0008Jb-8T for emacs-devel@gnu.org; Sat, 01 Dec 2007 06:30:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IyQYL-0008JO-Vb for emacs-devel@gnu.org; Sat, 01 Dec 2007 06:30:33 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IyQYL-0008Io-A6 for emacs-devel@gnu.org; Sat, 01 Dec 2007 06:30:33 -0500 Original-Received: from mail.uni-ulm.de ([134.60.1.11]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IyQYB-0005WS-3H; Sat, 01 Dec 2007 06:30:24 -0500 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.41.37]) by mail.uni-ulm.de (8.14.1/8.14.1) with ESMTP id lB1BUCMr027713; Sat, 1 Dec 2007 12:30:12 +0100 (MET) Original-Received: from localhost (bridgekeeper.physik.uni-ulm.de [134.60.41.37]) by bridgekeeper.physik.uni-ulm.de (Postfix) with ESMTP id 5A5391C4A4; Sat, 1 Dec 2007 12:30:12 +0100 (CET) X-Face: /U7=m^"/-Dn61mAl{g9e3>\G5Tp,oEX|V)g2I1hBk\ML; )7A?6cmB-y7y?'NA^J<=oz7syB =(McAwIHgLX!.B?R3X}98d@?>CrT094KLWh]WU4gDpnL/")MS(XoQTv`Oq225uL>+; CpPXo$N5e>N> $tPd-gbB^F{gQS#1ase]XO~D4p4M"3+F-7~u]dy3I?Pb8RO*H-EFeWDUf?Rf, d]pv\Jvh2Cht!A=im yKAS2Z%Ao^;}W/qzMvMm Mail-Followup-To: Chong Yidong , Richard Stallman , emacs-devel@gnu.org In-Reply-To: <87mz6nfos7.fsf@furball.mit.edu> (Chong Yidong's message of "Sun, 19 Nov 2006 10:18:32 -0500") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) X-DCC-CTc-dcc2-Metrics: poseidon 1031; Body=3 Fuz1=3 Fuz2=3 X-Virus-Scanned: by amavisd-new X-MIME-Autoconverted: from 8bit to quoted-printable by mail.uni-ulm.de id lB1BUCMr027713 X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:84417 Archived-At: On Sun, Nov 19 2006, Chong Yidong wrote: =A0 ^^^^^^^^^^^ [ See for the complete thread. ] > Richard Stallman writes: > >> > The reason there is a warning for foo-1 is that the code in the >> > compiler to avoid such warnings recognizes only the simpler case= (such >> > as foo-2) and not the more complex case that foo-1 is. >> > >> > I would not mind if that code were made smarter. >> >> How bout this patch? >> >> I think it would be better to save this for after the release. >> Changes in this code are somewhat risky, and even if you have >> been rather careful, you could easily break something. > > I had already checked it into CVS (since you put it in FOR-RELEASE, I > assumed you wanted it fixed). But I agree that now is not the time > for such changes, so I've reverted the change. The patch below has been reverted because Richard didn't want to install it before the release of Emacs 22.1. Maybe it should be installed now in the trunk? --8<---------------cut here---------------start------------->8--- --- bytecomp.el 7 Jul 2006 16:34:44 -0000 2.186 +++ bytecomp.el 18 Nov 2006 21:07:17 -0000 2.187 @@ -3398,35 +3398,42 @@ 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)) - (and (eq 'quote (car-safe (nth 1 ,condition))) - ;; Ignore if the symbol is already on the - ;; unresolved list. - (not (assq (nth 1 (nth 1 ,condition)) ; the relevant symbol - byte-compile-unresolved-functions)) - (nth 1 (nth 1 ,condition))))) - (bound (if (or (eq 'boundp (car-safe ,condition)) - (eq 'default-boundp (car-safe ,condition))) - (and (eq 'quote (car-safe (nth 1 ,condition))) - (nth 1 (nth 1 ,condition))))) - ;; Maybe add to the bound list. - (byte-compile-bound-variables - (if bound - (cons bound byte-compile-bound-variables) - byte-compile-bound-variables)) - ;; Suppress all warnings, for code not used in Emacs. - (byte-compile-warnings + `(let* ((byte-compile-warnings + ;; Suppress all warnings, for code not used in Emacs. (if (member ,condition '((featurep 'xemacs) (not (featurep 'emacs)))) - nil byte-compile-warnings))) + nil + byte-compile-warnings)) + (byte-compile-bound-variables byte-compile-bound-variables) + binding fbound-list) + (mapc (lambda (subcondition) + (cond ((eq 'fboundp (car-safe subcondition)) + (setq binding (and (eq 'quote (car-safe (nth 1 subcondition))) + ;; Ignore if the symbol is already on the + ;; unresolved list. + (not (assq (nth 1 (nth 1 subcondition)) + byte-compile-unresolved-functions)) + (nth 1 (nth 1 subcondition)))) + (if binding (setq fbound-list (cons binding fbound-list)))) + ((or (eq 'boundp (car-safe subcondition)) + (eq 'default-boundp (car-safe subcondition))) + (setq binding (and (eq 'quote (car-safe (nth 1 subcondition))) + (nth 1 (nth 1 subcondition)))) + (if binding (setq byte-compile-bound-variables + (cons binding byte-compile-bound-variables)))))) + ;; Inspect each element in an `and' condition; otherwise, + ;; inspect the condition itself. + (if (eq 'and (car-safe ,condition)) + (cdr ,condition) + (list ,condition))) (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)))))) + (mapc (lambda (fun) + (setq byte-compile-unresolved-functions + (delq (assq fun byte-compile-unresolved-functions) + byte-compile-unresolved-functions))) + fbound-list)))) =20 (defun byte-compile-if (form) (byte-compile-form (car (cdr form))) --8<---------------cut here---------------end--------------->8--- Davis Herring commented: > Chong Yidong stupidchicken.com> writes: >> ! (if (eq 'and (car-safe ,condition)) >> ! (cdr-safe ,condition) > Tiny point: you can just use `cdr' here, since `car-safe' returned non-= nil. Bye, Reiner. --=20 ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/