C Parser Cleanup

Neil Booth neil@daikokuya.demon.co.uk
Thu May 10 11:42:00 GMT 2001


Gabriel Dos Reis wrote:-

> Neil Booth <neil@daikokuya.demon.co.uk> writes:
> 
> | +/* Return the address of a LABEL as a pointer.  */
> | +tree
> | +label_pointer (name)
> | +     tree name;
> | +{
> | +  tree label, result;
> | +
> | +  if (pedantic)
> | +    pedwarn ("ISO C forbids `&&'");
> 
> Since the C++ front-end uses bits from the C front-end, this type of
> diagnostic should test for the front-end used --- yes, you just moved
> but it is appropriate to improve it because now it is exported and
> not embedded in the parser. 

I don't think it's allowed in ISO C++ either.  Maybe it should be
reworded "The ISO standard forbis `&&'" leaving it suitably vague :-)

Seriously, I think you bring up an important issue.  I would hope that
code in cp/ and objc/ only uses c-common.c (including c-format.c now
that Joseph broke it off) and the tree* files.  Otherwise things get
really confusing; the precise intended semantics of the various tree
types and codes are pretty unclear as it is.

I think there's a good argument for creating a c/ directory, and
moving C (and C intersect ObjC) stuff into there to impove clarity in
these areas.  I don't know what others think of this?

It would also help in the move towards "tree" being a more concrete
abstraction, if that's not an oxymoron.  My understanding is that this
is the way we want to go, away from some of the incestuousness "tree"
has with various front ends.  For example, the tree documentation for
the "standard" types should be able avoid references to any front end,
except for illustrative examples.  A glance at existing documentation
shows this is far from true at present.

Making "tree" more object oriented, possibly through a per-type
op-table of function pointers like Mark mentioned a few days ago,
sounds like a good long term goal to me.  That way we can override
functionality, and simulate inheritance where appropriate etc.

Neil.



More information about the Gcc-patches mailing list