GNU bug report logs - #12299
24.1; no byte compiler warning for inline function call with too few arguments

Previous Next

Package: emacs;

Reported by: "Roland Winkler" <winkler <at> gnu.org>

Date: Wed, 29 Aug 2012 02:16:02 UTC

Severity: normal

Tags: confirmed

Found in version 24.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mattias Engdegård <mattiase <at> acm.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12299 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>, Roland Winkler <winkler <at> gnu.org>
Subject: bug#12299: 24.1; no byte compiler warning for inline function call with too few arguments [PATCH]
Date: Fri, 23 Jul 2021 17:52:41 +0200
23 juli 2021 kl. 17.02 skrev Stefan Monnier <monnier <at> iro.umontreal.ca>:

> Hmm... wouldn't we want the warning to be emitted if the source code was itself
> of the form constructed by `(,fn ,@(cdr form))?

You mean when FN is a bytecode object? Sure, we can do that too. (We currently report an error when there are too many arguments but not too few.) However, it doesn't replace the newly inserted checks, because:

> IOW I think we want that `byte-compile--check-arity-bytecode` call to be
> elsewhere (in the code that actually compiles the code constructed by
> `(,fn ,@(cdr form))).

Tried that first, but then we no longer have the function name so the user sees

 Warning: ‹bytecode gibberish› called with 1 argument but requires 2

> Also, as a general rule I think we should try and refrain from emitting
> warnings from the code in byte-opt.el (warnings should be independent
> from optimizations).

Agree in general but for non-inlined calls we do the arity checks in the codegen, after optimising, and that's too late for inlined calls. We could do it in cconv, but then (a) we may not know the signature or (b) the call could be in dead code.

But this is good to have in mind -- we have a growing list of things to deal with in a compiler reorganisation. There is a lot of history in this code.





This bug report was last modified 3 years and 221 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.