Subject: Re: bug#73881: 31.0.50; Unexpected warnings about recursive occurrences of obsolete functions

From: Eshel Yaron <[email-masked]>
Date: Tue, 29 Oct 2024 08:21:00 +0100

Stefan Kangas <[email-masked]> writes:

> Stefan Monnier <[email-masked]> writes:
>
>> I propose the patch below (which also fixes a leak of
>> `byte-compile-global-not-obsolete-vars` to code compiled from other
>> files).
>> But I don't think it fixes the OP's problem because
>>
>>     (macroexpand '(defun my-foo () (declare (obsolete "blabla" "25")) 42))
>> =>
>>     (prog1 (defalias 'my-foo #'(lambda nil ...))
>>       (make-obsolete 'my-foo '"blabla" "25"))
>>
>> IOW, the `make-obsolete` comes *after* the function and thus my new code
>> will only silence warnings for calls to `my-foo` that are present
>> *after* the function definition.
>
> It looks like a step in the right direction to me.

To me as well.  Would there any harm in emitting the make-obsolete form
above the defalias form to cover also the warnings for recursive calls?

Best,

Eshel