On Tue, Jul 5, 2011 at 9:08 PM, Diego Novillo <dnovi...@google.com> wrote:
> * pph-streamer-in.c (pph_add_bindings_to_namespace): > diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c > index 72536a5..0bab93b 100644 > --- a/gcc/cp/pph-streamer-in.c > +++ b/gcc/cp/pph-streamer-in.c > @@ -1167,11 +1167,9 @@ pph_add_bindings_to_namespace (struct cp_binding_level > *bl, tree ns) > /* Pushing a decl into a scope clobbers its DECL_CHAIN. > Preserve it. */ > chain = DECL_CHAIN (t); > - > - /* FIXME pph: we should first check to see if it isn't already there. > - If it is, we should use this function recursively to merge > - the bindings in T in the corresponding namespace. */ > pushdecl_into_namespace (t, ns); > + if (NAMESPACE_LEVEL (t)) > + pph_add_bindings_to_namespace (NAMESPACE_LEVEL (t), t); > } > } I had removed these two lines because that pretty much does nothing (I think, at least removing them didn't make anything fail...)... When we stream out the other namespaces (through the tree which's root is scope_chain->bindings), we also stream out these namespaces' bindings. This is all rebuilt when streaming in, so calling pph_add_bindings_to_namespace (NAMESPACE_LEVEL (t), t); seems like it's trying to add to namespace t all the bindings that are already in it... (unless pushdecl_into_namespace does more magic then adding the bindings to the namespace?) To me this only made sense if we had found a corresponding namespace we wanted to merge the streamed in bindings into... Otherwise I agree we will need to modify pph_add_bindings_to_namespace. It is still missing the merge of "usings" and "using_directives". "static_decls" if I remember correctly were automatically reinserted when doing pushdecl_into_namespace for the static decls in "names". Gab