aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog18
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/cp/decl.c10
-rw-r--r--gcc/cp/decl2.c4
-rw-r--r--gcc/cp/lex.c13
-rw-r--r--gcc/cp/method.c4
-rw-r--r--gcc/cp/parse.c10
-rw-r--r--gcc/cp/parse.y10
-rw-r--r--gcc/cp/pt.c18
-rw-r--r--gcc/cp/rtti.c2
-rw-r--r--gcc/cp/semantics.c7
-rw-r--r--gcc/cp/tree.c3
13 files changed, 61 insertions, 44 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f760057..4ad7793 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,23 @@
2000-04-11 Mark Mitchell <mark@codesourcery.com>
+ * cp-tre.h (finish_function): Change prototype.
+ * decl.c (end_cleanup_fn): Adjust caller.
+ (finish_function): Take only one parameter.
+ * decl2.c (finish_objects): Adjust caller.
+ (finish_static_storage_duration_function): Likewise.
+ * method.c (emit_thunk): Likewise.
+ * parse.y: Likewise.
+ * parse.c: Regenerated.
+ * pt.c (instantiate_decl): Likewise.
+ * rtti.c (synthesize_tinfo_fn): Likewise.
+ * semantics.c (expand_body): Likewise.
+
+ * cp-tree.h (copy_decl): New function.
+ * class.c (finish_struct_1): Use it.
+ * lex.c (copy_decl): Define it.
+ * pt.c (tsubst_decl): Likewise.
+ * tree.c (copy_template_template_parm): Likewise.
+
* cp-tree.h (lang_type): Remove has_nonpublic_ctor and
has_nonpublic_assign_ref.
(TYPE_HAS_NONPUBLIC_CTOR): Don't declare.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index a3fd544..5262faa 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4645,8 +4645,7 @@ finish_struct_1 (t)
{
tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);
- vfield = copy_node (vfield);
- copy_lang_decl (vfield);
+ vfield = copy_decl (vfield);
DECL_FIELD_CONTEXT (vfield) = t;
DECL_FIELD_OFFSET (vfield)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 285f15e..b556236 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3833,7 +3833,7 @@ extern int start_function PARAMS ((tree, tree, tree, int));
extern void expand_start_early_try_stmts PARAMS ((void));
extern void store_parm_decls PARAMS ((void));
extern void store_return_init PARAMS ((tree));
-extern tree finish_function PARAMS ((int, int));
+extern tree finish_function PARAMS ((int));
extern tree start_method PARAMS ((tree, tree, tree));
extern tree finish_method PARAMS ((tree));
extern void hack_incomplete_structures PARAMS ((tree));
@@ -4048,6 +4048,7 @@ extern int real_yylex PARAMS ((void));
extern int is_rid PARAMS ((tree));
extern tree build_lang_decl PARAMS ((enum tree_code, tree, tree));
extern void retrofit_lang_decl PARAMS ((tree));
+extern tree copy_decl PARAMS ((tree));
extern void copy_lang_decl PARAMS ((tree));
extern tree cp_make_lang_type PARAMS ((enum tree_code));
extern tree make_aggr_type PARAMS ((enum tree_code));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index a6672b6..85ab135 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -8283,7 +8283,7 @@ end_cleanup_fn ()
{
do_poplevel ();
- expand_body (finish_function (lineno, 0));
+ expand_body (finish_function (0));
pop_from_top_level ();
}
@@ -13939,8 +13939,7 @@ finish_destructor_body ()
after the class definition is complete.) */
tree
-finish_function (lineno, flags)
- int lineno;
+finish_function (flags)
int flags;
{
register tree fndecl = current_function_decl;
@@ -13951,6 +13950,7 @@ finish_function (lineno, flags)
int inclass_inline = (flags & 2) != 0;
int expand_p;
int nested;
+ int current_line = lineno;
/* When we get some parse errors, we can end up without a
current_function_decl, so cope. */
@@ -14065,7 +14065,7 @@ finish_function (lineno, flags)
DECL_CONTEXT (no_return_label) = fndecl;
DECL_INITIAL (no_return_label) = error_mark_node;
DECL_SOURCE_FILE (no_return_label) = input_filename;
- DECL_SOURCE_LINE (no_return_label) = lineno;
+ DECL_SOURCE_LINE (no_return_label) = current_line;
expand_goto (no_return_label);
}
@@ -14104,7 +14104,7 @@ finish_function (lineno, flags)
immediate_size_expand = 1;
/* Generate rtl for function exit. */
- expand_function_end (input_filename, lineno, 1);
+ expand_function_end (input_filename, current_line, 1);
}
/* We have to save this value here in case
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 61aa02d..07f2d54 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2861,7 +2861,7 @@ finish_objects (method_type, initp, body)
/* Finish up. */
finish_compound_stmt(/*has_no_scope=*/0, body);
- fn = finish_function (lineno, 0);
+ fn = finish_function (0);
expand_body (fn);
/* When only doing semantic analysis, and no RTL generation, we
@@ -3045,7 +3045,7 @@ finish_static_storage_duration_function (body)
{
/* Close out the function. */
finish_compound_stmt (/*has_no_scope=*/0, body);
- expand_body (finish_function (lineno, 0));
+ expand_body (finish_function (0));
}
/* Return the information about the indicated PRIORITY level. If no
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index a5d1269..b256931 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -5014,6 +5014,19 @@ copy_lang_decl (node)
DECL_LANG_SPECIFIC (node) = ld;
}
+/* Copy DECL, including any language-specific parts. */
+
+tree
+copy_decl (decl)
+ tree decl;
+{
+ tree copy;
+
+ copy = copy_node (decl);
+ copy_lang_decl (copy);
+ return copy;
+}
+
tree
cp_make_lang_type (code)
enum tree_code code;
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 549c9e0..010469d 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -2157,7 +2157,7 @@ emit_thunk (thunk_fndecl)
t = build_call (function, t);
finish_return_stmt (t);
- expand_body (finish_function (lineno, 0));
+ expand_body (finish_function (0));
/* Don't let the backend defer this function. */
if (DECL_DEFER_OUTPUT (thunk_fndecl))
@@ -2405,7 +2405,7 @@ synthesize_method (fndecl)
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
}
- expand_body (finish_function (lineno, 0));
+ expand_body (finish_function (0));
extract_interface_info ();
if (! context)
diff --git a/gcc/cp/parse.c b/gcc/cp/parse.c
index ed32a2c..407025e 100644
--- a/gcc/cp/parse.c
+++ b/gcc/cp/parse.c
@@ -4908,11 +4908,11 @@ case 85:
break;}
case 91:
#line 735 "parse.y"
-{ expand_body (finish_function (lineno, (int)yyvsp[-1].itype)); ;
+{ expand_body (finish_function ((int)yyvsp[-1].itype)); ;
break;}
case 92:
#line 737 "parse.y"
-{ expand_body (finish_function (lineno, (int)yyvsp[0].itype)); ;
+{ expand_body (finish_function ((int)yyvsp[0].itype)); ;
break;}
case 93:
#line 739 "parse.y"
@@ -6419,21 +6419,21 @@ case 458:
case 459:
#line 2104 "parse.y"
{
- expand_body (finish_function (lineno, (int)yyvsp[-1].itype | 2));
+ expand_body (finish_function ((int)yyvsp[-1].itype | 2));
process_next_inline (yyvsp[-3].pi);
;
break;}
case 460:
#line 2109 "parse.y"
{
- expand_body (finish_function (lineno, (int)yyvsp[0].itype | 2));
+ expand_body (finish_function ((int)yyvsp[0].itype | 2));
process_next_inline (yyvsp[-2].pi);
;
break;}
case 461:
#line 2114 "parse.y"
{
- finish_function (lineno, 2);
+ finish_function (2);
process_next_inline (yyvsp[-2].pi); ;
break;}
case 464:
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index ac053ab..65b90bb 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -732,9 +732,9 @@ eat_saved_input:
fndef:
fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
- { expand_body (finish_function (lineno, (int)$3)); }
+ { expand_body (finish_function ((int)$3)); }
| fn.def1 maybe_return_init function_try_block
- { expand_body (finish_function (lineno, (int)$3)); }
+ { expand_body (finish_function ((int)$3)); }
| fn.def1 maybe_return_init error
{ }
;
@@ -2102,17 +2102,17 @@ fn.defpen:
pending_inline:
fn.defpen maybe_return_init ctor_initializer_opt compstmt_or_error
{
- expand_body (finish_function (lineno, (int)$3 | 2));
+ expand_body (finish_function ((int)$3 | 2));
process_next_inline ($1);
}
| fn.defpen maybe_return_init function_try_block
{
- expand_body (finish_function (lineno, (int)$3 | 2));
+ expand_body (finish_function ((int)$3 | 2));
process_next_inline ($1);
}
| fn.defpen maybe_return_init error
{
- finish_function (lineno, 2);
+ finish_function (2);
process_next_inline ($1); }
;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 397d5cf..6bb482a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5440,8 +5440,7 @@ tsubst_decl (t, args, type, in_decl)
We also create a new function declaration, which is just
like the old one, but points to this new template, rather
than the old one. */
- r = copy_node (t);
- copy_lang_decl (r);
+ r = copy_decl (t);
my_friendly_assert (DECL_LANG_SPECIFIC (r) != 0, 0);
TREE_CHAIN (r) = NULL_TREE;
@@ -5681,9 +5680,7 @@ tsubst_decl (t, args, type, in_decl)
point, as they may not represent instantiations of this
template, and in any case are considered separate under the
discrete model. Instead, see add_maybe_template. */
-
- r = copy_node (t);
- copy_lang_decl (r);
+ r = copy_decl (t);
DECL_USE_TEMPLATE (r) = 0;
TREE_TYPE (r) = type;
@@ -5819,8 +5816,7 @@ tsubst_decl (t, args, type, in_decl)
case FIELD_DECL:
{
- r = copy_node (t);
- copy_lang_decl (r);
+ r = copy_decl (t);
TREE_TYPE (r) = type;
c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r);
@@ -5899,10 +5895,7 @@ tsubst_decl (t, args, type, in_decl)
break;
}
- /* This declaration is going to have to be around for a while,
- so me make sure it is on a saveable obstack. */
- r = copy_node (t);
-
+ r = copy_decl (t);
TREE_TYPE (r) = type;
c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r);
DECL_CONTEXT (r) = ctx;
@@ -5912,7 +5905,6 @@ tsubst_decl (t, args, type, in_decl)
DECL_INITIAL (r) = NULL_TREE;
DECL_RTL (r) = 0;
DECL_SIZE (r) = DECL_SIZE_UNIT (r) = 0;
- copy_lang_decl (r);
/* For __PRETTY_FUNCTION__ we have to adjust the initializer. */
if (DECL_PRETTY_FUNCTION_P (r))
@@ -9585,7 +9577,7 @@ instantiate_decl (d, defer_ok)
/*complain=*/1, tmpl);
/* Finish the function. */
- expand_body (finish_function (lineno, 0));
+ expand_body (finish_function (0));
}
/* We're not deferring instantiation any more. */
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 1154f41..0ad29d5 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -1274,7 +1274,7 @@ synthesize_tinfo_fn (fndecl)
finish_return_stmt (tmp);
/* Finish the function body. */
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
- expand_body (finish_function (lineno, 0));
+ expand_body (finish_function (0));
}
/* Return the runtime bit mask encoding the qualifiers of TYPE. */
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 4ff9bee..e7fcb63 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1957,11 +1957,6 @@ begin_class_definition (t)
|| ! CLASSTYPE_INTERFACE_ONLY (t))
CLASSTYPE_VTABLE_NEEDS_WRITING (t) = 1;
}
-#if 0
- tmp = TYPE_IDENTIFIER ($<ttype>0);
- if (tmp && IDENTIFIER_TEMPLATE (tmp))
- overload_template_name (tmp, 1);
-#endif
reset_specialization();
/* Make a declaration for this class in its own scope. */
@@ -2788,7 +2783,7 @@ expand_body (fn)
lineno = STMT_LINENO (DECL_SAVED_TREE (fn));
/* Generate code for the function. */
- finish_function (lineno, 0);
+ finish_function (0);
/* If possible, obliterate the body of the function so that it can
be garbage collected. */
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index d5e0a5d6..db3c418 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1181,8 +1181,7 @@ copy_template_template_parm (t)
tree t2;
t2 = make_aggr_type (TEMPLATE_TEMPLATE_PARM);
- template = copy_node (template);
- copy_lang_decl (template);
+ template = copy_decl (template);
TREE_TYPE (template) = t2;
TYPE_NAME (t2) = template;