unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20457: compiler does not warn about arglist mismatch with obsolete alias
@ 2015-04-29  7:08 Glenn Morris
  2016-04-08  4:56 ` Marcin Borkowski
  2021-05-28  0:30 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Glenn Morris @ 2015-04-29  7:08 UTC (permalink / raw)
  To: 20457

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#20457: compiler does not warn about arglist mismatch with obsolete alias
  2015-04-29  7:08 bug#20457: compiler does not warn about arglist mismatch with obsolete alias Glenn Morris
@ 2016-04-08  4:56 ` Marcin Borkowski
  2021-05-28  0:30 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Marcin Borkowski @ 2016-04-08  4:56 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 20457

On 2015-04-29, at 03:08, Glenn Morris <rgm@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#20457: compiler does not warn about arglist mismatch with obsolete alias
  2015-04-29  7:08 bug#20457: compiler does not warn about arglist mismatch with obsolete alias Glenn Morris
  2016-04-08  4:56 ` Marcin Borkowski
@ 2021-05-28  0:30 ` Lars Ingebrigtsen
  2021-05-28  6:26   ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-28  0:30 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 20457

Glenn Morris <rgm@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#20457: compiler does not warn about arglist mismatch with obsolete alias
  2021-05-28  0:30 ` Lars Ingebrigtsen
@ 2021-05-28  6:26   ` Eli Zaretskii
  2021-06-05 15:54     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2021-05-28  6:26 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Stefan Monnier; +Cc: rgm, 20457

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Fri, 28 May 2021 02:30:38 +0200
> Cc: 20457@debbugs.gnu.org
> 
> Glenn Morris <rgm@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?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#20457: compiler does not warn about arglist mismatch with obsolete alias
  2021-05-28  6:26   ` Eli Zaretskii
@ 2021-06-05 15:54     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-06-05 15:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rgm, Lars Ingebrigtsen, 20457

>> 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






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-05 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-29  7:08 bug#20457: compiler does not warn about arglist mismatch with obsolete alias Glenn Morris
2016-04-08  4:56 ` Marcin Borkowski
2021-05-28  0:30 ` Lars Ingebrigtsen
2021-05-28  6:26   ` Eli Zaretskii
2021-06-05 15:54     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).