diff options
author | David Malcolm <dmalcolm@redhat.com> | 2017-12-06 19:56:11 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2017-12-06 19:56:11 +0000 |
commit | 613bc14fcd3f6b58289aca9a2980cacfc2e75299 (patch) | |
tree | adf0978b4aae44dff2d6b8e753023d32a03d9960 /gcc/spellcheck-tree.c | |
parent | 06f9708454a5e644b1fb5ed17a863cd624985e17 (diff) | |
download | gcc-613bc14fcd3f6b58289aca9a2980cacfc2e75299.zip gcc-613bc14fcd3f6b58289aca9a2980cacfc2e75299.tar.gz gcc-613bc14fcd3f6b58289aca9a2980cacfc2e75299.tar.bz2 |
Move macro-spellchecking code from "gcc" to new files in c-family
The code for spellchecking macros really belongs in c-family, rather
than in gcc/spellcheck-tree.c, so this patch moves it there.
gcc/ChangeLog:
* Makefile.in (C_COMMON_OBJS): Add c-family/c-spellcheck.o.
* spellcheck-tree.c (find_closest_macro_cpp_cb): Move to
c-family/c-spellcheck.cc.
(best_macro_match::best_macro_match): Likewise.
* spellcheck-tree.h
(struct edit_distance_traits<cpp_hashnode *>): Move to
c-family/c-spellcheck.h.
(class best_macro_match): Likewise.
gcc/c-family/ChangeLog:
* c-spellcheck.cc: New file, taken from macro-handling code in
spellcheck-tree.c.
* c-spellcheck.h: New file, taken from macro-handling code in
spellcheck-tree.h.
gcc/c/ChangeLog:
* c-decl.c: Include "c-family/c-spellcheck.h".
gcc/cp/ChangeLog:
* name-lookup.c: Include "c-family/c-spellcheck.h".
From-SVN: r255452
Diffstat (limited to 'gcc/spellcheck-tree.c')
-rw-r--r-- | gcc/spellcheck-tree.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/gcc/spellcheck-tree.c b/gcc/spellcheck-tree.c index b819980..99878d5 100644 --- a/gcc/spellcheck-tree.c +++ b/gcc/spellcheck-tree.c @@ -66,36 +66,6 @@ find_closest_identifier (tree target, const auto_vec<tree> *candidates) return bm.get_best_meaningful_candidate (); } -/* A callback for cpp_forall_identifiers, for use by best_macro_match's ctor. - Process HASHNODE and update the best_macro_match instance pointed to be - USER_DATA. */ - -static int -find_closest_macro_cpp_cb (cpp_reader *, cpp_hashnode *hashnode, - void *user_data) -{ - if (hashnode->type != NT_MACRO) - return 1; - - best_macro_match *bmm = (best_macro_match *)user_data; - bmm->consider (hashnode); - - /* Keep iterating. */ - return 1; -} - -/* Constructor for best_macro_match. - Use find_closest_macro_cpp_cb to find the closest matching macro to - NAME within distance < best_distance_so_far. */ - -best_macro_match::best_macro_match (tree goal, - edit_distance_t best_distance_so_far, - cpp_reader *reader) -: best_match <goal_t, candidate_t> (goal, best_distance_so_far) -{ - cpp_forall_identifiers (reader, find_closest_macro_cpp_cb, this); -} - #if CHECKING_P namespace selftest { |