From d4e15523c1fc225a513d1a21e5eb2b953b4c928d Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 27 Apr 2018 11:55:38 +0000 Subject: [PATCH] [C++ PATCH] some cleanups https://gcc.gnu.org/ml/gcc-patches/2018-04/msg01227.html * cp-tree.h (TEMPLATE_INFO): Fix comments. (TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO. (NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line. (dump, print_other_binding_stacks): Remove declarations. * name-lookup.c (print_other_binding_stack): Make static. * pt.c (build_template_decl): Make static. From-SVN: r259704 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/cp-tree.h | 18 +++++++++--------- gcc/cp/name-lookup.c | 2 +- gcc/cp/pt.c | 2 +- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 491853e..4346021 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2018-04-27 Nathan Sidwell + + * cp-tree.h (TEMPLATE_INFO): Fix comments. + (TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO. + (NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line. + (dump, print_other_binding_stacks): Remove declarations. + * name-lookup.c (print_other_binding_stack): Make static. + * pt.c (build_template_decl): Make static. + 2018-04-26 Jason Merrill PR c++/85545 - ICE with noexcept PMF conversion. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 72e4080..048cb0f 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3273,11 +3273,11 @@ extern void decl_shadowed_for_var_insert (tree, tree); DECL_USE_TEMPLATE is nonzero) or the abstract instance of the template itself. - In either case, DECL_TEMPLATE_INFO is a TREE_LIST, whose - TREE_PURPOSE is the TEMPLATE_DECL of which this entity is a - specialization or abstract instance. The TREE_VALUE is the + In either case, DECL_TEMPLATE_INFO is a TEMPLATE_INFO, whose + TI_TEMPLATE is the TEMPLATE_DECL of which this entity is a + specialization or abstract instance. The TI_ARGS is the template arguments used to specialize the template. - + Consider: template struct S { friend void f(T) {} }; @@ -3344,11 +3344,14 @@ extern void decl_shadowed_for_var_insert (tree, tree); #define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE)) #define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE)) -#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE) +#define TI_PENDING_TEMPLATE_FLAG(NODE) \ + TREE_LANG_FLAG_1 (TEMPLATE_INFO_CHECK (NODE)) /* For a given TREE_VEC containing a template argument list, this property contains the number of arguments that are not defaulted. */ -#define NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) TREE_CHAIN (TREE_VEC_CHECK (NODE)) +#define NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \ + TREE_CHAIN (TREE_VEC_CHECK (NODE)) + /* Below are the setter and getter of the NON_DEFAULT_TEMPLATE_ARGS_COUNT property. */ #define SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE, INT_VALUE) \ @@ -6229,9 +6232,6 @@ extern tree strip_fnptr_conv (tree); extern void maybe_push_cleanup_level (tree); extern tree make_anon_name (void); extern tree check_for_out_of_scope_variable (tree); -extern void dump (cp_binding_level &ref); -extern void dump (cp_binding_level *ptr); -extern void print_other_binding_stack (cp_binding_level *); extern tree maybe_push_decl (tree); extern tree current_decl_namespace (void); diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 3f86cd2..c1f7cf5 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3742,7 +3742,7 @@ debug (cp_binding_level *ptr) } -void +static void print_other_binding_stack (cp_binding_level *stack) { cp_binding_level *level; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9fb8197..a1b2a37 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4674,7 +4674,7 @@ maybe_update_decl_type (tree orig_type, tree scope) template PARMS and constraints, CONSTR. If MEMBER_TEMPLATE_P is true, the new template is a member template. */ -tree +static tree build_template_decl (tree decl, tree parms, bool member_template_p) { tree tmpl = build_lang_decl (TEMPLATE_DECL, DECL_NAME (decl), NULL_TREE); -- 2.7.4