diff mbox series

[C++] some cleanups

Message ID 26790225-32ae-4917-5923-b17c12ecadba@acm.org
State New
Headers show
Series [C++] some cleanups | expand

Commit Message

Nathan Sidwell April 27, 2018, 11:54 a.m. UTC
A few cleanups from the modules branch.

* The TEMPLATE_INFO comments still described TREE_LIST contents.
* we didn't check we were looking at a TEMPLATE_INFO in one case
* we declared some (now?) non-existent dump functions
* we made a name-lookup internal dumping function extern
* we made a template (now?) internal creator function extern

committing to trunk.

nathan
diff mbox series

Patch

2018-04-27  Nathan Sidwell  <nathan@acm.org>

	* 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.

Index: cp-tree.h
===================================================================
--- cp-tree.h	(revision 259683)
+++ cp-tree.h	(working copy)
@@ -3273,11 +3273,11 @@  extern void decl_shadowed_for_var_insert
    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 <typename T> struct S { friend void f(T) {} };
@@ -3344,11 +3344,14 @@  extern void decl_shadowed_for_var_insert
 
 #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);
 
Index: name-lookup.c
===================================================================
--- name-lookup.c	(revision 259683)
+++ name-lookup.c	(working copy)
@@ -3742,7 +3742,7 @@  debug (cp_binding_level *ptr)
 }
 
 
-void
+static void
 print_other_binding_stack (cp_binding_level *stack)
 {
   cp_binding_level *level;
Index: pt.c
===================================================================
--- pt.c	(revision 259683)
+++ pt.c	(working copy)
@@ -4674,7 +4674,7 @@  maybe_update_decl_type (tree orig_type,
    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);