Subject: bug#15862: Status: aliases to macros at compile time

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 07 Oct 2019 17:50:26 +0200

This bug report also comes out blank in the mbox interface, but is
displayed on the web.

[...]

-----

(defvar foo-var 0)

(defmacro foo-mac ()
  '(setq foo-var (1+ foo-var)))

(define-obsolete-function-alias 'old-mac #'foo-mac "24.4")

(defun foo-fails ()
  (old-mac))

(defun foo-works ()
  (foo-mac))

Compile:
foo.el:13:4:Warning: the function `foo-mac' is not known to be defined.

Load compiled version:
(foo-fails) ; -> (invalid-function old-mac)

Also, neither version warns that old-mac is obsolete.

I see now that

(eval-and-compile
  (define-obsolete-function-alias 'old-mac #'foo-mac "24.4"))

works. So maybe that should happen automatically at top-level.

[...]

Fixed the obsolescence warning in 5e6fb1e (auto eval-and-compile make-obsolete.
The invalid function issue remains (still need to manaully eval
top-level aliases to macros at compile-time).

-----

Then I compile it in Emacs 27, I get:

Compiling file /tmp/c.el at Mon Oct  7 17:45:55 2019

In foo-fails:
c.el:9:4:Warning: ‘old-mac’ is an obsolete function (as of 24.4); use
    ‘foo-mac’ instead.

Which seems correct.

If I then

(load "/tmp/c.elc")

I don't get anything about invalid functions.  So has this been fixed,
or am I misinterpreting what the invalid function issue is?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no