Subject: Re: bug#46302: 28.0.50; cperl-mode cleanup: Eliminate dead code

From: [email-masked] (Harald Jörg)
Date: Fri, 05 Feb 2021 11:54:37 +0100

Lars Ingebrigtsen <[email-masked]> writes:

>> Isn't `make-obsolete-variable` supposed to generate a compiler warning?
>
> It is supposed to, but somehow it didn't... [...]
>
> Hm...  perhaps it's because of this?
>
> -  (if cperl-use-syntax-table-text-property
> -      (if (eval-when-compile (fboundp 'syntax-propertize-rules))
> -          (progn
>
> And the compiler got confused and didn't output a warning (always)?

Ah, that reminds me of something... I did the elimination in several
steps, and in one of them killed the conditional and the if-branch, but
forget to kill the else-branch as well.  Apparently I ran the first
compilation test with that (bogus) intermediate version, and got the
warning.

As it turns out, the byte compiler shortcuts the conditional if it
eval-when-compiles to a constant and doesn't even touch the else-branch.
Digging into the commit logs reveals:

  commit 4813c453b22ff7b965e31a30d35b70f73d6bcbc7
  Author: Stefan Monnier <[email-masked]>
  Date:   Sun Feb 3 10:47:12 2013 -0500

      * lisp/progmodes/cperl-mode.el (cperl-mode): Avoid byte-compile
        warning.

Now it all makes sense :)
-- 
Cheers,
haj