This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] [PR13927] Dump alias_decl and fix duplicated error message (regression 3.4/mainline)


Gabriel Dos Reis wrote:

> The comment at the front of supplement_binding is that it is the
> caller's responsability to make sure that supplementing the binding is
> OK.  In particular, supplement_binding should be not involed in any
> direct diagnostic business.  I tried to fix that a while ago but
> apparently I didn't get that chunk out.

I see.

> Maybe, it is that it might make an easier code-path to follow to let
> supplement_binding issue diagnostics

It is. As far as I can tell, duplicate_decls should just try to merge
redeclarations of the *same* entity, but if a different entity is declared with
the same name (that is, in the cases in whicih it returns NULL_TREE), it should
not emit a diagnostic. This also matches the comment at the start of it. This
is why I removed the diagnostic from there in the first place, it doesn't seem
to belong there.

So, which is the correct place for diagnostic? Whenever we push a
local/class/namespace binding, we check if there is an entity with the same
name already exists, and we call supplement_binding if it fails. Should I add a
common error function to emit a diagnostic for an invalid redeclaration
whenever supplement_binding returns false?

> but in that case, you need to
> revisit duplicate_decls because there are many cases where
> supplement_binding thinks the right things are done elsewhere.

Can you please elaborate on this?

> (And, anyway, duplicate_decls is such a labyrinth that I'm very
> cautious about any changes made to it :-)

Yup :) But we are in stage 1, after all.

Giovanni Bajo



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]