http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44978

--- Comment #13 from janus at gcc dot gnu.org ---
(In reply to Mikael Morin from comment #12)
> > IMHO it is probably not worth the hassle. I wouldn't like to do this without
> > having a concrete reason for it (and with a clean testsuite I don't see 
> > any).
> > 
> The reason is: 
> the sym->resolved flag is an internal detail that should not be externally
> visible; it shouldn't change the return value.

well, I guess one could argue that the return value of 'resolve_fl_derived' is
an internal detail in the same sense as sym->resolved (both are not directly
'user-visible').


> > Well, the advantage of my original patch is obviously that it not only
> > avoids the double errors, but it also prevents us from doing double the work
> > in resolving the symbols, so it might even give a performance improvement
> > for large codes, in particular with heavy OOP (not sure if it's anywhere
> > close to being significant, though).
> 
> All right, the only one solution left that I see is the one making the
> functions void. See the attached patch (comments welcome).
> I ran the testsuite partially on it and it was clean, but I don't have the
> time to finish that right now. It looked as slow as usual by the way. ;-)

Your patch does not compile cleanly, but after a small fix to make it compile,
the testsuite runs through successfully. (Btw I would not really expect a
visible performance effect in the testsuite, because the share of OOP code in
there is probably still rather low, even if it's growing slowly.)

However, I don't quite see the point of doing this: Doesn't a void return value
have basically the same effect as returning true? (i.e. to "keep going",
whereas returning false means to "back out", since there was a problem)

Therefore I don't really see the improvement here. To the contrary: I would
rather say we should propagate the return values as far as possible (one case
where it is currently not propagated is resolve_symbol). This alone might even
get rid of the double errors (if one pulls it through fully), but again it does
not really help with double resolution in the non-error case, so I'd say we
still need to rely on sym->resolved.

But in addition (as a follow-up?) it might be worth to use more bool return
values instead of void in the resolve_* routines (e.g. resolve_symbol). IIRC
there might even be a another PR where this helps (will see if I can still find
it ...)

Reply via email to