GNU bug report logs - #19634
counting MANY function args more reliably

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Tue, 20 Jan 2015 09:28:01 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#19634: closed (counting MANY function args more reliably)
Date: Sun, 25 Jan 2015 17:17:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 25 Jan 2015 09:15:58 -0800
with message-id <54C524CE.3070009 <at> cs.ucla.edu>
and subject line Re: bug#19634: counting MANY function args more reliably
has caused the debbugs.gnu.org bug report #19634,
regarding counting MANY function args more reliably
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
19634: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19634
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Emacs bug reports and feature requests <bug-gnu-emacs <at> gnu.org>
Subject: counting MANY function args more reliably
Date: Tue, 20 Jan 2015 01:26:25 -0800
[Message part 3 (text/plain, inline)]
Commit ef5a526f1b51b76b0f753e0936c80743a7f4463d fixed a bug in Emacs where the C 
code passed 10 arguments to a function using the MANY calling convention, but 
the caller mistakenly passed 8 as the argument count, and this mistakenly 
discarded the last two arguments; see <http://bugs.gnu.org/3228#63>.

To help prevent this sort of mistake in the future, I would like to install 
something like the attached patch, which uses a new C macro CALLN to count these 
arguments automatically.  The key lines in the patch are the following additions 
to lisp.h:

#define CALLMANY(f, array) (f) (ARRAYELTS (array), array)

#define CALLN(f, ...) CALLMANY (f, ((Lisp_Object []) {__VA_ARGS__}))

This lets code use 'return CALLN (foo, a, b, c, d);' instead of the current 
error-prone usages which are like '{ Lisp_Object args[4]; args[0] = a; args[1] = 
b; args[2] = c; args[3] = d; return foo (3, args); }'.  (Oops, that last '3' 
should have been a '4'....)

This patch still needs a ChangeLog entry and some more testing on my part, but I 
thought I'd get it out for review now.
[calln.diff (text/x-patch, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 19634-done <at> debbugs.gnu.org
Subject: Re: bug#19634: counting MANY function args more reliably
Date: Sun, 25 Jan 2015 09:15:58 -0800
Stefan Monnier wrote:
> I like that,

Thanks, I tested the patch on a few more platforms, rebased it to the current 
master, added some commentary in response to the remarks in this bug report, and 
installed the patch into the master as commit 
a3689d3c661fe36df971c875760f8d500b5ae994.


This bug report was last modified 10 years and 121 days ago.

Previous Next


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