Prefer simple case changes in spelling suggestions
I got this error message when editing gcc and recompiling:
../../gcc/gcc/ada/gcc-interface/decl.c:7714:39: error: ‘DWARF_GNAT_ENCODINGS_all’ was not declared in this scope; did you mean ‘DWARF_GNAT_ENCODINGS_GDB’?
7714 | = debug_info && gnat_encodings == DWARF_GNAT_ENCODINGS_all;
| ^~~~~~~~~~~~~~~~~~~~~~~~
| DWARF_GNAT_ENCODINGS_GDB
This suggestion could be improved -- what happened here is that I
failed to upper-case the word, and DWARF_GNAT_ENCODINGS_ALL was the
correct spelling.
This patch changes gcc's spell checker to prefer simple case changes
when possible.
I tested this using the self-tests. A new self-test is also included.
gcc/ChangeLog:
* spellcheck.c (CASE_COST): New define.
(BASE_COST): New define.
(get_edit_distance): Recognize case changes.
(get_edit_distance_cutoff): Update.
(test_edit_distances): Update.
(get_old_cutoff): Update.
(test_find_closest_string): Add case sensitivity test.