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] Ignore invisible bindings for misspelling hints (PR c/71858)


On Thu, Jul 14, 2016 at 02:22:36PM -0400, David Malcolm wrote:
> I agree with the points you raise; in that light I'm fine with your
> patch.

Ok, Marek has approved it earlier, so I went ahead and committed.

> > shouldn't be lowered (say for at
> > most 4 chars identifiers only consider levenshtein distance 1 and not
> > more,
> > e.g. for 3 character identifiers allowing distance of 2 or 3 means
> > you pretty
> > much suggest any other 3 char identifier), regardless of if it is a
> > builtin or not.
> 
> The logic in get_best_meaningful_candidate is currently:
> 
>   unsigned int cutoff = MAX (m_goal_len, m_best_candidate_len) / 2;
>   if (m_best_distance > cutoff)
>      return NULL;
> 
> For a pair of 3 character identifiers, cutoff will be 3 / 2 == 1, so it
> will suggest within a distance of 1 and reject if the distance is 2 or
> 3.   Or is there a bug?
> 
> That cutoff could definitely be improved.  Perhaps the MAX should be
> changed to a MIN?  Or just base it off the goal length e.g. 
>   unsigned int cutoff = m_goal_len / 2;
> thus implicitly rejecting
> suggestions when m_goal_len == 1.
> That would eliminate the "bar" to
> "char" suggestion in the PR, since m_goal_len == 3 would have a cutoff
> of 1.

I'm afraid I don't have enough experience, so we'll need to look at lost of
suggestions and find the right tuning.

	Jakub


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