help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Compilation warnings of ELisp seem wrong and misleading


From: tomas
Subject: Re: Compilation warnings of ELisp seem wrong and misleading
Date: Mon, 30 Mar 2015 18:59:36 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Mar 30, 2015 at 03:40:21PM +0000, Ludwig, Mark wrote:
> "Pascal J. Bourguignon" wrote:
> 
> > "Ludwig, Mark" <address@hidden> writes:
> > 
> > > Greetings,
> > >
> > > I've been using an ancient Emacs (19.29) on Solaris and finally
> > > got around to installing a current one (24.4).
> > >
> > > I find my custom Elisp generates warnings that seem pretty stupid.
> > > For example:
> > >
> > > emacs.el:255:10:Warning: reference to free variable `if'

Bizarre.

> For context, the "let*" is on line 239; the warning
> (mentioned above as being on line 255 column 10) is
> referring to the form after the comment "Make the
> substitution."  If you read the warnings carefully, you'll
> note that it warns about two different things on line 261,
> column 17.  That line is the one with the comment, 'Now it's
> "strlcpy" or whatever.'  Clearly, the byte-compiler is
> pretty confused....

At first blush, to me the following looks fishy:

>       (let* ((c1 (string-to-char to1))
>            (c2 (string-to-char to2))
>            (ans 0))

[...]

>                                (cond ((= ans ?d)
>                                       ;; Skip over: "if" "(DSOK)" "dstat" "= 
> ..." "()"
>                                       (forward-sexp 5)
>                                       )
> 
>                                      ((= ans ?e)
>                                       ;; Skip over:
>                                       ;; "if" "(dstat = ...)" "goto" "EXIT"
>                                       (forward-sexp 4)
>                                       )
> 
>                                      (if (not (looking-at ";"))
>                                          (error "First expected ';' not: 
> \"%s\"" (buffer-substring (point)

Here: you're in the middle of a `cond' and the clause reads "(if ...)". I'd
expect `cond' to try to interpret "if" as a naked variable (granted, the error
message points at another place).

>                                                                               
>                      (progn (end-of-line 1)
>                                                                               
>                             (point)))))
>                                      (save-excursion
>                                        (goto-char if-pos) ; Go back to where 
> we inserted "if"
>                                        (insert "{

...likewise the `save-excursion' here.

And so on.

HTH
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlUZgPcACgkQBcgs9XrR2kYznQCfa2FWYAipjWHgTbfS0lR4BV2L
TKAAniQtR5ddvmg1extvIKl5ZnkOeF1C
=KuKr
-----END PGP SIGNATURE-----



reply via email to

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