decl.c (grokparms): Don't even function types of `void' type, either.

* decl.c (grokparms): Don't even function types of `void' type,
	either.
	* mangle.c (write_type): Don't crash when confronted with the
	error_mark_node.

From-SVN: r37555
This commit is contained in:
Mark Mitchell 2000-11-19 04:56:45 +00:00 committed by Mark Mitchell
parent b35431cf07
commit 04f3dc2b03
3 changed files with 54 additions and 42 deletions

View File

@ -1,5 +1,10 @@
2000-11-18 Mark Mitchell <mark@codesourcery.com>
* decl.c (grokparms): Don't even function types of `void' type,
either.
* mangle.c (write_type): Don't crash when confronted with the
error_mark_node.
* decl.c (grokparms): Don't create parameters of `void' type.
2000-11-17 Zack Weinberg <zack@wolery.stanford.edu>

View File

@ -12025,51 +12025,55 @@ grokparms (first_parm)
/* It's not a good idea to actually create parameters of
type `void'; other parts of the compiler assume that a
void type terminates the parameter list. */
type = error_mark_node;
TREE_TYPE (decl) = error_mark_node;
}
/* Top-level qualifiers on the parameters are
ignored for function types. */
type = TYPE_MAIN_VARIANT (type);
if (TREE_CODE (type) == METHOD_TYPE)
{
cp_error ("parameter `%D' invalidly declared method type", decl);
type = build_pointer_type (type);
TREE_TYPE (decl) = type;
}
else if (TREE_CODE (type) == OFFSET_TYPE)
{
cp_error ("parameter `%D' invalidly declared offset type", decl);
type = build_pointer_type (type);
TREE_TYPE (decl) = type;
}
else if (abstract_virtuals_error (decl, type))
any_error = 1; /* Seems like a good idea. */
else if (POINTER_TYPE_P (type))
{
/* [dcl.fct]/6, parameter types cannot contain pointers (references)
to arrays of unknown bound. */
tree t = type;
while (POINTER_TYPE_P (t)
|| (TREE_CODE (t) == ARRAY_TYPE
&& TYPE_DOMAIN (t) != NULL_TREE))
t = TREE_TYPE (t);
if (TREE_CODE (t) == ARRAY_TYPE)
cp_error ("parameter `%D' includes %s to array of unknown bound `%T'",
decl, TYPE_PTR_P (type) ? "pointer" : "reference", t);
}
DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
if (PROMOTE_PROTOTYPES
&& (TREE_CODE (type) == INTEGER_TYPE
|| TREE_CODE (type) == ENUMERAL_TYPE)
&& TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
DECL_ARG_TYPE (decl) = integer_type_node;
if (!any_error && init)
init = check_default_argument (decl, init);
else
init = NULL_TREE;
if (type != error_mark_node)
{
/* Top-level qualifiers on the parameters are
ignored for function types. */
type = TYPE_MAIN_VARIANT (type);
if (TREE_CODE (type) == METHOD_TYPE)
{
cp_error ("parameter `%D' invalidly declared method type", decl);
type = build_pointer_type (type);
TREE_TYPE (decl) = type;
}
else if (TREE_CODE (type) == OFFSET_TYPE)
{
cp_error ("parameter `%D' invalidly declared offset type", decl);
type = build_pointer_type (type);
TREE_TYPE (decl) = type;
}
else if (abstract_virtuals_error (decl, type))
any_error = 1; /* Seems like a good idea. */
else if (POINTER_TYPE_P (type))
{
/* [dcl.fct]/6, parameter types cannot contain pointers
(references) to arrays of unknown bound. */
tree t = type;
while (POINTER_TYPE_P (t)
|| (TREE_CODE (t) == ARRAY_TYPE
&& TYPE_DOMAIN (t) != NULL_TREE))
t = TREE_TYPE (t);
if (TREE_CODE (t) == ARRAY_TYPE)
cp_error ("parameter `%D' includes %s to array of unknown bound `%T'",
decl, TYPE_PTR_P (type) ? "pointer" : "reference", t);
}
DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
if (PROMOTE_PROTOTYPES
&& (TREE_CODE (type) == INTEGER_TYPE
|| TREE_CODE (type) == ENUMERAL_TYPE)
&& TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
DECL_ARG_TYPE (decl) = integer_type_node;
if (!any_error && init)
init = check_default_argument (decl, init);
else
init = NULL_TREE;
}
TREE_CHAIN (decl) = decls;
decls = decl;

View File

@ -1245,6 +1245,9 @@ write_type (type)
MANGLE_TRACE_TREE ("type", type);
if (type == error_mark_node)
return;
if (find_substitution (type))
return;