Commit b64fca63 by Nathan Froyd Committed by Nathan Froyd

tree.c (build_function_type_list_1): Remove bogus assert condition.

gcc/
	* tree.c (build_function_type_list_1): Remove bogus assert condition.

gcc/fortran/
	* trans-types.c (gfc_init_types): Use build_function_type_list.
	(gfc_get_ppc_type): Likewise.
	* trans-decl.c (gfc_generate_constructors): Likewise.
	* f95-lang.c (build_builtin_fntypes): Likewise.
	(gfc_init_builtin_functions): Likewise.
	(DEF_FUNCTION_TYPE_0): Likewise.
	(DEF_FUNCTION_TYPE_1): Likewise.
	(DEF_FUNCTION_TYPE_2): Likewise.
	(DEF_FUNCTION_TYPE_3): Likewise.
	(DEF_FUNCTION_TYPE_4): Likewise.
	(DEF_FUNCTION_TYPE_5): Likewise.
	(DEF_FUNCTION_TYPE_6): Likewise.
	(DEF_FUNCTION_TYPE_7): Likewise.  Use ARG7.
	(DEF_FUNCTION_TYPE_VAR_0): Use build_varags_function_type_list.

From-SVN: r159491
parent 8748ad99
2010-05-17 Nathan Froyd <froydnj@codesourcery.com>
* tree.c (build_function_type_list_1): Remove bogus assert condition.
2010-05-17 Alan Modra <amodra@gmail.com>
* config/rs6000/rs6000.c (rs6000_emit_allocate_stack): Delete
......
2010-05-17 Nathan Froyd <froydnj@codesourcery.com
* trans-types.c (gfc_init_types): Use build_function_type_list.
(gfc_get_ppc_type): Likewise.
* trans-decl.c (gfc_generate_constructors): Likewise.
* f95-lang.c (build_builtin_fntypes): Likewise.
(gfc_init_builtin_functions): Likewise.
(DEF_FUNCTION_TYPE_0): Likewise.
(DEF_FUNCTION_TYPE_1): Likewise.
(DEF_FUNCTION_TYPE_2): Likewise.
(DEF_FUNCTION_TYPE_3): Likewise.
(DEF_FUNCTION_TYPE_4): Likewise.
(DEF_FUNCTION_TYPE_5): Likewise.
(DEF_FUNCTION_TYPE_6): Likewise.
(DEF_FUNCTION_TYPE_7): Likewise. Use ARG7.
(DEF_FUNCTION_TYPE_VAR_0): Use build_varags_function_type_list.
2010-05-17 Nathan Froyd <froydnj@cs.rice.edu>
* trans-array.c (gfc_trans_array_constructor_value): Use
......
......@@ -636,28 +636,23 @@ gfc_define_builtin (const char *name,
static void
build_builtin_fntypes (tree *fntype, tree type)
{
tree tmp;
/* type (*) (type) */
tmp = tree_cons (NULL_TREE, type, void_list_node);
fntype[0] = build_function_type (type, tmp);
fntype[0] = build_function_type_list (type, type, NULL_TREE);
/* type (*) (type, type) */
tmp = tree_cons (NULL_TREE, type, tmp);
fntype[1] = build_function_type (type, tmp);
/* type (*) (int, type) */
tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node);
tmp = tree_cons (NULL_TREE, type, tmp);
fntype[2] = build_function_type (type, tmp);
/* type (*) (void) */
fntype[3] = build_function_type (type, void_list_node);
/* type (*) (type, &int) */
tmp = tree_cons (NULL_TREE, type, void_list_node);
tmp = tree_cons (NULL_TREE, build_pointer_type (integer_type_node), tmp);
fntype[4] = build_function_type (type, tmp);
fntype[1] = build_function_type_list (type, type, type, NULL_TREE);
/* type (*) (type, int) */
tmp = tree_cons (NULL_TREE, type, void_list_node);
tmp = tree_cons (NULL_TREE, integer_type_node, tmp);
fntype[5] = build_function_type (type, tmp);
fntype[2] = build_function_type_list (type,
type, integer_type_node, NULL_TREE);
/* type (*) (void) */
fntype[3] = build_function_type_list (type, NULL_TREE);
/* type (*) (&int, type) */
fntype[4] = build_function_type_list (type,
build_pointer_type (integer_type_node),
type,
NULL_TREE);
/* type (*) (int, type) */
fntype[5] = build_function_type_list (type,
integer_type_node, type, NULL_TREE);
}
......@@ -721,7 +716,6 @@ gfc_init_builtin_functions (void)
tree func_double_doublep_doublep;
tree func_longdouble_longdoublep_longdoublep;
tree ftype, ptype;
tree tmp, type;
tree builtin_types[(int) BT_LAST + 1];
build_builtin_fntypes (mfunc_float, float_type_node);
......@@ -731,46 +725,39 @@ gfc_init_builtin_functions (void)
build_builtin_fntypes (mfunc_cdouble, complex_double_type_node);
build_builtin_fntypes (mfunc_clongdouble, complex_long_double_type_node);
tmp = tree_cons (NULL_TREE, complex_float_type_node, void_list_node);
func_cfloat_float = build_function_type (float_type_node, tmp);
func_cfloat_float = build_function_type_list (float_type_node,
complex_float_type_node,
NULL_TREE);
tmp = tree_cons (NULL_TREE, float_type_node, void_list_node);
func_float_cfloat = build_function_type (complex_float_type_node, tmp);
func_float_cfloat = build_function_type_list (complex_float_type_node,
float_type_node, NULL_TREE);
tmp = tree_cons (NULL_TREE, complex_double_type_node, void_list_node);
func_cdouble_double = build_function_type (double_type_node, tmp);
func_cdouble_double = build_function_type_list (double_type_node,
complex_double_type_node,
NULL_TREE);
tmp = tree_cons (NULL_TREE, double_type_node, void_list_node);
func_double_cdouble = build_function_type (complex_double_type_node, tmp);
func_double_cdouble = build_function_type_list (complex_double_type_node,
double_type_node, NULL_TREE);
tmp = tree_cons (NULL_TREE, complex_long_double_type_node, void_list_node);
func_clongdouble_longdouble =
build_function_type (long_double_type_node, tmp);
build_function_type_list (long_double_type_node,
complex_long_double_type_node, NULL_TREE);
tmp = tree_cons (NULL_TREE, long_double_type_node, void_list_node);
func_longdouble_clongdouble =
build_function_type (complex_long_double_type_node, tmp);
build_function_type_list (complex_long_double_type_node,
long_double_type_node, NULL_TREE);
ptype = build_pointer_type (float_type_node);
tmp = tree_cons (NULL_TREE, float_type_node,
tree_cons (NULL_TREE, ptype,
tree_cons (NULL_TREE, ptype, void_list_node)));
func_float_floatp_floatp =
build_function_type (void_type_node, tmp);
build_function_type_list (void_type_node, ptype, ptype, NULL_TREE);
ptype = build_pointer_type (double_type_node);
tmp = tree_cons (NULL_TREE, double_type_node,
tree_cons (NULL_TREE, ptype,
tree_cons (NULL_TREE, ptype, void_list_node)));
func_double_doublep_doublep =
build_function_type (void_type_node, tmp);
build_function_type_list (void_type_node, ptype, ptype, NULL_TREE);
ptype = build_pointer_type (long_double_type_node);
tmp = tree_cons (NULL_TREE, long_double_type_node,
tree_cons (NULL_TREE, ptype,
tree_cons (NULL_TREE, ptype, void_list_node)));
func_longdouble_longdoublep_longdoublep =
build_function_type (void_type_node, tmp);
build_function_type_list (void_type_node, ptype, ptype, NULL_TREE);
#include "mathbuiltins.def"
......@@ -847,28 +834,31 @@ gfc_init_builtin_functions (void)
BUILT_IN_HUGE_VALF, "__builtin_huge_valf", true);
/* lround{f,,l} and llround{f,,l} */
type = tree_cons (NULL_TREE, float_type_node, void_list_node);
tmp = build_function_type (long_integer_type_node, type);
gfc_define_builtin ("__builtin_lroundf", tmp, BUILT_IN_LROUNDF,
ftype = build_function_type_list (long_integer_type_node,
float_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_lroundf", ftype, BUILT_IN_LROUNDF,
"lroundf", true);
tmp = build_function_type (long_long_integer_type_node, type);
gfc_define_builtin ("__builtin_llroundf", tmp, BUILT_IN_LLROUNDF,
ftype = build_function_type_list (long_long_integer_type_node,
float_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_llroundf", ftype, BUILT_IN_LLROUNDF,
"llroundf", true);
type = tree_cons (NULL_TREE, double_type_node, void_list_node);
tmp = build_function_type (long_integer_type_node, type);
gfc_define_builtin ("__builtin_lround", tmp, BUILT_IN_LROUND,
ftype = build_function_type_list (long_integer_type_node,
double_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_lround", ftype, BUILT_IN_LROUND,
"lround", true);
tmp = build_function_type (long_long_integer_type_node, type);
gfc_define_builtin ("__builtin_llround", tmp, BUILT_IN_LLROUND,
ftype = build_function_type_list (long_long_integer_type_node,
double_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_llround", ftype, BUILT_IN_LLROUND,
"llround", true);
type = tree_cons (NULL_TREE, long_double_type_node, void_list_node);
tmp = build_function_type (long_integer_type_node, type);
gfc_define_builtin ("__builtin_lroundl", tmp, BUILT_IN_LROUNDL,
ftype = build_function_type_list (long_integer_type_node,
long_double_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_lroundl", ftype, BUILT_IN_LROUNDL,
"lroundl", true);
tmp = build_function_type (long_long_integer_type_node, type);
gfc_define_builtin ("__builtin_llroundl", tmp, BUILT_IN_LLROUNDL,
ftype = build_function_type_list (long_long_integer_type_node,
long_double_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_llroundl", ftype, BUILT_IN_LLROUNDL,
"llroundl", true);
/* These are used to implement the ** operator. */
......@@ -920,173 +910,125 @@ gfc_init_builtin_functions (void)
}
/* For LEADZ / TRAILZ. */
tmp = tree_cons (NULL_TREE, unsigned_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
ftype = build_function_type_list (integer_type_node,
unsigned_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_clz", ftype, BUILT_IN_CLZ,
"__builtin_clz", true);
tmp = tree_cons (NULL_TREE, long_unsigned_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
gfc_define_builtin ("__builtin_clzl", ftype, BUILT_IN_CLZL,
"__builtin_clzl", true);
tmp = tree_cons (NULL_TREE, long_long_unsigned_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
gfc_define_builtin ("__builtin_clzll", ftype, BUILT_IN_CLZLL,
"__builtin_clzll", true);
tmp = tree_cons (NULL_TREE, unsigned_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
gfc_define_builtin ("__builtin_ctz", ftype, BUILT_IN_CTZ,
"__builtin_ctz", true);
tmp = tree_cons (NULL_TREE, long_unsigned_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
ftype = build_function_type_list (integer_type_node,
long_unsigned_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_clzl", ftype, BUILT_IN_CLZL,
"__builtin_clzl", true);
gfc_define_builtin ("__builtin_ctzl", ftype, BUILT_IN_CTZL,
"__builtin_ctzl", true);
tmp = tree_cons (NULL_TREE, long_long_unsigned_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
ftype = build_function_type_list (integer_type_node,
long_long_unsigned_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_clzll", ftype, BUILT_IN_CLZLL,
"__builtin_clzll", true);
gfc_define_builtin ("__builtin_ctzll", ftype, BUILT_IN_CTZLL,
"__builtin_ctzll", true);
/* Other builtin functions we use. */
tmp = tree_cons (NULL_TREE, long_integer_type_node, void_list_node);
tmp = tree_cons (NULL_TREE, long_integer_type_node, tmp);
ftype = build_function_type (long_integer_type_node, tmp);
ftype = build_function_type_list (long_integer_type_node,
long_integer_type_node,
long_integer_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_expect", ftype, BUILT_IN_EXPECT,
"__builtin_expect", true);
tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
ftype = build_function_type (void_type_node, tmp);
ftype = build_function_type_list (void_type_node,
pvoid_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_free", ftype, BUILT_IN_FREE,
"free", false);
tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
ftype = build_function_type (pvoid_type_node, tmp);
ftype = build_function_type_list (pvoid_type_node,
size_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_malloc", ftype, BUILT_IN_MALLOC,
"malloc", false);
DECL_IS_MALLOC (built_in_decls[BUILT_IN_MALLOC]) = 1;
tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
tmp = tree_cons (NULL_TREE, size_type_node, tmp);
ftype = build_function_type (pvoid_type_node, tmp);
ftype = build_function_type_list (pvoid_type_node,
size_type_node, pvoid_type_node,
NULL_TREE);
gfc_define_builtin ("__builtin_realloc", ftype, BUILT_IN_REALLOC,
"realloc", false);
tmp = tree_cons (NULL_TREE, void_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
ftype = build_function_type_list (integer_type_node,
void_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_isnan", ftype, BUILT_IN_ISNAN,
"__builtin_isnan", true);
#define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
builtin_types[(int) ENUM] = VALUE;
#define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \
builtin_types[(int) ENUM] \
= build_function_type (builtin_types[(int) RETURN], \
void_list_node);
#define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \
builtin_types[(int) ENUM] \
= build_function_type_list (builtin_types[(int) RETURN], \
NULL_TREE);
#define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \
builtin_types[(int) ENUM] \
= build_function_type (builtin_types[(int) RETURN], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG1], \
void_list_node));
#define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \
builtin_types[(int) ENUM] \
= build_function_type \
(builtin_types[(int) RETURN], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG1], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG2], \
void_list_node)));
#define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
builtin_types[(int) ENUM] \
= build_function_type \
(builtin_types[(int) RETURN], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG1], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG2], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG3], \
void_list_node))));
= build_function_type_list (builtin_types[(int) RETURN], \
builtin_types[(int) ARG1], \
NULL_TREE);
#define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \
builtin_types[(int) ENUM] \
= build_function_type_list (builtin_types[(int) RETURN], \
builtin_types[(int) ARG1], \
builtin_types[(int) ARG2], \
NULL_TREE);
#define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
builtin_types[(int) ENUM] \
= build_function_type_list (builtin_types[(int) RETURN], \
builtin_types[(int) ARG1], \
builtin_types[(int) ARG2], \
builtin_types[(int) ARG3], \
NULL_TREE);
#define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
builtin_types[(int) ENUM] \
= build_function_type \
(builtin_types[(int) RETURN], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG1], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG2], \
tree_cons \
(NULL_TREE, \
builtin_types[(int) ARG3], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG4], \
void_list_node)))));
= build_function_type_list (builtin_types[(int) RETURN], \
builtin_types[(int) ARG1], \
builtin_types[(int) ARG2], \
builtin_types[(int) ARG3], \
builtin_types[(int) ARG4], \
NULL_TREE);
#define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
builtin_types[(int) ENUM] \
= build_function_type \
(builtin_types[(int) RETURN], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG1], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG2], \
tree_cons \
(NULL_TREE, \
builtin_types[(int) ARG3], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG4], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG5],\
void_list_node))))));
= build_function_type_list (builtin_types[(int) RETURN], \
builtin_types[(int) ARG1], \
builtin_types[(int) ARG2], \
builtin_types[(int) ARG3], \
builtin_types[(int) ARG4], \
builtin_types[(int) ARG5], \
NULL_TREE);
#define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
ARG6) \
builtin_types[(int) ENUM] \
= build_function_type \
(builtin_types[(int) RETURN], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG1], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG2], \
tree_cons \
(NULL_TREE, \
builtin_types[(int) ARG3], \
tree_cons \
(NULL_TREE, \
builtin_types[(int) ARG4], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG5], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG6],\
void_list_node)))))));
= build_function_type_list (builtin_types[(int) RETURN], \
builtin_types[(int) ARG1], \
builtin_types[(int) ARG2], \
builtin_types[(int) ARG3], \
builtin_types[(int) ARG4], \
builtin_types[(int) ARG5], \
builtin_types[(int) ARG6], \
NULL_TREE);
#define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
ARG6, ARG7) \
builtin_types[(int) ENUM] \
= build_function_type \
(builtin_types[(int) RETURN], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG1], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG2], \
tree_cons \
(NULL_TREE, \
builtin_types[(int) ARG3], \
tree_cons \
(NULL_TREE, \
builtin_types[(int) ARG4], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG5], \
tree_cons (NULL_TREE, \
builtin_types[(int) ARG6],\
tree_cons (NULL_TREE, \
builtin_types[(int) ARG6], \
void_list_node))))))));
= build_function_type_list (builtin_types[(int) RETURN], \
builtin_types[(int) ARG1], \
builtin_types[(int) ARG2], \
builtin_types[(int) ARG3], \
builtin_types[(int) ARG4], \
builtin_types[(int) ARG5], \
builtin_types[(int) ARG6], \
builtin_types[(int) ARG7], \
NULL_TREE);
#define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \
builtin_types[(int) ENUM] \
= build_function_type (builtin_types[(int) RETURN], NULL_TREE);
= build_varargs_function_type_list (builtin_types[(int) RETURN], \
NULL_TREE);
#define DEF_POINTER_TYPE(ENUM, TYPE) \
builtin_types[(int) ENUM] \
= build_pointer_type (builtin_types[(int) TYPE]);
......
......@@ -4633,8 +4633,7 @@ gfc_generate_constructors (void)
return;
fnname = get_file_function_name ("I");
type = build_function_type (void_type_node,
gfc_chainon_list (NULL_TREE, void_type_node));
type = build_function_type_list (void_type_node, NULL_TREE);
fndecl = build_decl (input_location,
FUNCTION_DECL, fnname, type);
......
......@@ -870,7 +870,7 @@ gfc_init_types (void)
ppvoid_type_node = build_pointer_type (pvoid_type_node);
pchar_type_node = build_pointer_type (gfc_character1_type_node);
pfunc_type_node
= build_pointer_type (build_function_type (void_type_node, NULL_TREE));
= build_pointer_type (build_function_type_list (void_type_node, NULL_TREE));
gfc_array_index_type = gfc_get_int_type (gfc_index_integer_kind);
/* We cannot use gfc_index_zero_node in definition of gfc_array_range_type,
......@@ -1934,7 +1934,7 @@ gfc_get_ppc_type (gfc_component* c)
else
t = void_type_node;
return build_pointer_type (build_function_type (t, NULL_TREE));
return build_pointer_type (build_function_type_list (t, NULL_TREE));
}
......
......@@ -7330,7 +7330,7 @@ build_function_type_list_1 (bool vaargs, tree return_type, va_list argp)
last = args;
if (args != NULL_TREE)
args = nreverse (args);
gcc_assert (args != NULL_TREE && last != void_list_node);
gcc_assert (last != void_list_node);
}
else if (args == NULL_TREE)
args = void_list_node;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment