GNU bug report logs - #11935
XINT etc. should be functions

Previous Next

Package: emacs;

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

Date: Fri, 13 Jul 2012 15:15:02 UTC

Severity: wishlist

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: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 11935 <at> debbugs.gnu.org
Subject: bug#11935: XINT etc. should be functions
Date: Fri, 14 Jun 2013 23:43:30 -0700
[Message part 1 (text/plain, inline)]
On 06/13/2013 01:08 PM, Stefan Monnier wrote:
> Can't we use something like
> 
> #define FUNCTION_OF_MACRO(fun, type_in, type_out) \
>   LISP_INLINE type_out (fun) (type_in x) { return lisp_h_##fun (x); }

Sure, though we need to adjust that a bit,
as the function can take multiple args, and it might return
void (where the 'return' keyword must be omitted).

The following variant works for me, and the attached combined
patch implements this suggestion.

/* Define NAME as a lisp.h inline function that returns TYPE and has
   arguments declared as ARGDECLS and passed as ARGS.  ARGDECLS and
   ARGS should be parenthesized.  Implement the function by calling
   lisp_h_NAME ARGS.  */
#define LISP_MACRO_DEFUN(name, type, argdecls, args) \
  LISP_INLINE type (name) argdecls { return lisp_h_##name args; }

/* like LISP_MACRO_DEFUN, except NAME returns void.  */
#define LISP_MACRO_DEFUN_VOID(name, argdecls, args) \
  LISP_INLINE void (name) argdecls { lisp_h_##name args; }

[inline4o.txt (text/plain, attachment)]

This bug report was last modified 5 years and 119 days ago.

Previous Next


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