This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: c-decl.c rewrite - final
Ziemowit Laski <zlaski@apple.com> writes:
> On 23 Mar, 2004, at 15.45, Zack Weinberg wrote:
>
>>
>> Here's the final version of the big c-decl.c rewrite. To reiterate
>> the caveats:
>>
>> - The patch induces a handful of regressions in the objc testsuite.
>> Ziemowit Laski has promised to fix these.
>
> Indeed. :-) I do have one question: Can your provide a 1-2 sentence
> executive summary of what/why it is your patch does? :-) I need to
> know so that, among other things, I do not violate these new
> religious precepts when fixing the ObjC regressions.
The biggest change is, it introduces a layer of abstraction between
IDENTIFIER_NODEs and DECLs so that we don't have to copy_node() DECLs
for them to be visible in more than one scope. These are the
c_binding structures.
The other thing that it does is introduce a notion of a scope outer to
the C 'file scope', which holds everything with external linkage.
Declarations bound only in this scope are invisible (except
TYPE_DECLs, but that's a wart I hope to eliminate). But we do examine
them for purposes of duplicate_decls(), and if we find duplicates we
reuse the old decl. So for instance in
foo() { extern int x; }
bar() { extern int x; }
there is only one decl for x.
There can be more than one c_binding structure pointing to a given
DECL node - that's how declarations with external linkage are made
visible: they get another c_binding structure pushed in an appropriate
scope.
If that's not enough detail, please ask specific questions. You might
also find useful my earlier conversation with Robert Bowdidge:
http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01411.html (him)
http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01440.html (me)
Unfortunately I wasn't able to roll that discussion into in-code
comments as I had hoped to have time to do - will try to do it later
today.
zw