This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: rfc: macros accepting constructors
- From: Tim Hollebeek <tim at hollebeek dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: Joern Rennecke <joern dot rennecke at superh dot com>, Andreas Schwab <schwab at suse dot de>, jason at redhat dot com, gcc at gcc dot gnu dot org, geoffk at redhat dot com
- Date: Thu, 27 Jun 2002 12:42:37 -0400
- Subject: Re: rfc: macros accepting constructors
- References: <3D1B3BDE.3956A494@superh.com> <20020627122802.A15324@hollebeek.com> <20020627170232.GA687@redhat.com>
- Reply-to: tim at hollebeek dot com
On Thu, Jun 27, 2002 at 10:02:32AM -0700, Aldy Hernandez wrote:
>
> > Perhaps the best suggestion (if anything is desirable) is to modify
> > grammar so that ()'s are allowed around any grammar element which is
> > surrounded by {}'s. Then all you have to do is remember to use ({ and
>
> this already works.
I think you misunderstood. The part of the grammar I was proposing to
modify was the C grammar, not the preprocessor grammar. What I suggested
most definitely does NOT work right now:
d1.c: void foo(void) ({ int x, y; })
d2.c: int x[2] = ({ 0, 0 });
d1.c:1: parse error before `{'
d2.c:1: braced-group within expression allowed only inside a function
> but foo({1,2}) doesn't.
What I'm proposing would allow foo({1,2}) to safely be rewritten as
foo(({1,2})) regardless of how the { ends up getting used.
-Tim