From: Reiner Steib <reinersteib+gmane@imap.cc>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: Richard Stallman <rms@gnu.org>, emacs-devel@gnu.org
Subject: Re: Bogus byte-compiler warnings
Date: Sat, 01 Dec 2007 12:29:27 +0100 [thread overview]
Message-ID: <v9ir3ibqlk.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <87mz6nfos7.fsf@furball.mit.edu> (Chong Yidong's message of "Sun, 19 Nov 2006 10:18:32 -0500")
On Sun, Nov 19 2006, Chong Yidong wrote:
^^^^^^^^^^^
[ See <http://thread.gmane.org/gmane.emacs.devel/62115> for the
complete thread. ]
> Richard Stallman <rms@gnu.org> 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))))
(defun byte-compile-if (form)
(byte-compile-form (car (cdr form)))
--8<---------------cut here---------------end--------------->8---
Davis Herring commented:
> Chong Yidong <cyd <at> 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.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
next prev parent reply other threads:[~2007-12-01 11:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-12 13:27 Bogus byte-compiler warnings Reiner Steib
2006-11-13 9:44 ` Richard Stallman
2006-11-13 11:27 ` Reiner Steib
2006-11-16 17:31 ` Chong Yidong
2006-11-16 18:51 ` Davis Herring
2006-11-19 7:59 ` Richard Stallman
2006-11-19 15:18 ` Chong Yidong
2007-12-01 11:29 ` Reiner Steib [this message]
2007-12-01 16:47 ` Dan Nicolaescu
2007-12-01 17:33 ` Reiner Steib
[not found] <E1GjIng-0005ML-HG@monty-python.gnu.org>
2006-11-12 21:47 ` Jonathan Yavner
2006-11-13 0:57 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=v9ir3ibqlk.fsf@marauder.physik.uni-ulm.de \
--to=reinersteib+gmane@imap.cc \
--cc=Reiner.Steib@gmx.de \
--cc=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
--cc=rms@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).