emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Bogus byte-compiler warnings


From: Drew Adams
Subject: RE: Bogus byte-compiler warnings
Date: Sun, 12 Nov 2006 16:57:34 -0800

> > when byte-compiling the following file
> >
> > (defun foo-func-1 ()
> >   (when (and (boundp 'foo-var)
> >          (fboundp 'foo-1))
> >     (foo-1)))
> >
> > | In end of data:
> > | rs-byte-compile-warnings.el:11:1:Warning: the function `foo-1' is
> > | not known to be defined.
>
> Bytecomp has a documented hack for use in such cases:
>   (defun foo-func-1 ()
>     (when (fboundp 'foo-1)
>       (when (boundp 'foo-var)
>         (foo-1))))
>
> The structure being looked for is "(if (fboundp 'X) BODY)" which
> suppresses the warning for X within BODY.  In your example, the
> presence of 'and' prevents the hack from matching the code.

Good to know, but what a shame that people would write less clear code just
to inhibit such spurious warnings.

I won't, though it means I now need to field emails from users wondering
about such messages in code I write (or else fill the code with comments
explaining which messages can be ignored in which Emacs versions).

I'm not suggesting things were better before the new crop of warning
messages, but those messages can be bothersome. The byte compiler is smarter
than before, but not yet smart enough to know when it's acting too smart.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]