[Python-checkins] r45279 - in python/trunk: Parser/pgenmain.c Python/compile.c Python/future.c Python/pyarena.c Python/pystate.c

Jeremy Hylton jeremy at alum.mit.edu
Tue Apr 11 15:04:36 CEST 2006


On 4/11/06, Anthony Baxter <anthony at interlink.com.au> wrote:
> On Tuesday 11 April 2006 22:21, Jeremy Hylton wrote:
> > > more low-hanging fruit. Not entirely happy with the two new VISIT
> > > macros in compile.c, but I couldn't see a better approach.
> >
> > Could you provide more descriptive log messages?  I can't fathom
> > what kind of low-hanging fruit you are talking about.  I'm guessing
> > that you are dealing with warnings on some compiler, but I don't
> > know which one or why we didn't see them before.
>
> Ok. In this case, it's making the code compile with C++ compilers.
>
> I'll edit the log messages.

Thanks.  I found your other log messages after I sent the messages,
but in six months you'll be the only one who remembers that for this
change "low-hanging fruit" meant "C++ compiler" :-).

>
> > As for the new visit macros, the second argument to VISIT is the
> > type of the sequence elements that are being iterated over.  You
> > should be able to generate a cast from that without passing a
> > separate cast token.  I can't think of a case where TYPE did not
> > imply CAST.
> >
> > -       VISIT_SEQ(c, stmt, s->v.TryFinally.finalbody);
> > +       VISIT_SEQ_WITH_CAST(c, stmt, s->v.TryFinally.finalbody,
> > stmt_ty);
> >
> > +#define VISIT_SEQ_WITH_CAST(C, TYPE, SEQ, CAST) { \
> > +       int _i; \
> > +       asdl_seq *seq = (SEQ); /* avoid variable capture */ \
> > +       for (_i = 0; _i < asdl_seq_LEN(seq); _i++) { \
> > +               TYPE ## _ty elt = (CAST)asdl_seq_GET(seq, _i); \
> >
> >                                             (##_ty) instead of
> > CAST?
>
> Hm. That seems like a workable approach. Will give it a go.

Cool.

Jeremy


More information about the Python-checkins mailing list