GNU bug report logs -
#20457
compiler does not warn about arglist mismatch with obsolete alias
Previous Next
To reply to this bug, email your comments to 20457 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20457
; Package
emacs
.
(Wed, 29 Apr 2015 07:09:02 GMT)
Full text and
rfc822 format available.
Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):
Package: emacs
Version: 24.5
Byte-compiling the following:
(defun newfunc ()
t)
(eval-and-compile
(define-obsolete-function-alias 'oldfunc 'newfunc "25.1"))
(defun blah ()
(oldfunc t))
warns about oldfunc being obsolete:
In blah:
foo.el:6:8:Warning: `oldfunc' is an obsolete function (as of 25.1); use
`newfunc' instead.
however, it says nothing about blah calling oldfunc with the wrong
number of arguments, which leads to a runtime error.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20457
; Package
emacs
.
(Fri, 08 Apr 2016 04:57:01 GMT)
Full text and
rfc822 format available.
Message #6 received at 20457 <at> debbugs.gnu.org (full text, mbox):
On 2015-04-29, at 03:08, Glenn Morris <rgm <at> gnu.org> wrote:
> Package: emacs
> Version: 24.5
>
> Byte-compiling the following:
>
> (defun newfunc ()
> t)
>
> (eval-and-compile
> (define-obsolete-function-alias 'oldfunc 'newfunc "25.1"))
>
> (defun blah ()
> (oldfunc t))
>
> warns about oldfunc being obsolete:
>
> In blah:
> foo.el:6:8:Warning: `oldfunc' is an obsolete function (as of 25.1); use
> `newfunc' instead.
>
> however, it says nothing about blah calling oldfunc with the wrong
> number of arguments, which leads to a runtime error.
Confirmed on GNU Emacs 25.1.50.8 (1e8cd05).
Best,
--
Marcin
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20457
; Package
emacs
.
(Fri, 28 May 2021 00:31:02 GMT)
Full text and
rfc822 format available.
Message #9 received at 20457 <at> debbugs.gnu.org (full text, mbox):
Glenn Morris <rgm <at> gnu.org> writes:
> warns about oldfunc being obsolete:
>
> In blah:
> foo.el:6:8:Warning: `oldfunc' is an obsolete function (as of 25.1); use
> `newfunc' instead.
>
> however, it says nothing about blah calling oldfunc with the wrong
> number of arguments, which leads to a runtime error.
The problem seems to be more general than that -- it doesn't warn about
the wrong number of arguments, ever, if using aliases?
Test case:
(defun foo ())
(defalias 'bar 'foo)
(defun zot ()
(bar t))
(defun foobar ()
(foo t))
----
Compiling file /tmp/warn.el at Fri May 28 02:26:55 2021
In foobar:
warn.el:6:4: Warning: foo called with 1 argument, but accepts only 0
----
Note -- no warning from the zot function.
It seems so odd that nobody has pointed this out before, so I'm
wondering if I'm just doing something obviously wrong in this test
case. Anybody?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20457
; Package
emacs
.
(Fri, 28 May 2021 06:27:01 GMT)
Full text and
rfc822 format available.
Message #12 received at 20457 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Fri, 28 May 2021 02:30:38 +0200
> Cc: 20457 <at> debbugs.gnu.org
>
> Glenn Morris <rgm <at> gnu.org> writes:
>
> > warns about oldfunc being obsolete:
> >
> > In blah:
> > foo.el:6:8:Warning: `oldfunc' is an obsolete function (as of 25.1); use
> > `newfunc' instead.
> >
> > however, it says nothing about blah calling oldfunc with the wrong
> > number of arguments, which leads to a runtime error.
>
> The problem seems to be more general than that -- it doesn't warn about
> the wrong number of arguments, ever, if using aliases?
>
> Test case:
>
> (defun foo ())
> (defalias 'bar 'foo)
> (defun zot ()
> (bar t))
> (defun foobar ()
> (foo t))
>
>
> ----
> Compiling file /tmp/warn.el at Fri May 28 02:26:55 2021
>
> In foobar:
> warn.el:6:4: Warning: foo called with 1 argument, but accepts only 0
> ----
>
> Note -- no warning from the zot function.
>
> It seems so odd that nobody has pointed this out before, so I'm
> wondering if I'm just doing something obviously wrong in this test
> case. Anybody?
Stefan?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20457
; Package
emacs
.
(Sat, 05 Jun 2021 15:55:01 GMT)
Full text and
rfc822 format available.
Message #15 received at 20457 <at> debbugs.gnu.org (full text, mbox):
>> The problem seems to be more general than that -- it doesn't warn about
>> the wrong number of arguments, ever, if using aliases?
>>
>> Test case:
>>
>> (defun foo ())
>> (defalias 'bar 'foo)
>> (defun zot ()
>> (bar t))
>> (defun foobar ()
>> (foo t))
>>
>>
>> ----
>> Compiling file /tmp/warn.el at Fri May 28 02:26:55 2021
>>
>> In foobar:
>> warn.el:6:4: Warning: foo called with 1 argument, but accepts only 0
>> ----
>>
>> Note -- no warning from the zot function.
>>
>> It seems so odd that nobody has pointed this out before, so I'm
>> wondering if I'm just doing something obviously wrong in this test
>> case. Anybody?
>
> Stefan?
The byte-compiler's tracking of functions arity is quite limited, yes.
Patches to improve it are welcome.
Stefan
This bug report was last modified 4 years and 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.