diff options
author | Nathan Sidwell <nathan@acm.org> | 2017-05-10 20:47:16 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2017-05-10 20:47:16 +0000 |
commit | 3dd836179aa32c3ded97ded16bb24305cefc43b0 (patch) | |
tree | fe6f0d9c92e267df269da020c7a301cfcf1ba02e /gcc | |
parent | 268de039e3d8136c02e7a11e1e97a7637d7d1323 (diff) | |
download | gcc-3dd836179aa32c3ded97ded16bb24305cefc43b0.zip gcc-3dd836179aa32c3ded97ded16bb24305cefc43b0.tar.gz gcc-3dd836179aa32c3ded97ded16bb24305cefc43b0.tar.bz2 |
pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD printing.
* pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD
printing.
(print_candidates): Adjust.
From-SVN: r247863
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 57 |
2 files changed, 25 insertions, 36 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 35dc539..c0bba2a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2017-05-10 Nathan Sidwell <nathan@acm.org> + * pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD + printing. + (print_candidates): Adjust. + * cp-tree.h (build_new_function_call): Lose koenig_p arg. Fix line breaking. * call.c (build_new_function_call): Lose koenig_p arg. Remove diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 05aa454..5f7d429 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1922,43 +1922,28 @@ explicit_class_specialization_p (tree type) in *STR when it ends. */ static void -print_candidates_1 (tree fns, bool more, const char **str) +print_candidates_1 (tree fns, char **str, bool more = false) { - tree fn, fn2; - char *spaces = NULL; - - for (fn = fns; fn; fn = OVL_NEXT (fn)) - if (TREE_CODE (fn) == TREE_LIST) - { - for (fn2 = fn; fn2 != NULL_TREE; fn2 = TREE_CHAIN (fn2)) - print_candidates_1 (TREE_VALUE (fn2), - TREE_CHAIN (fn2) || more, str); - } - else + if (TREE_CODE (fns) == TREE_LIST) + for (; fns; fns = TREE_CHAIN (fns)) + print_candidates_1 (TREE_VALUE (fns), str, more || TREE_CHAIN (fns)); + else + while (fns) { - tree cand = OVL_CURRENT (fn); - if (!*str) - { - /* Pick the prefix string. */ - if (!more && !OVL_NEXT (fns)) - { - inform (DECL_SOURCE_LOCATION (cand), - "candidate is: %#qD", cand); - continue; - } + tree cand = OVL_CURRENT (fns); - *str = _("candidates are:"); - spaces = get_spaces (*str); - } - inform (DECL_SOURCE_LOCATION (cand), "%s %#qD", *str, cand); - *str = spaces ? spaces : *str; + fns = OVL_NEXT (fns); + const char *pfx = *str; + if (!pfx) + { + if (more || fns) + pfx = _("candidates are:"); + else + pfx = _("candidate is:"); + *str = get_spaces (pfx); + } + inform (DECL_SOURCE_LOCATION (cand), "%s %#qD", pfx, cand); } - - if (!more) - { - free (spaces); - *str = NULL; - } } /* Print the list of candidate FNS in an error message. FNS can also @@ -1967,9 +1952,9 @@ print_candidates_1 (tree fns, bool more, const char **str) void print_candidates (tree fns) { - const char *str = NULL; - print_candidates_1 (fns, false, &str); - gcc_assert (str == NULL); + char *str = NULL; + print_candidates_1 (fns, &str); + free (str); } /* Get a (possibly) constrained template declaration for the |