aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-03-27 01:26:18 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2000-03-26 20:26:18 -0500
commit17aec3eb3b5042c4386627faa6a0384505454943 (patch)
treec6019b3d538ef251492309184ce35cc036ed6ae6
parentb06775f990ad9fdc378388df18bbebf7d03ef9e3 (diff)
downloadgcc-17aec3eb3b5042c4386627faa6a0384505454943.zip
gcc-17aec3eb3b5042c4386627faa6a0384505454943.tar.gz
gcc-17aec3eb3b5042c4386627faa6a0384505454943.tar.bz2
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK. * c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI and DECL_INLINE if FUNCTION_DECL. (pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE. (store_parm_decls): Check for type of PARM_DECL being ERROR_MARK. Use DECL_WEAK, not DECL_RESULT, to flag for already seen. (combine_parm_decls): Likewise. * ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD. * print-tree.c (print_node): Likewise. Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and DECL_TRANSPARENT_UNION on proper decl types. Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS. * stor-layout.c (layout_decl): Only check DECL_PACKED and DECL_BIT_FIELD of FIELD_DECL. * tree.h (DECL_RESULT_FLD): New macro. * cp/class.c (check_field_decl): Fix typo. (build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS. (check_methods): Likewise. (check_field_decls): Likewise. Use DECL_CONTEXT, not DECL_FIELD_CONTEXT. * cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT): Use DECL_RESULT_FLD, not DECL_RESULT. * cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT. * cp/lex.c (identifier_type): Likewise. * cp/pt.c (determine_specialization, lookup_template_class): Likewise. (tsubst_friend_function, tsubst_decl, instantiate_template): Likewise. (resolve_overloaded_unification, more_specialized): Likewise. * cp/semantics.c (finish_member_declaration): Likewise. * cp/typeck.c (build_x_function_call): Likewise. From-SVN: r32759
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/c-convert.c4
-rw-r--r--gcc/c-decl.c65
-rw-r--r--gcc/cp/ChangeLog17
-rw-r--r--gcc/cp/class.c8
-rw-r--r--gcc/cp/cp-tree.h4
-rw-r--r--gcc/cp/decl.c12
-rw-r--r--gcc/cp/lex.c3
-rw-r--r--gcc/cp/pt.c40
-rw-r--r--gcc/cp/semantics.c4
-rw-r--r--gcc/cp/typeck.c10
-rw-r--r--gcc/ggc-common.c2
-rw-r--r--gcc/print-tree.c39
-rw-r--r--gcc/stor-layout.c11
-rw-r--r--gcc/tree.h3
15 files changed, 146 insertions, 94 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ca9d214..21f3b19 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,21 @@
+Sun Mar 26 20:15:26 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * c-convert.c (convert): Return if output or input type is ERROR_MARK.
+ * c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
+ and DECL_INLINE if FUNCTION_DECL.
+ (pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
+ (store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
+ Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
+ (combine_parm_decls): Likewise.
+ * ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
+ * print-tree.c (print_node): Likewise.
+ Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
+ DECL_TRANSPARENT_UNION on proper decl types.
+ Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
+ * stor-layout.c (layout_decl): Only check DECL_PACKED and
+ DECL_BIT_FIELD of FIELD_DECL.
+ * tree.h (DECL_RESULT_FLD): New macro.
+
2000-03-26 Richard Henderson <rth@cygnus.com>
* calls.c (expand_call): Pass parms not original exp to
diff --git a/gcc/c-convert.c b/gcc/c-convert.c
index 7bde098..b3b144d 100644
--- a/gcc/c-convert.c
+++ b/gcc/c-convert.c
@@ -65,8 +65,10 @@ convert (type, expr)
register enum tree_code code = TREE_CODE (type);
if (type == TREE_TYPE (expr)
- || TREE_CODE (expr) == ERROR_MARK)
+ || TREE_CODE (expr) == ERROR_MARK
+ || code == ERROR_MARK || TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
return expr;
+
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
return fold (build1 (NOP_EXPR, type, expr));
if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index a5cc458..df1d707 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1805,11 +1805,14 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
DECL_RTL (newdecl) = DECL_RTL (olddecl);
/* Merge the type qualifiers. */
- if (DECL_BUILT_IN_NONANSI (olddecl) && TREE_THIS_VOLATILE (olddecl)
- && !TREE_THIS_VOLATILE (newdecl))
+ if (TREE_CODE (olddecl) == FUNCTION_DECL
+ && DECL_BUILT_IN_NONANSI (olddecl) && TREE_THIS_VOLATILE (olddecl)
+ && ! TREE_THIS_VOLATILE (newdecl))
TREE_THIS_VOLATILE (write_olddecl) = 0;
+
if (TREE_READONLY (newdecl))
TREE_READONLY (write_olddecl) = 1;
+
if (TREE_THIS_VOLATILE (newdecl))
{
TREE_THIS_VOLATILE (write_olddecl) = 1;
@@ -1904,14 +1907,15 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl);
}
- /* If either decl says `inline', this fn is inline,
- unless its definition was passed already. */
- if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == 0)
- DECL_INLINE (olddecl) = 1;
- DECL_INLINE (newdecl) = DECL_INLINE (olddecl);
-
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
+ /* If either decl says `inline', this fn is inline,
+ unless its definition was passed already. */
+ if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == 0)
+ DECL_INLINE (olddecl) = 1;
+
+ DECL_INLINE (newdecl) = DECL_INLINE (olddecl);
+
if (DECL_BUILT_IN (olddecl))
{
/* Get rid of any built-in function if new arg types don't match it
@@ -2145,7 +2149,8 @@ pushdecl (x)
We get warnings about inline functions where they are defined.
Avoid duplicate warnings where they are used. */
- if (TREE_PUBLIC (x) && ! DECL_INLINE (x))
+ if (TREE_PUBLIC (x)
+ && ! (TREE_CODE (x) == FUNCTION_DECL && DECL_INLINE (x)))
{
tree decl;
@@ -2282,15 +2287,16 @@ pushdecl (x)
/* Here to install a non-global value. */
tree oldlocal = IDENTIFIER_LOCAL_VALUE (name);
tree oldglobal = IDENTIFIER_GLOBAL_VALUE (name);
+
IDENTIFIER_LOCAL_VALUE (name) = x;
/* If this is an extern function declaration, see if we
have a global definition or declaration for the function. */
if (oldlocal == 0
- && DECL_EXTERNAL (x) && !DECL_INLINE (x)
&& oldglobal != 0
&& TREE_CODE (x) == FUNCTION_DECL
- && TREE_CODE (oldglobal) == FUNCTION_DECL)
+ && TREE_CODE (oldglobal) == FUNCTION_DECL
+ && DECL_EXTERNAL (x) && ! DECL_INLINE (x))
{
/* We have one. Their types must agree. */
if (! comptypes (TREE_TYPE (x),
@@ -2537,8 +2543,8 @@ redeclaration_error_message (newdecl, olddecl)
if (DECL_INITIAL (olddecl) != 0 && DECL_INITIAL (newdecl) != 0
/* However, defining once as extern inline and a second
time in another way is ok. */
- && !(DECL_INLINE (olddecl) && DECL_EXTERNAL (olddecl)
- && !(DECL_INLINE (newdecl) && DECL_EXTERNAL (newdecl))))
+ && ! (DECL_INLINE (olddecl) && DECL_EXTERNAL (olddecl)
+ && ! (DECL_INLINE (newdecl) && DECL_EXTERNAL (newdecl))))
return 1;
return 0;
}
@@ -5932,7 +5938,9 @@ store_parm_decls ()
{
if (DECL_NAME (parm) == 0)
error_with_decl (parm, "parameter name omitted");
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == void_type_node)
+ else if (TREE_CODE (TREE_TYPE (parm)) != ERROR_MARK
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (parm))
+ == void_type_node))
{
error_with_decl (parm, "parameter `%s' declared void");
/* Change the type to error_mark_node so this parameter
@@ -5999,8 +6007,10 @@ store_parm_decls ()
Associate decls with the names and store the decls
into the TREE_PURPOSE slots. */
+ /* We use DECL_WEAK as a flag to show which parameters have been
+ seen already since it is not used on PARM_DECL or CONST_DECL. */
for (parm = parmdecls; parm; parm = TREE_CHAIN (parm))
- DECL_RESULT (parm) = 0;
+ DECL_WEAK (parm) = 0;
for (parm = specparms; parm; parm = TREE_CHAIN (parm))
{
@@ -6008,7 +6018,8 @@ store_parm_decls ()
if (TREE_VALUE (parm) == 0)
{
- error_with_decl (fndecl, "parameter name missing from parameter list");
+ error_with_decl (fndecl,
+ "parameter name missing from parameter list");
TREE_PURPOSE (parm) = 0;
continue;
}
@@ -6025,7 +6036,7 @@ store_parm_decls ()
/* If declaration already marked, we have a duplicate name.
Complain, and don't use this decl twice. */
- if (found && DECL_RESULT (found) != 0)
+ if (found && DECL_WEAK (found))
{
error_with_decl (found, "multiple parameters named `%s'");
found = 0;
@@ -6064,10 +6075,8 @@ store_parm_decls ()
TREE_PURPOSE (parm) = found;
- /* Mark this decl as "already found" -- see test, above.
- It is safe to use DECL_RESULT for this
- since it is not used in PARM_DECLs or CONST_DECLs. */
- DECL_RESULT (found) = error_mark_node;
+ /* Mark this decl as "already found" */
+ DECL_WEAK (found) = 1;
}
/* Put anything which is on the parmdecls chain and which is
@@ -6093,7 +6102,7 @@ store_parm_decls ()
TREE_TYPE (parm) = error_mark_node;
}
- if (DECL_RESULT (parm) == 0)
+ if (! DECL_WEAK (parm))
{
error_with_decl (parm,
"declaration for parameter `%s' but no such parameter");
@@ -6309,7 +6318,7 @@ combine_parm_decls (specparms, parmlist, void_at_end)
tree types = 0;
for (parm = parmdecls; parm; parm = TREE_CHAIN (parm))
- DECL_RESULT (parm) = 0;
+ DECL_WEAK (parm) = 0;
for (parm = specparms; parm; parm = TREE_CHAIN (parm))
{
@@ -6325,7 +6334,7 @@ combine_parm_decls (specparms, parmlist, void_at_end)
/* If declaration already marked, we have a duplicate name.
Complain, and don't use this decl twice. */
- if (found && DECL_RESULT (found) != 0)
+ if (found && DECL_WEAK (found))
{
error_with_decl (found, "multiple parameters named `%s'");
found = 0;
@@ -6363,10 +6372,8 @@ combine_parm_decls (specparms, parmlist, void_at_end)
TREE_PURPOSE (parm) = found;
- /* Mark this decl as "already found" -- see test, above.
- It is safe to use DECL_RESULT for this
- since it is not used in PARM_DECLs or CONST_DECLs. */
- DECL_RESULT (found) = error_mark_node;
+ /* Mark this decl as "already found". */
+ DECL_WEAK (found) = 1;
}
/* Complain about any actual PARM_DECLs not matched with any names. */
@@ -6383,7 +6390,7 @@ combine_parm_decls (specparms, parmlist, void_at_end)
TREE_TYPE (parm) = error_mark_node;
}
- if (DECL_RESULT (parm) == 0)
+ if (! DECL_WEAK (parm))
{
error_with_decl (parm,
"declaration for parameter `%s' but no such parameter");
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 970be62..f53dd40 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,20 @@
+Sun Mar 26 20:15:26 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * class.c (check_field_decl): Fix typo.
+ (build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
+ (check_methods): Likewise.
+ (check_field_decls): Likewise.
+ Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
+ * cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
+ Use DECL_RESULT_FLD, not DECL_RESULT.
+ * decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
+ * lex.c (identifier_type): Likewise.
+ * pt.c (determine_specialization, lookup_template_class): Likewise.
+ (tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
+ (resolve_overloaded_unification, more_specialized): Likewise.
+ * semantics.c (finish_member_declaration): Likewise.
+ * typeck.c (build_x_function_call): Likewise.
+
2000-03-26 Mark Mitchell <mark@codesourcery.com>
* class.c (layout_empty_base): Handle empty bases with non-byte
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index fe636a2..1e48e89 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3758,7 +3758,7 @@ check_field_decl (field, t, cant_have_const_ctor,
tree fields;
for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
- if (TREE_CODE (field) == FIELD_DECL && !DECL_C_BIT_FIELD (field))
+ if (TREE_CODE (fields) == FIELD_DECL && !DECL_C_BIT_FIELD (field))
check_field_decl (fields, t, cant_have_const_ctor,
cant_have_default_ctor, no_const_asn_ref,
any_default_members);
@@ -3922,7 +3922,7 @@ check_field_decls (t, access_decls, empty_p,
/* If we've gotten this far, it's a data member, possibly static,
or an enumerator. */
- DECL_FIELD_CONTEXT (x) = t;
+ DECL_CONTEXT (x) = t;
/* ``A local class cannot have static data members.'' ARM 9.4 */
if (current_function_decl && TREE_STATIC (x))
@@ -3953,8 +3953,6 @@ check_field_decls (t, access_decls, empty_p,
if (type == error_mark_node)
continue;
- DECL_SAVED_INSNS (x) = 0;
-
/* When this goes into scope, it will be a non-local reference. */
DECL_NONLOCAL (x) = 1;
@@ -4110,7 +4108,6 @@ build_vtbl_or_vbase_field (name, assembler_name, type, class_type, fcontext,
DECL_ARTIFICIAL (field) = 1;
DECL_FIELD_CONTEXT (field) = class_type;
DECL_FCONTEXT (field) = fcontext;
- DECL_SAVED_INSNS (field) = 0;
DECL_ALIGN (field) = TYPE_ALIGN (type);
/* Return it. */
@@ -4447,7 +4444,6 @@ check_methods (t)
if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (x)))
continue;
- DECL_SAVED_INSNS (x) = 0;
check_for_override (x, t);
if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
cp_error_at ("initializer specified for non-virtual method `%D'", x);
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 9ccd28a..57c711f 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -2091,7 +2091,7 @@ struct lang_decl
/* In a VAR_DECL for a variable declared in a for statement,
this is the shadowed (local) variable. */
-#define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT(VAR_DECL_CHECK (NODE))
+#define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT_FLD(VAR_DECL_CHECK (NODE))
/* Points back to the decl which caused this lang_decl to be allocated. */
#define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
@@ -2709,7 +2709,7 @@ extern int flag_new_for_scope;
#define DECL_NTPARMS(NODE) \
TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
/* For function, method, class-data templates. */
-#define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT(NODE)
+#define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT_FLD(NODE)
/* For a static member variable template, the
DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
implicitly generated instantiations of the variable. There are no
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 2a2ca15..b779b7d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4051,12 +4051,12 @@ pushdecl (x)
if (oldlocal)
{
tree d = oldlocal;
+
while (oldlocal
&& TREE_CODE (oldlocal) == VAR_DECL
&& DECL_DEAD_FOR_LOCAL (oldlocal))
- {
- oldlocal = DECL_SHADOWED_FOR_VAR (oldlocal);
- }
+ oldlocal = DECL_SHADOWED_FOR_VAR (oldlocal);
+
if (oldlocal == NULL_TREE)
oldlocal = IDENTIFIER_NAMESPACE_VALUE (DECL_NAME (d));
}
@@ -4452,8 +4452,8 @@ push_using_directive (used)
want to be referenced by that name. It is then up to the users of
that name to decide what to do with that list.
- DECL may also be a TEMPLATE_DECL, with a FUNCTION_DECL in its DECL_RESULT
- slot. It is dealt with the same way.
+ DECL may also be a TEMPLATE_DECL, with a FUNCTION_DECL in its
+ DECL_TEMPLATE_RESULT. It is dealt with the same way.
FLAGS is a bitwise-or of the following values:
PUSH_LOCAL: Bind DECL in the current scope, rather than at
@@ -12436,7 +12436,7 @@ xref_tag (code_type_node, name, globalize)
&& template_class_depth (current_class_type) == 0)
/* Since GLOBALIZE is true, we're declaring a global
template, so we want this type. */
- ref = DECL_RESULT (ref);
+ ref = DECL_TEMPLATE_RESULT (ref);
if (ref && TREE_CODE (ref) == TYPE_DECL
&& TREE_CODE (TREE_TYPE (ref)) == code)
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index d90f472..bc329d8 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -3344,9 +3344,10 @@ identifier_type (decl)
tree decl;
{
tree t;
+
if (TREE_CODE (decl) == TEMPLATE_DECL)
{
- if (TREE_CODE (DECL_RESULT (decl)) == TYPE_DECL)
+ if (TREE_CODE (DECL_TEMPLATE_RESULT (decl)) == TYPE_DECL)
return PTYPENAME;
else if (looking_for_template)
return PFUNCNAME;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 0978ec9..bd4ec4e 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1105,7 +1105,7 @@ determine_specialization (template_id, decl, targs_out,
}
/* It was a specialization of a template. */
- targs = DECL_TI_ARGS (DECL_RESULT (TREE_VALUE (templates)));
+ targs = DECL_TI_ARGS (DECL_TEMPLATE_RESULT (TREE_VALUE (templates)));
if (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (targs))
{
*targs_out = copy_node (targs);
@@ -3699,7 +3699,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
d1 = DECL_NAME (template);
}
else if (TREE_CODE (d1) == TEMPLATE_DECL
- && TREE_CODE (DECL_RESULT (d1)) == TYPE_DECL)
+ && TREE_CODE (DECL_TEMPLATE_RESULT (d1)) == TYPE_DECL)
{
template = d1;
d1 = DECL_NAME (template);
@@ -4460,9 +4460,9 @@ tsubst_friend_function (decl, args)
DECL_PRIMARY_TEMPLATE (new_friend) = new_friend;
new_friend_is_defn
- = DECL_INITIAL (DECL_RESULT (new_friend)) != NULL_TREE;
+ = DECL_INITIAL (DECL_TEMPLATE_RESULT (new_friend)) != NULL_TREE;
new_friend_result_template_info
- = DECL_TEMPLATE_INFO (DECL_RESULT (new_friend));
+ = DECL_TEMPLATE_INFO (DECL_TEMPLATE_RESULT (new_friend));
}
else
{
@@ -4535,7 +4535,7 @@ tsubst_friend_function (decl, args)
tree t;
tree new_friend_args;
- DECL_TEMPLATE_INFO (DECL_RESULT (old_decl))
+ DECL_TEMPLATE_INFO (DECL_TEMPLATE_RESULT (old_decl))
= new_friend_result_template_info;
new_friend_args = TI_ARGS (new_friend_template_info);
@@ -5416,7 +5416,7 @@ tsubst_decl (t, args, type, in_decl)
plus the innermost args from the template decl. */
tree tmpl_args = DECL_CLASS_TEMPLATE_P (t)
? CLASSTYPE_TI_ARGS (TREE_TYPE (t))
- : DECL_TI_ARGS (DECL_RESULT (t));
+ : DECL_TI_ARGS (DECL_TEMPLATE_RESULT (t));
tree full_args;
full_args = tsubst_template_arg_vector (tmpl_args, args,
@@ -5448,7 +5448,7 @@ tsubst_decl (t, args, type, in_decl)
if (is_template_template_parm)
{
tree new_decl = tsubst (decl, args, /*complain=*/1, in_decl);
- DECL_RESULT (r) = new_decl;
+ DECL_TEMPLATE_RESULT (r) = new_decl;
TREE_TYPE (r) = TREE_TYPE (new_decl);
break;
}
@@ -5469,13 +5469,14 @@ tsubst_decl (t, args, type, in_decl)
/*complain=*/1, in_decl);
TREE_TYPE (r) = new_type;
CLASSTYPE_TI_TEMPLATE (new_type) = r;
- DECL_RESULT (r) = TYPE_MAIN_DECL (new_type);
+ DECL_TEMPLATE_RESULT (r) = TYPE_MAIN_DECL (new_type);
DECL_TI_ARGS (r) = CLASSTYPE_TI_ARGS (new_type);
}
else
{
tree new_decl = tsubst (decl, args, /*complain=*/1, in_decl);
- DECL_RESULT (r) = new_decl;
+
+ DECL_TEMPLATE_RESULT (r) = new_decl;
DECL_TI_TEMPLATE (new_decl) = r;
TREE_TYPE (r) = TREE_TYPE (new_decl);
DECL_TI_ARGS (r) = DECL_TI_ARGS (new_decl);
@@ -5546,8 +5547,9 @@ tsubst_decl (t, args, type, in_decl)
spec_args = tsubst (DECL_TI_ARGS (fn), args,
/*complain=*/1, in_decl);
- new_fn = tsubst (DECL_RESULT (most_general_template (fn)),
- spec_args, /*complain=*/1, in_decl);
+ new_fn
+ = tsubst (DECL_TEMPLATE_RESULT (most_general_template (fn)),
+ spec_args, /*complain=*/1, in_decl);
DECL_TI_TEMPLATE (new_fn) = fn;
register_specialization (new_fn, r,
innermost_args (spec_args));
@@ -5555,7 +5557,7 @@ tsubst_decl (t, args, type, in_decl)
/* Record this partial instantiation. */
register_specialization (r, t,
- DECL_TI_ARGS (DECL_RESULT (r)));
+ DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)));
}
break;
@@ -5699,7 +5701,7 @@ tsubst_decl (t, args, type, in_decl)
DECL_ARGUMENTS (r) = tsubst (DECL_ARGUMENTS (t), args,
/*complain=*/1, t);
DECL_MAIN_VARIANT (r) = r;
- DECL_RESULT (r) = NULL_TREE;
+ DECL_TEMPLATE_RESULT (r) = NULL_TREE;
TREE_STATIC (r) = 0;
TREE_PUBLIC (r) = TREE_PUBLIC (t);
@@ -7434,7 +7436,8 @@ instantiate_template (tmpl, targ_ptr)
}
/* substitute template parameters */
- fndecl = tsubst (DECL_RESULT (gen_tmpl), targ_ptr, /*complain=*/1, gen_tmpl);
+ fndecl = tsubst (DECL_TEMPLATE_RESULT (gen_tmpl),
+ targ_ptr, /*complain=*/1, gen_tmpl);
/* The DECL_TI_TEMPLATE should always be the immediate parent
template, not the most general template. */
DECL_TI_TEMPLATE (fndecl) = tmpl;
@@ -7860,7 +7863,8 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
if (TREE_CODE (fn) != TEMPLATE_DECL)
continue;
- subargs = get_bindings_overload (fn, DECL_RESULT (fn), expl_subargs);
+ subargs = get_bindings_overload (fn, DECL_TEMPLATE_RESULT (fn),
+ expl_subargs);
if (subargs)
{
elem = tsubst (TREE_TYPE (fn), subargs, /*complain=*/0,
@@ -8701,11 +8705,13 @@ more_specialized (pat1, pat2, explicit_args)
tree targs;
int winner = 0;
- targs = get_bindings_overload (pat1, DECL_RESULT (pat2), explicit_args);
+ targs
+ = get_bindings_overload (pat1, DECL_TEMPLATE_RESULT (pat2), explicit_args);
if (targs)
--winner;
- targs = get_bindings_overload (pat2, DECL_RESULT (pat1), explicit_args);
+ targs
+ = get_bindings_overload (pat2, DECL_TEMPLATE_RESULT (pat1), explicit_args);
if (targs)
++winner;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 9b2fa87..08d7774 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1990,8 +1990,8 @@ finish_member_declaration (decl)
= (current_access_specifier == access_protected_node);
if (TREE_CODE (decl) == TEMPLATE_DECL)
{
- TREE_PRIVATE (DECL_RESULT (decl)) = TREE_PRIVATE (decl);
- TREE_PROTECTED (DECL_RESULT (decl)) = TREE_PROTECTED (decl);
+ TREE_PRIVATE (DECL_TEMPLATE_RESULT (decl)) = TREE_PRIVATE (decl);
+ TREE_PROTECTED (DECL_TEMPLATE_RESULT (decl)) = TREE_PROTECTED (decl);
}
/* Mark the DECL as a member of the current class. */
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index c6c92b8f..522bc57 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2577,11 +2577,11 @@ build_x_function_call (function, params, decl)
if ((TREE_CODE (function) == FUNCTION_DECL
&& DECL_STATIC_FUNCTION_P (function))
|| (TREE_CODE (function) == TEMPLATE_DECL
- && DECL_STATIC_FUNCTION_P (DECL_RESULT (function))))
- return build_member_call(DECL_CONTEXT (function),
- template_id
- ? template_id : DECL_NAME (function),
- params);
+ && DECL_STATIC_FUNCTION_P (DECL_TEMPLATE_RESULT (function))))
+ return build_member_call (DECL_CONTEXT (function),
+ template_id
+ ? template_id : DECL_NAME (function),
+ params);
is_method = ((TREE_CODE (function) == TREE_LIST
&& current_class_type != NULL_TREE
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 2fe33c9..b73a359 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -386,7 +386,7 @@ ggc_mark_tree_children (t)
ggc_mark_tree (DECL_NAME (t));
ggc_mark_tree (DECL_CONTEXT (t));
ggc_mark_tree (DECL_ARGUMENTS (t));
- ggc_mark_tree (DECL_RESULT (t));
+ ggc_mark_tree (DECL_RESULT_FLD (t));
ggc_mark_tree (DECL_INITIAL (t));
ggc_mark_tree (DECL_ABSTRACT_ORIGIN (t));
ggc_mark_tree (DECL_ASSEMBLER_NAME (t));
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index f9a9709..6439423 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -347,34 +347,37 @@ print_node (file, prefix, node, indent)
fputs (" external", file);
if (DECL_REGISTER (node))
fputs (" regdecl", file);
- if (DECL_PACKED (node))
- fputs (" packed", file);
if (DECL_NONLOCAL (node))
fputs (" nonlocal", file);
- if (DECL_INLINE (node))
- fputs (" inline", file);
if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
fputs (" suppress-debug", file);
+ if (TREE_CODE (node) == FUNCTION_DECL && DECL_INLINE (node))
+ fputs (" inline", file);
if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node))
fputs (" built-in", file);
if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN_NONANSI (node))
fputs (" built-in-nonansi", file);
+ if (TREE_CODE (node) == FIELD_DECL && DECL_PACKED (node))
+ fputs (" packed", file);
if (TREE_CODE (node) == FIELD_DECL && DECL_BIT_FIELD (node))
fputs (" bit-field", file);
+
if (TREE_CODE (node) == LABEL_DECL && DECL_TOO_LATE (node))
fputs (" too-late", file);
+
if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
fputs (" in-text-section", file);
+ if (TREE_CODE (node) == PARM_DECL && DECL_TRANSPARENT_UNION (node))
+ fputs (" transparent-union", file);
+
if (DECL_VIRTUAL_P (node))
fputs (" virtual", file);
if (DECL_DEFER_OUTPUT (node))
fputs (" defer-output", file);
- if (DECL_TRANSPARENT_UNION (node))
- fputs (" transparent-union", file);
if (DECL_LANG_FLAG_0 (node))
fputs (" decl_0", file);
@@ -434,7 +437,7 @@ print_node (file, prefix, node, indent)
DECL_ABSTRACT_ORIGIN (node), indent + 4);
print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
- print_node (file, "result", DECL_RESULT (node), indent + 4);
+ print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
print_lang_decl (file, node, indent);
@@ -445,20 +448,18 @@ print_node (file, prefix, node, indent)
print_rtl (file, DECL_RTL (node));
}
- if (DECL_SAVED_INSNS (node) != 0)
+ if (TREE_CODE (node) == PARM_DECL && DECL_INCOMING_RTL (node) != 0)
{
indent_to (file, indent + 4);
- if (TREE_CODE (node) == PARM_DECL)
- {
- fprintf (file, "incoming-rtl ");
- print_rtl (file, DECL_INCOMING_RTL (node));
- }
- else if (TREE_CODE (node) == FUNCTION_DECL)
- {
- fprintf (file, "saved-insns ");
- fprintf (file, HOST_PTR_PRINTF,
- (char *) DECL_SAVED_INSNS (node));
- }
+ fprintf (file, "incoming-rtl ");
+ print_rtl (file, DECL_INCOMING_RTL (node));
+ }
+ else if (TREE_CODE (node) == FUNCTION_DECL
+ && DECL_SAVED_INSNS (node) != 0)
+ {
+ indent_to (file, indent + 4);
+ fprintf (file, "saved-insns ");
+ fprintf (file, HOST_PTR_PRINTF, (char *) DECL_SAVED_INSNS (node));
}
/* Print the decl chain only if decl is at second level. */
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 58ab3f5..7621e61 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -324,9 +324,10 @@ layout_decl (decl, known_align)
/* Force alignment required for the data type.
But if the decl itself wants greater alignment, don't override that.
Likewise, if the decl is packed, don't override it. */
- if (!(code == FIELD_DECL && DECL_BIT_FIELD (decl))
+ if (! (code == FIELD_DECL && DECL_BIT_FIELD (decl))
&& (DECL_ALIGN (decl) == 0
- || (! DECL_PACKED (decl) && TYPE_ALIGN (type) > DECL_ALIGN (decl))))
+ || (! (code == FIELD_DECL && DECL_PACKED (decl))
+ && TYPE_ALIGN (type) > DECL_ALIGN (decl))))
DECL_ALIGN (decl) = TYPE_ALIGN (type);
/* For fields, set the bit field type and update the alignment. */
@@ -342,7 +343,7 @@ layout_decl (decl, known_align)
/* See if we can use an ordinary integer mode for a bit-field.
Conditions are: a fixed size that is correct for another mode
and occupying a complete byte or bytes on proper boundary. */
- if (DECL_BIT_FIELD (decl)
+ if (code == FIELD_DECL && DECL_BIT_FIELD (decl)
&& TYPE_SIZE (type) != 0
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
&& GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT)
@@ -360,7 +361,7 @@ layout_decl (decl, known_align)
}
/* Turn off DECL_BIT_FIELD if we won't need it set. */
- if (DECL_BIT_FIELD (decl)
+ if (code == FIELD_DECL && DECL_BIT_FIELD (decl)
&& TYPE_MODE (type) == BLKmode && DECL_MODE (decl) == BLKmode
&& known_align > TYPE_ALIGN (type)
&& DECL_ALIGN (decl) >= TYPE_ALIGN (type)
@@ -376,7 +377,7 @@ layout_decl (decl, known_align)
/* If requested, warn about definitions of large data objects. */
if (warn_larger_than
- && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL)
+ && (code == VAR_DECL || code == PARM_DECL)
&& ! DECL_EXTERNAL (decl))
{
tree size = DECL_SIZE_UNIT (decl);
diff --git a/gcc/tree.h b/gcc/tree.h
index 029d836..6f78cd6 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1081,6 +1081,9 @@ struct tree_type
/* VAR_DECL and PARM_DECL reserve the arguments slot
for language-specific uses. */
#define DECL_ARGUMENTS(NODE) (DECL_CHECK (NODE)->decl.arguments)
+/* This field is used to reference anything in decl.result and is meant only
+ for use by the garbage collector. */
+#define DECL_RESULT_FLD(NODE) (DECL_CHECK (NODE)->decl.result)
/* In FUNCTION_DECL, holds the decl for the return value. */
#define DECL_RESULT(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.result)
/* For a TYPE_DECL, holds the "original" type. (TREE_TYPE has the copy.) */