[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Omit all GCPRO stuff if GC_MAKE_GCPROS_NOOPS

From: Paul Eggert
Subject: Re: [RFC] Omit all GCPRO stuff if GC_MAKE_GCPROS_NOOPS
Date: Sun, 15 Jul 2012 23:41:05 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

Could you please explain the point of the patch?
Is it to simplify debugging, or improve performance, or what?
I don't see the advantage over the current approach.

> +#define DEFGCPRO1 void *__dummy ATTRIBUTE_UNUSED = &__dummy

This would be cleaner if DEFGCPRO1 etc were either empty,
or expanded to something that ended in ";".  Then the caller
can just do "DEFGCPRO1" (without the semicolon) and there's
no need for dummy declarations.

> +#define IF_GCPRO(code) do { } while (0)
> +#define IF_GCPRO(code) do { code; } while (0)

IF_GCPRO should act more like a function, i.e., its argument
should be an expression and it should expand to an expression.
This is more consistent with how typical macro-like functions work.
The above should be:

  #define IF_GCPRO(expr) ((void) 0)
  #define IF_GCPRO(expr) (expr, (void) 0)

and calls like this:

  IF_GCPRO (gcpro3.nvars = nargs; gcpro4.nvars = nargs);

should be replaced by:

  IF_GCPRO ((gcpro3.nvars = nargs, gcpro4.nvars = nargs));

reply via email to

[Prev in Thread] Current Thread [Next in Thread]