This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFD - cleaning up C identifier lookup
Gabriel Dos Reis <gdr at integrable-solutions dot net> writes:
> Zack Weinberg <zack at codesourcery dot com> writes:
...
> | struct lang_identifier GTY(())
> | {
> | struct c_common_identifier common_id;
> | tree symbol_value;
> | tree tag_value;
> | tree label_value;
> | }
...
> | Much of this stuff could also be applied to the C++ front end also,
>
> That might; but in fact, that would be a complication (and hardly an
> improvement over current situation) for C++.
>
> A distinction is that C++ has a single name space as opposed to C.
> An immediate consequence is that the C++ front-end would have to jump
> through whoops to ensure that we can C++ semantics right.
By this you mean that symbols and tags occupy the same namespace,
right? 6.1p1 [stmt.label] says that labels have their own namespace,
so I think you'd still need the pointer for that. (However, labels
are rare enouugh that it might be worthwhile to use a separate table
for them, saving more space in the identifier.)
> The route I take on this issue for C++ is to get rid of the confusion
> notions of binding-level and scope in G++. Instead, I just use the
> standard notion of scope and implement essentially
>
> 1) local scopes (these are blocks) with the refinements:
> + try-scope
> + catch-scope
> + for-while scope
> 2) function prototype scopes
> 3) class scope
> 4) namespace scope
> 5) template prototype scope
C99 has for-while scope and function-prototype scope, too. And
there's also file scope.
I'd like to do something compatible with merging the C and C++ front
ends in the future, and I can see getting rid of the binding-level
concept as worthwhile for C too (but I want to do this incrementally).
I don't think the conflicts here are severe. What would you suggest I
do to bring things into congruence?
> struct lang_identifier GTY(())
> {
> struct c_common_identifier c_common;
> tree class_template_info;
> struct lang_id2 *x;
> };
What's in a struct lang_id2?
zw