aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-tree.def
AgeCommit message (Collapse)AuthorFilesLines
2007-03-30re PR c++/26099 (support for type traits is not available)Paolo Carlini1-0/+5
gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-17* cp-tree.def, parser.c, pt.c: Fix comment typos.Kazu Hirata1-1/+1
From-SVN: r123024
2007-03-10re PR c++/20599 (variadic template support)Douglas Gregor1-0/+70
2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-02-15tree.h (enum tree_code_class): Add tcc_vl_exp.Sandra Loosemore1-4/+6
2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2006-11-21cp-tree.def (STATIC_ASSERT): New.Douglas Gregor1-0/+8
2006-11-21 Douglas Gregor <doug.gregor@gmail.com> * cp-tree.def (STATIC_ASSERT): New. * cp-objcp-common.c (cp_tree_size): Handle STATIC_ASSERT. * error.c (dump_decl): Handle STATIC_ASSERT. * cp-tree.h (STATIC_ASSERT_CONDITION): New. (STATIC_ASSERT_MESSAGE): New. (STATIC_ASSERT_SOURCE_LOCATION): New. (struct tree_static_assert): New. (enum cp_tree_node_structure_enum): Add TS_CP_STATIC_ASSERT. (union lang_tree_node): Add static_assertion. (finish_static_assert): Declare. * cxx-pretty-print.c (pp_cxx_statement): Handle STATIC_ASSERT. (pp_cxx_declaration): Handle STATIC_ASSERT. * pt.c (instantiate_class_template): Handle STATIC_ASSERT members. (tsubst_expr): Handle STATIC_ASSERT statements. * semantics.c (finish_static_assert): New. * lex.c (D_CPP0X): New. (reswords): Add static_assert keyword. (init_reswords): If not flag_cpp0x, mask out C++0x keywords. * parser.c (cp_parser_block_declaration): Parse static assertions. (cp_parser_static_assert): New. (cp_parser_member_declaration): Parse static assertions. From-SVN: r119066
2006-06-14* cp-tree.def: Fix typo.Gabriel Dos Reis1-1/+1
From-SVN: r114649
2005-09-16re PR c++/23357 (ICE with __alignof__ on template arguments)Jason Merrill1-2/+2
PR c++/23357 * cp-tree.def (SIZEOF_EXPR, ALIGNOF_EXPR): Change code class to tcc_expression. From-SVN: r104340
2005-09-09dbxout.c: Include expr.h.Richard Henderson1-4/+0
* dbxout.c: Include expr.h. (dbxout_global_decl): Don't suppress for DECL_RTL unset. (dbxout_symbol): Handle DECL_VALUE_EXPR. * Makefile.in (dbxout.o): Add EXPR_H. cp/ * cp-tree.def (ALIAS_DECL): Remove. * cp-lang.c (cp_init_ts): Remove support for it. * error.c (dump_decl): Likewise. * name-lookup.c (pushdecl): Likewise. * semantics.c (finish_id_expression): Likewise. * decl2.c (build_anon_union_vars): Use a VAR_DECL with DECL_VALUE_EXPR instead. From-SVN: r104106
2005-06-25Update FSF address.Kelley Cook1-2/+2
From-SVN: r101312
2005-06-15Canonicalize whitespace.Mike Stump1-8/+8
From-SVN: r100965
2005-06-14Remove extra white spacing at end of lines.Mike Stump1-16/+16
From-SVN: r100952
2005-06-08re PR c++/19497 (Invalid declaration in template diagnosed too late)Nathan Sidwell1-4/+4
cp: PR c++/19497 * cp-tree.def (USING_DECL): Update documentation. * cp-tree.h (DECL_DEPENDENT_P): New. (USING_DECL_DECLS, USING_DECL_SCOPE): New. * class.c (handle_using_decl): Move most of the processing to ... * name-lookup.c (do_class_using_decl): ... here. Make stricter. (push_using_decl): Use USING_DECL_SCOPE. (cp_emit_debug_info_for_using): Make extern. * cxx-pretty-print.c (pp_cxx_statement) <USING_DECL case>: Adjust. * name-lookup.h (cp_emit_debug_info_for_using): Declare. * pt.c (tsubst_decl) <USING_DECL case>: Use do_class_using_decl when tsubsting. (tsubst_expr): Use USING_DECL_SCOPE. * search.c (lookup_field_1): Use DECL_DEPENDENT_P. * semantics.c (finish_member_declaration): Likewise. testsuite: PR c++/19497 * g++.dg/inherit/using5.C: New. * g++.dg/inherit/using6.C: New. From-SVN: r100757
2005-06-07cp-tree.def (DEFAULT_ARG): Adjust documentation.Nathan Sidwell1-3/+3
* cp-tree.def (DEFAULT_ARG): Adjust documentation. * cp-tree.h (DEFARG_INSTANTIATIONS): New. (struct tree_default_arg): Add instantiations member. * parser.c (cp_parser_late_parsing_default_args): Adjust to use a VEC. * pt.c (tsubst_arg_types): Likewise. From-SVN: r100707
2005-06-06re PR c++/21903 (Default argument of template function causes a compile-time ↵Nathan Sidwell1-1/+3
error) cp: PR 21903 * cp-tree.def (DEFAULT_ARG): Document TREE_CHAIN use. * parser.c (cp_parser_late_parsing_default_args): Propagate parsed argument to any early instantiations. * pt.c (tsubst_arg_types): Chain early instantiation of default arg. testsuite: PR 21903 * g++.dg/parse/defarg9.C: New. From-SVN: r100669
2005-05-27cp-tree.def (UNARY_PLUS_EXPR): New C++ unary tree code.Roger Sayle1-0/+4
* cp-tree.def (UNARY_PLUS_EXPR): New C++ unary tree code. * parser.c (cp_parser_unary_expression): Use UNARY_PLUS_EXPR instead of CONVERT_EXPR. (cp_parser_unary_expression): Likewise. * typeck.c (build_unary_op): Likewise. * call.c (add_builtin_candidate, build_new_op): Likewise. * error.c (dump_expr): Likewise. * pt.c (tsubst_copy, tsubst_copy_and_build): Likewise. * decl.c (ambi_op_p, grok_op_properties): Likewise. * dump.c (dump_op): Likewise. * lex.c (init_operators): Likewise. * operators.def ("+"): Likewise. * cp-gimplify.c (cp_gimplify_expr): Handle UNARY_PLUS_EXPR like a conversion, if the result and argument types differ. * tree.c (fold_if_not_in_template): Fold UNARY_PLUS_EXPR much like a NOP_EXPR when !processing_template_decl. * cxx-pretty-print.c (pp_cxx_cast_expression): Prototype. (pp_cxx_unary_expression): Handle new UNARY_PLUS_EXPR tree code. Co-Authored-By: Giovanni Bajo <giovannibajo@gcc.gnu.org> From-SVN: r100285
2005-04-25c-common.def (EXPR_STMT): Remove, moved to C++ frontend.Ian Lance Taylor1-0/+4
./ * c-common.def (EXPR_STMT): Remove, moved to C++ frontend. * c-common.h (EXPR_STMT_EXPR): Don't define. (c_common_stmt_codes): Don't define. * c-dump.c (c_dump_tree): Remove EXPR_STMT case. * c-gimplify.c (gimplify_expr_stmt): Remove. (c_gimplify_expr): Remove EXPR_STMT case. * c-objc-common.c (c_objc_common_init): Remove stmt_codes and call to INIT_STATEMENT_CODES. * c-pretty-print.c (pp_c_statement): Just call dump_generic_node. cp/ * cp-tree.def: Add EXPR_STMT. * cp-tree.h (cp_stmt_codes): Add EXPR_STMT. (EXPR_STMT_EXPR): Define. * cp-gimplify.c: Include "flags.h". (gimplify_expr_stmt): New static function. (cp_gimplify_expr): Handle EXPR_STMT. * cxx-pretty-print.c (pp_cxx_statement): Use pp_cxx_expression rather than pp_expression. (pp_cxx_statement): Handle EXPR_STMT. * dump.c (cp_dump_tree): Handle EXPR_STMT. * lex.c (cxx_init): Don't use c_common_stmt_codes in stmt_codes initializer. From-SVN: r98731
2005-04-24cp-tree.def (USING_STMT): Change class to tcc_statement.Ian Lance Taylor1-12/+12
* cp-tree.def (USING_STMT): Change class to tcc_statement. (TRY_BLOCK, EH_SPEC_BLOCK, HANDLER, CLEANUP_STMT): Likewise. (IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT): Likewise. (BREAK_STMT, CONTINUE_STMT, SWITCH_STMT): Likewise. From-SVN: r98659
2005-04-20c-common.def: Remove STMT_EXPR (moved to cp/cp-tree.def).Ian Lance Taylor1-0/+5
./ * c-common.def: Remove STMT_EXPR (moved to cp/cp-tree.def). * c-common.h (STMT_EXPR_STMT): Don't define. (STMT_EXPR_NO_SCOPE): Don't define. * c-dump.c (c_dump_tree): Don't handle STMT_EXPR. * c-pretty-print.c (pp_c_primary_expression): Likewise. (pp_c_expression): Likewise. cp/ * cp-tree.def: Add STMT_EXPR. * cp-tree.h (STMT_EXPR_NO_SCOPE): Define. (STMT_EXPR_STMT): Define. * cxx-pretty-print.c (pp_cxx_primary_expression): Handle STMT_EXPR. (pp_cxx_expression): Likewise. (pp_cxx_statement): Call pp_cxx_statement, not pp_statement. * dump.c (cp_dump_tree): Handle STMT_EXPR. From-SVN: r98469
2005-04-17c-common.def (SIZEOF_EXPR, [...]): Remove.Ian Lance Taylor1-0/+10
./ * c-common.def (SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR): Remove. * c-common.c (c_sizeof_or_alignof_type): Change second parameter from enum tree_code op to bool is_sizeof. * c-common.h (c_sizeof_or_alignof_type): Update declaration. (c_sizeof, c_alignof): Update calls to c_sizeof_or_alignof_type. * c-pretty-print.c (pp_c_postfix_expression): Remove ARROW_EXPR case. (pp_c_unary_expression): Remove SIZEOF_EXPR and ALIGNOF_EXPR cases. (pp_c_expression): Remove ARROW_EXPR, SIZEOF_EXPR, and ALIGNOF_EXPR cases. cp/ * cp-tree.def: Add SIZEOF_EXPR, ARROW_EXPR and ALIGNOF_EXPR. * cxx-pretty-print.c (pp_cxx_postfix_expression): Handle ARROW_EXPR. (pp_cxx_unary_expression): Handle SIZEOF_EXPR and ALIGNOF_EXPR. (pp_cxx_expression): Handle ARROW_EXPR, SIZEOF_EXPR, and ALIGNOF_EXPR. * typeck.c (cxx_sizeof_or_alignof_type): Update call to c_sizeof_or_alignof_type for change in parameter type. From-SVN: r98297
2005-04-09c-common.def: Move FOR_STMT...Ian Lance Taylor1-1/+23
./ * c-common.def: Move FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT to cp/cp-tree.def. * c-common.h (WHILE_COND, WHILE_BODY): Move to cp/cp-tree.h. (DO_COND, DO_BODY): Likewise. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Likewise. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Likewise. (c_common_stmt_codes): Remove FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT. (build_continue_stmt, build_break_stmt): Don't declare. (c_do_switch_warnings): Update declaration. * c-gimplify.c (enum bc_t): Remove. (struct c_gimplify_ctx, ctxp): Remove. (push_context, pop_context): Remove static functions. (c_genericize): Don't call push_context or pop_context. (begin_bc_block, finish_bc_block): Remove static functions. (build_bc_goto): Likewise. (gimplify_c_loop): Likewise. (gimplify_for_stmt, gimplify_while_stmt): Likewise. (gimplify_do_stmt, gimplify_switch_stmt): Likewise. (c_gimplify_expr): Remove handling of FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. * c-common.c (c_do_switch_warnings): Rename from c_do_switch_warnings_1. (c_do_switch_warnings) [old version]: Remove. (c_do_switch_expr_warnings): Remove. * c-typeck.c (c_finish_case): Call new c_do_switch_warnings function instead of c_do_switch_expr_warnings. * c-dump.c (c_dump_tree): Remove handling of BREAK_STMT, CONTINUE_STMT, DO_STMT, FOR_STMT, SWITCH_STMT, and WHILE_STMT. * c-pretty-print.c (pp_c_statement): Likewise. * c-semantics.c (build_break_stmt, build_continue_stmt): Remove. cp/ * cp-tree.def: Define FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. * cp-tree.h (cp_stmt_codes): Add FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. (WHILE_COND, WHILE_BODY): Define. (DO_COND, DO_BODY): Define. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Define. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Define. * cp-gimplify.c (enum bc_t): Define. (struct cp_gimplify_ctx, ctxp): Define. (push_context, pop_context): New static functions. (begin_bc_block, finish_bc_block): New static functions. (build_bc_goto): New static function. (gimplify_cp_loop, gimplify_for_stmt): New static functions. (gimplify_while_stmt, gimplify_do_stmt): Likewise. (gimplify_switch_stmt): Likewise. (cp_gimplify_expr): Handle FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. (cp_genericize): Call push_context and pop_context. * semantics.c (finish_break_stmt): Just call build_stmt (BREAK_STMT) rather than build_break_stmt. (finish_continue_stmt): Corresponding change. * decl.c (pop_switch): Update call to c_do_switch_warnings for new parameters. * cxx-pretty-print.c (pp_cxx_statement): Handle SWITCH_STMT, WHILE_STMT, DO_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT. * dump.c (cp_dump_tree): Likewise. From-SVN: r97885
2005-04-08re PR c++/20145 (template "class has virtual functions ... " is not ↵Mark Mitchell1-0/+1
suppressed with -isystem) * cp-tree.def (TINST_LEVEL): Document TINST_IN_SYSTEM_HEADER_P. * cp-tree.h (struct tinst_level): Add in_system_header_p. (TINST_IN_SYSTEM_HEADER_P): New macro. (make_tinst_level): Remove. * pt.c (lookup_template_class): Preserve DECL_IN_SYSTEM_HEADER on the instantiated class. (push_tinst_level): Do not use make_tinst_level. Set TINST_IN_SYSTEM_HEADER_P. (pop_tinst_level): Likewise. (instantiate_class_template): Set in_system_header. (instantiate_pending_templates): Likewise. * tree.c (make_tinst_level): Remove. PR c++/20145 * g++.dg/warn/Wdtor1.C: New test. From-SVN: r97854
2005-04-06re PR c++/20734 (rejects valid pointer to member)Mark Mitchell1-4/+2
PR c++/20734 * cp-tree.def (OFFSET_REF): Correct comments. * init.c (build_offset_ref): Remove misleading comment. * typeck.c (build_unary_op): Handle pointer-to-member creation here, rather than ... (unary_complex_lvalue): ... here. PR c++/20734 * g++.dg/template/ptrmem13.C: New test. From-SVN: r97696
2005-02-11* cp-tree.def, except.c, ptree.c: Update copyright.Kazu Hirata1-1/+1
From-SVN: r94881
2005-02-09re PR c++/19733 (ICE on invalid destructor call)Mark Mitchell1-1/+12
PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2004-12-21system.c (IN_RANGE): Use plain unsigned, not unsigned HOST_WIDE_INT.Nathan Sidwell1-14/+19
* system.c (IN_RANGE): Use plain unsigned, not unsigned HOST_WIDE_INT. * tree.def (VOID_TYPE, INTEGER_TYPE, REAL_TYPE, COMPLEX_TYPE, VECTOR_TYPE, OFFSET_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, CHAR_TYPE, POINTER_TYPE, REFERENCE_TYPE, METHOD_TYPE, FUNCTION_TYPE, FILE_TYPE, ARRAY_TYPE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE): Reorder for better code efficiency. (CONST_DECL, TYPE_DECL, VAR_DECL, FIELD_DECL, PARM_DECL): Likewise. (INDIRECT_REF, ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF): Likewise. * tree.h (INDIRECT_REF_P): Reorder checks for better optimization. (IS_EXPR_CODE_CLASS): Use IN_RANGE. (INTEGRAL_TYPE_P, FLOAT_TYPE_P): Reorder checks for better optimization. * cp/cp-tree.def (TEMPLATE_TYPE_PARM, BOUND_TEMPLATE_TEMPLATE_PARM, TYPE_OF_TYPE, TYPENAME_TYPE): Reorder for better code efficiency. * cp/cp-tree.h (CLASS_TYPE_P): Short circuit IS_AGGR_TYPE check. (CAN_HAVE_FULL_LANG_DECL_P): Reorder for better optimization. (INTEGRAL_CODE_P, CP_INTEGRAL_TYPE_P, INTEGRAL_OR_ENUMERATION_TYPE_P, SCALAR_TYPE_P, CP_AGGREGATE_TYPE_P, TYPE_PTROB_P, TYPE_REF_OBJ_P, TYPE_PTROBV_P): Likewise. From-SVN: r92463
2004-11-29re PR c++/18368 (C++ error message regression)Mark Mitchell1-3/+1
PR c++/18368 * parser.c (cp_parser_check_for_definition_in_return_type): Take the defined type as a parameter, and inform the user about the possibility of a missing semicolon. (cp_parser_explicit_instantiation): Adjust call to cp_parser_check_for_definition_in_return_type. (cp_parser_init_declarator): Likewise. (cp_parser_member_declaration): Likewise. PR c++/18674 * cp-tree.def (TYPENAME_TYPE): Remove discussion of implicit typename from comments. * cp-tree.h (TYPENAME_IS_ENUM_P): New macro. (TYPENAME_IS_CLASS_P): Likewise. (make_typename_type): Change prototype. * decl.c (struct_typename_info): New type. (typename_compare): Expect the second argument to be a typename_info, not a tree. (build_typename_type): Add tag_type parameter. Do not create a new type until necessary. (make_typename_type): Add tag_type parameter. * error.c (TYPENAME_TYPE): Print tags other than "typename" if appropriate. * friend.c (make_friend_class): Adjust call to make_typename_type. * parser.c (cp_parser_make_typename_type): Likewise. (cp_parser_primary_expression): Adjust call to cp_parser_lookup_name. (cp_parser_unqualified_id): Adjust calls to cp_parser_class_name. (cp_parser_class_or_namespace_name): Likewise. (cp_parser_postfix_expression): Adjust calls to make_typename_type. (cp_parser_mem_initializer_id): Adjust calls to cp_parser_class_name. (cp_parser_type_parameter): Adjust calls to cp_parser_lookup_name. (cp_parser_template_name): Likewise. (cp_parser_template_argument): Likewise. (cp_parser_type_name): Adjust call to cp_parser_class_name. (cp_parser_elaborated_type_specifier): Adjust calls to make_typename_type and cp_parser_lookup_name. (cp_parser_namespace_name): Likewise. (cp_parser_class_name): Replace type_p parameter with tag_type. Adjust calls to make_typename_type and cp_parser_lookup_name. (cp_parser_class_head): Adjust calls to cp_parser_class_name. (cp_parser_base_specifier): Likewise. (cp_parser_lookup_name): Replace is_type parameter with tag_type. Adjust calls to make_typename_type and lookup_qualified_name. (cp_parser_lookup_name_simple): Adjust call to cp_parser_lookup_name. (cp_parser_constructor_declarator_p): Adjust call to cp_parser_class_name. * pt.c (convert_template_argument): Adjust all to make_typename_type. (tsubst_decl): Do not pre-substitute the type of the declaration. (tsubst): Hand off declarations more quickly. Adjust call to make_typename_type. PR c++/18512 * parser.c (cp_parser_postfix_dot_deref_expression): Robustify. PR c++/18674 * g++.old-deja/g++.brendan/crash16.C: Adjust error messages. * g++.old-deja/g++.law/ctors5.C: Likewise. * g++.old-deja/g++.other/crash25.C: Likewise. PR c++/18674 * g++.dg/template/error16.C: New test. PR c++/18512 * g++.dg/template/crash29.C: New test. From-SVN: r91483
2004-09-17alias.c (find_base_decl): Remove unreachable case '3' block.Jeffrey D. Oldham1-47/+48
2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-08-27cp-tree.def (OFFSETOF_EXPR): New.Richard Henderson1-0/+3
* cp-tree.def (OFFSETOF_EXPR): New. * parser.c (cp_parser_builtin_offsetof): Either built an OFFSETOF_EXPR, or call fold_offsetof immediately. * pt.c (tsubst_expr): Handle OFFSETOF_EXPR. From-SVN: r86679
2004-07-20cp-tree.def (TINST_LEVEL): Make it an 'x' node.Steven Bosscher1-2/+3
* cp-tree.def (TINST_LEVEL): Make it an 'x' node. * cp-tree.h (tinst_level_t): New tree type. (union lang_tree_node): Handle it. (TINST_LOCATION): New accessor macro. (make_tinst_level): New prototype. * cp-lang.c (cp_tree_size): Handle TINST_LEVEL. * decl.c (cp_tree_node_structure): Likewise. * error.c (print_instantiation_full_context): Use TINST_LOCATION. (print_instantiation_partial_context): Likewise. * pt.c (pop_tinst_level): Likewise. (push_tinst_level): Use make_tinst_level. * tree.c (make_tinst_level): New function. (cp_walk_subtrees): Walk TINST_DECL for a TINST_LEVEL node. From-SVN: r84977
2004-06-22cp-tree.def (NEW_EXPR): Add a fourth slot.Mark Mitchell1-2/+3
* cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-20c-common.def (IF_STMT, [...]): Move to cp-tree.def.Richard Henderson1-0/+14
* c-common.def (IF_STMT, CLEANUP_STMT): Move to cp-tree.def. * c-common.h (IF_COND, THEN_CLAUSE, ELSE_CLAUSE, CLEANUP_BODY, CLEANUP_EXPR, CLEANUP_DECL): Move to cp-tree.h. (c_common_stmt_codes): Remove IF_STMT, CLEANUP_STMT. * c-dump.c (c_dump_tree): Move IF_STMT, CLEANUP_STMT to cp_dump_tree. * c-pretty-print.c (pp_c_statement): Similarly. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts, gimplify_if_stmt): Move to cp-gimplify.c. (c_genericize, c_gimplify_expr): Don't call them. * c-semantics.c (push_cleanup): Move to cp/semantics.c. * c-typeck.c (push_cleanup): New. (c_begin_if_stmt, c_finish_if_cond, c_finish_then, c_finish_else, c_finish_if_stmt): Use COND_EXPR. * tree.h (CLEANUP_EH_ONLY): Update documentation. cp/ * cp-tree.def (CLEANUP_STMT, IF_STMT): Move from c-common.def. * cp-gimplify.c (gimplify_if_stmt): Move from c-gimplify.c. (cp_gimplify_expr): Call it. (gimplify_cleanup_stmt): Move from c-gimplify.c. (cp_genericize): New. * decl.c (finish_function): Call it. * cp-tree.h (cp_stmt_codes): Add CLEANUP_STMT, IF_STMT. (CLEANUP_BODY, CLEANUP_EXPR, CLEANUP_DECL): Move from c-common.h. (IF_COND, THEN_CLAUSE, ELSE_CLAUSE): Likewise. (cp_genericize): Declare. * cxx-pretty-print.c (pp_cxx_statement): Add CLEANUP_STMT, IF_STMT. * dump.c (cp_dump_tree): Likewise. * semantics.c (push_cleanup): Move from c-semantics.c. From-SVN: r83407
2004-05-31call.c, [...]: Fix comment formatting.Kazu Hirata1-4/+4
* call.c, class.c, cp-tree.def, decl2.c, name-lookup.c, pt.c, typeck.c: Fix comment formatting. From-SVN: r82476
2004-05-13Merge tree-ssa-20020619-branch into mainline.Diego Novillo1-0/+9
From-SVN: r81764
2004-03-18cp-tree.def (TEMPLATE_TYPE_PARM, [...]): Update comments.Richard Kenner1-2/+2
* cp-tree.def (TEMPLATE_TYPE_PARM, TYPEOF_TYPE): Update comments. * cp-tree.h (NEW_EXPR_USE_GLOBAL, DELETE_EXPR_USE_GLOBAL): Add check. (DELETE_EXPR_USE_VEC, COMPOUND_EXPR_OVERLOADED): Likewise. (KOENIG_LOOKUP_P, PTRMEM_OK_P, TEMPLATE_TYPE_PARM_INDEX): Likewise. (TYPENAME_TYPE_FULLNAME): Add check and use type.values. (TYPEOF_TYPE_EXPR): New macro. From-SVN: r79645
2004-02-18cfgloop.h, [...]: Update copyright.Kazu Hirata1-1/+1
gcc/ * cfgloop.h, cfgloopanal.c, cpplex.c, except.h, loop-init.c, loop-unroll.c, scan-decls.c, scan.h, stor-layout.c, xcoffout.c, xcoffout.h, config/arm/mmintrin.h, config/mips/linux64.h, config/pa/pa-64.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/spe.md, config/sparc/linux.h, config/sparc/linux64.h: Update copyright. gcc/cp/ * cp-tree.def, cvt.c: Update copyright. From-SVN: r78032
2004-02-13call.c (conversion_kind): New type.Mark Mitchell1-24/+0
* call.c (conversion_kind): New type. (conversion_rank): Likewise. (conversion): Likewise. (CONVERSION_RANK): New macro. (conversion_obstack): New variable. (obstack_initialized): Likewise. (z_candidate): Change type of convs and second_conv. (candidate_warning): New type. (IDENTITY_RANK): Remove. (EXACT_RANK): Likewise. (PROMO_RANK): Likewise. (STD_RANK): Likewise. (PBOOL_RANK): Likewise. (USER_RANK): Likewise. (ELLIPSIS_RANK): Likewise. (BAD_RANK): Likewise. (ICS_RANK): Likewise. (ICS_STD_RANK): Likewise. (ICS_USER_FLAG): Likewise. (ICS_ELLIPSIS_FLAG): Likewise. (ICS_THIS_FLAG): Likewise. (ICS_BAD_FLAG): Likewise. (NEED_TEMPORARY_P): Likewise. (CHECK_COPY_CONSTRUCTOR_P): Likewise. (USER_CONV_CAND): Likewise. (USER_CONV_FN): Likewise. (conversion_obstack_alloc): New function. (alloc_conversion): Likewise. (validate_conversion_obstack): Likewise. (alloc_conversions): Likewise. (build_conv): Adjust to deal with new conversion data structures. (build_identity_conv): New function. (build_ambiguous_conv): Likewise. (standard_conversion): Adjust to deal with new conversion data structures. (convert_class_to_reference): Likewise. (direct_reference_binding): Likewise. (reference_binding): Likewise. (implicit_conversion): Likewise. (add_candidate): Likewise. (add_function_candidate): Likewise. (add_conv_candidate): Likewise. (build_builtin_candidate): Likewise. (print_z_candidate): Likewise. (merge_conversion_sequences): Likewise. (build_user_type_conversion_1): Likewise. (build_user_type_conversion): Likewise. (build_new_function_call): Likewise. (build_object_call): Likewise. (conditional_conversion): Likewise. (build_conditional_expr): Likewise. (build_new_op): Likewise. (build_op_delete_call): Likewise. (convert_like_real): Likewise. (build_over_call): Likewise. (build_new_method_call): Likewise. (is_subseq): Likewise. (maybe_handle_implicit_object): Likewise. (maybe_handle_ref_bind): Likewise. (compare_ics): Likewise. (source_type): Likewise. (add_warning): Likewise. (joust): Likewise. (can_convert_arg): Likewise. (can_convert_arg_bad): Likewise. (perform_implicit_conversion): Likewise. (perform_direct_initialization_if_possible): Likewise. (initialize_reference): Likewise. * cp-lang.c (cp_tree_size): Do not handle WRAPPER. * cp-tree.def (WRAPPER): Likewise. (IDENTITY_CONV): Remove. (LVALUE_CONV): Likewise. (QUAL_CONV): Likewise. (STD_CONV): Likewise. (PTR_CONV): Likewise. (PMEM_CONV): Likewise. (BASE_CONV): Likewise. (REF_BIND): Likewise. (USER_CONV): Likewise. (AMBIG_CONV): Likewise. (RVALUE_CONV): Likewise. * cp-tree.h (tree_wrapper): Remove. (WRAPPER_ZC): Remove. (lang_tree_node): Remove wrapper. (LOOKUP_SPECULATIVELY): Remove. (build_op_delete_call): Adjust prototype. (validate_conversion_obstack): Declare. (build_zc_wrapper): Remove. * cvt.c (convert_to_reference): Remove dead code. (ocp_convert): Likewise. * decl.c (redeclaration_error_message): Correct handling of templates. (finish_destructor_body): Do not use LOOKUP_SPECULATIVELY. (cp_tree_node_structure): Remove WRAPPER case. * decl2.c (finish_file): Call validate_conversion_obstack. * init.c (build_new_1): Remove use of LOOKUP_SPECULATIVELY. (build_op_delete_call): Likewise. (build_x_delete): Likewise. (build_delete): Adjust call to build_op_delete_call. * pt.c (tsubst_friend_declaration): Adjust code to determine whether or not a friend template is a definition. (tsubst_decl): Clear DECL_INITIAL for new FUNCTION_DECLs. * tree.c (build_zc_wrapper): Remove. From-SVN: r77752
2003-08-15cp-tree.def (NON_DEPENDENT_EXPR): Add operand.Nathan Sidwell1-2/+3
* cp-tree.def (NON_DEPENDENT_EXPR): Add operand. * decl2.c (build_offset_ref_call_from_tree): Use build_non_dependent_expr. * error.c (dump_expr) <NON_DEPENDENT_EXPR case>: Dump the operand. * pt.c (build_non_dependent_expr): Set operand. From-SVN: r70478
2003-08-10cp-tree.h (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): non-NULL NODE is always a ↵Nathan Sidwell1-4/+4
TREE_VEC of non-zero size. cp: * cp-tree.h (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): non-NULL NODE is always a TREE_VEC of non-zero size. (NUM_TMPL_ARGS): NODE is always a TREE_VEC. * decl2.c (arg_assoc): Template args will be a vec. * error.c (dump_decl) <TEMPLATE_ID_EXPR case>: Call dump_template_argument_list. (dump_template_parms): Args will be a vec. * parser.c (cp_parser_template_argument_list): Produce a vector, not a list. * pt.c (coerce_template_parms): Args are always vectors. (mangle_class_name_for_template): Likewise. (lookup_template_function): Likewise. (lookup_template_class): Likewise. (tsubst_template_args): Likewise. (tsubst_baselink): Use tsubst_template_args. (tsubst_qualified_id): Likewise. (tsubst_copy) <TEMPLATE_ID_EXPR case>: Likewise. (tsubst_copy_and_build) <TEMPLATE_ID_EXPR case>: Likewise. (any_dependent_template_args_p): Args are always vectors. * tree.c (cp_tree_equal): Add TEMPLATE_ID_EXPR case. From-SVN: r70295
2003-08-02re PR c++/9447 (using Base<T>::member does not work)Nathan Sidwell1-1/+3
cp: PR c++/9447 * cp-tree.def (USING_DECL): Document its type. * class.c (pushclass): If we're entering a template, push any dependent using decls it has. * decl2.c (do_class_using_decl): Refactor. Type is NULL iff it is a dependent scope. * pt.c (tsubst_decl) <USING_DECL case>: Set type. (tsubst): Remove USING_DECL checks. (type_dependent_expression_p): Remove USING_DECL case. * semantics.c (finish_member_declaration): A USING_DECL's type indicates whether it is dependent. testsuite: PR c++/9447 * g++.dg/template/using7.C: New test. From-SVN: r70107
2003-07-16cp-tree.def (LOOKUP_EXPR): Remove.Mark Mitchell1-8/+1
* cp-tree.def (LOOKUP_EXPR): Remove. * cp-tree.h (cp_id_kind): Add CP_ID_KIND_UNQUALIFIED_DEPENDENT. (LOOKUP_EXPR_GLOBAL): Remove. (get_bindings): Remove. (is_aggr_type_2): Remove. * call.c (resolved_scoped_fn_name): Remove support for LOOKUP_EXPR. * decl.c (grokfndecl): Likewise. (grokdeclarator): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Likewise. * friend.c (do_friend): Likewise. * init.c (build_offset_ref): Likewise. * lex.c (unqualified_fn_lookup_error): Use pedwarn. Do not create LOOKUP_EXPRs * mangle.c (write_expression): Remove support for LOOKUP_EXPR. * parser.c (cp_parser_postfix_expression): Modify Koenig lookup test. * pt.c (get_bindings): Give it internal linkage. (check_explicit_specialization): Remove support for LOOKUP_EXPR. (lookup_template_function): Likewise. (for_each_tempalte_parm_r): Likewise. (tsubst_decl): Likewise. (tsubst_qualified_id): Handle template template parameters. (tsubst_copy): Remove support for LOOKUP_EXPR. (tsubst_copy_and_build): Likewise. (most_general_template): Likewise. (value_dependent_expression_p): Likewise. (type_dependent_expression_p): Note that IDENTIFIER_NODEs are always dependent. * semantics.c (perform_koenig_lookup): Do not create IDENTIFIER_NODEs. (finish_fname): Likewise. (finish_id_expression): Likewise. * tree.c (is_aggr_type_2): Remove. From-SVN: r69427
2003-07-09fold-const.c (make_range): Do not access operand 1 for a zero-operand operator.Mark Mitchell1-0/+10
* fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-04call.c (build_addr_func): Handle bound pointers-to-members.Mark Mitchell1-7/+7
* call.c (build_addr_func): Handle bound pointers-to-members. (build_method_call): Do not call resolve_offset_ref. (implicit_conversion): Likewise. (resolve_scoped_fn_name): Use finish_non_static_data_member, not resolve_offset_ref. (resolve_args): Do not call resolve_offset_ref. (build_conditional_expr): Likewise. (build_new_method_call): Likewise. * cp-tree.def (OFFSET_REF): Update documentation. (cp_convert_to_pointer): Update handling of conversions from pointers to members to pointers. (ocp_convert): Do not call resolve_offset_ref. (convert_to_void): Likewise. (build_expr_type_conversion): Likewise. (delete_sanity): Likewise. (resolve_offset_ref): Simplify greatly. (build_vec_delete): Do not call resolve_offset_ref. * parser.c (cp_parser_postfix_expression): Call resolve_offset_ref if appropriate. (cp_parser_unary_expression): Use cp_parser_simple_cast_expression. (cp_parser_delete_expression): Likewise. (cp_parser_cast_expression): Likewise. (cp_parser_pm_expression): Use cp_parser_binary_op. (cp_parser_simple_cast_expression): New function. * rtti.c (build_dynamic_cast_1): Do not call resolve_offset_ref. * semantics.c (finish_increment_expr): Likewise. (finish_typeof): Likewise. * tree.c (lvalue_p_1): Do not handle OFFSET_REF. * typeck.c (require_complete_type): Do not handle OFFSET_REFs. (decay_conversion): Do not call resolve_offset_ref. (finish_class_member_access_expr): Likewise. (convert_arguments): Likewise. (build_x_binary_op): Handle DOTSTAR_EXPR. (condition_conversion): Do not call resolve_offset_ref. (unary_complex_lvalue): Likewise. (build_static_cast): Likewise. (build_reinterpret_cast): Likewise. (build_const_cast): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (convert_for_initialization): Likewise. * typeck2.c (build_x_arrow): Likewise. (build_m_component_ref): Simplify. * g++.old-deja/g++.jason/typeid1.C: Add dg-error marker. * g++.old-deja/g++.mike/net36.C: Tweak error messages. From-SVN: r68911
2003-06-18cp-tree.h (COMPARE_RELAXED): Rename to ...Nathan Sidwell1-2/+1
* cp-tree.h (COMPARE_RELAXED): Rename to ... (COMPARE_DERIVED): ... here. Adjust comment. (resolve_typename_type_in_current_instantiation): Remove. (cp_tree_equal, comptypes): Return a bool. * cvt.c (convert_to_reference): Adjust comptypes call. * pt.c (template_args_equal, unify,): Adjust cp_tree_equal call. (resolve_typename_type_in_current_instantiation): Remove. * tree.c (cp_tree_equal): Return bool. Cope with TEMPLATE_DECLs and IDENTIFIER_NODEs. Abort if undeciderable. Adjust recursive calls. Refactor code. * typeck.c (comp_array_types): Return bool. Lose callback. parameter. Adjust cp_tree_equal calls. (comptypes): Return bool. Adjust strict handling. Remove relaxed enumeration and java type handling. Deal with typename types here. Adjust recursive and cp_tree_equals calls. Adjust base and derived checking. (comp_target_types): Remove unreachable code. Adjust same_or_base_type_p calls. (ptr_reasonably_similar): Adjust base and derived check. * typeck.c (maybe_warn_about_returning_address_of_local): Remove unused calculation. (check_return_expr): Adjust error messages. * cp-tree.def (SCOPE_REF): Correct comment. From-SVN: r68155
2003-04-07tree.c (tree_size): For all 'c' and 'x' nodes...Zack Weinberg1-15/+6
* tree.c (tree_size): For all 'c' and 'x' nodes, look directly at the sizes of the relevant structures, rather than relying on TREE_CODE_LENGTH. Call lang_hooks.tree_size to get the sizes of any such we don't know about. Use lang_hooks.identifier_size for IDENTIFIER_NODE. (initializer_zerop): Use CONSTRUCTOR_ELTS. * tree.def: Update commentary. Make fourth element of the definition for all 'c' and 'x' nodes zero. * langhooks.h: New hook, tree_size / LANG_HOOKS_TREE_SIZE. * langhooks-def.h: Update to match. * langhooks.c: New default, lhd_tree_size. * c-common.def (SRCLOC): Kill. * c-pretty-print.c (pp_c_postfix_expression [case SRCLOC]): Remove entirely - was already #if-ed out. ada: * ada-tree.def: Make fourth element for GNAT_LOOP_ID zero. * misc.c (gnat_tree_size): New function. (LANG_HOOKS_TREE_SIZE): Override. cp: * cp-tree.def: Make fourth element for all 'c' and 'x' nodes zero. * cp-lang.c (cp_tree_size): New function. (LANG_HOOKS_TREE_SIZE): Override. * cp-tree.h (SOURCE_LOCUS, SRCLOC_FILE, SRCLOC_LINE, struct tree_srcloc, TS_CP_COMMON, TS_CP_SRCLOC): Kill. (union lang_tree_node): Remove common and srcloc members. (build_srcloc_here): Don't prototype. * decl.c (cp_tree_node_structure): Kill SRCLOC case. * pt.c (pending_templates): Correct comment. * tree.c (build_srcloc, build_srcloc_here): Kill. From-SVN: r65323
2003-03-15Compile-time improvement: 2/n.Gabriel Dos Reis1-5/+0
* cp-tree.h (struct cxx_binding): New datatype; (struct lang_identifier): Use it. (LOCAL_BINDING_P): Adjust definition. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Likewise. (BINDING_HAS_LEVEL_P): Likewise. (BINDING_VALUE): Likewise. (BINDING_TYPE): Likewise. (IDENTIFIER_VALUE): Likewise. (struct tree_binding): Remove. (TS_CP_BINDING): Likewise. ((union lang_tree_node): Remove field "binding". (cxx_binding_clear): New macro. (binding_for_name): Adjust return type. (qualified_lookup_using_namespace): Adjust prototype. (lookup_using_namespace): Adjust prototype. (cxx_scope_find_binding_for_name): Declare. * cp-tree.def: Remove CPLUS_BINDING definition. * parse.y (parse_scoped_id): Don't type-abuse of 'id'. Allocate temporary cxx_binding on stack. Simplify. * decl.c (push_binding): Adjust local variable type. (add_binding): Likewise. (push_class_binding): Likewise. (pop_binding): Likewise. (poplevel): Likewise. (poplevel_class): Likewise. (free_bindings): Adjust type. (find_binding): Adjust return type, add a third parameter. Remove non-useful assertion now that we use static typing. (cxx_scope_find_binding_for_name): New function. (binding_for_name): Use it. Adjust local variable type. Simplify. (namespace_binding): Simplify. (set_namespace_binding): Likewise. (set_identifier_type_value_with_scope): Adjust local variable type. (lookup_tag): Don't type-abuse of local variable 'old'. (lookup_namespace_name): Likewise. Allocate binding on stack. (select_decl): Adjust prototype. (unqualified_namespace_lookup): Allocate binding on stack. Don't type-abuse of local variable 'val'. (lookup_name_real): Likewise. (maybe_inject_for_scope_var): Adjust local variable type. (cp_tree_node_structure): Remove CPLUS_BINDING case label. (namespace_binding): Adjust logic, simplify. (BINDING_LEVEL): Adjust definition. (push_class_level_binding): Adjust local variable type. (struct cxx_saved_binding): Adjust field 'binding' type. * decl2.c (ambiguous_decl): Adjust prototype. (lookup_using_namespace): Adjust local variable type. (qualified_lookup_using_namespace): Catch type error and correct ensueing logic error. (do_nonmember_using_decl): Adjust local variable type. Allocate temporary cxx_binding on stack. (do_toplevel_using_decl): Adjust local variable type. * ptree.c (cxx_print_cxx_binding): New function. (cxx_print_identifier): Use it. (cxx_print_xnode): Delete CPLUS_BINDING case label. From-SVN: r64405
2003-03-07call.c (merge_conversion_sequences): New function.Mark Mitchell1-3/+9
* call.c (merge_conversion_sequences): New function. (build_conv): Set ICS_USER_FLAG for USER_CONVs. (convert_class_to_reference): Correct handling of second standard conversion sequence in a user-defined conversion sequence. (build_user_type_conversion_1): Use merge_conversion_sequences. * cp-tree.def: Add comments for CONV nodes. * g++.dg/init/ref3.C: New test. From-SVN: r63930
2003-01-17re PR c++/9294 ([new parser] parser enters infinite loop)Mark Mitchell1-1/+1
PR c++/9294 * cp-tree.def (BASELINK): Make it class 'x', not class 'e'. * cp-tree.h (BASELINK_BINFO): Adjust. (BASELINK_FUNCTIONS): Likewise. (BASELINK_ACCESS_BINFO): Likewise. (tree_baselink): New structure. (cp_tree_node_structure_enum): Add TS_CP_BASELINK. (lang_tree_node): Add baselink. * decl.c (cp_tree_node_structure): Add BASELINK case. * search.c (build_baselink): Adjust. * tree.c (cp_walk_subtrees): Add BASELINK case. Remove BASELINK_P test from TREE_LIST case. PR c++/9272 * parser.c (cp_parser_constructor_declarator_p): Do not assume that a constructor cannot be declared outside of its own class. * parser.c (cp_parser_resolve_typename_type): If the scope cannot be resolved, neither can the qualified name. * rtti.c (get_pseudo_ti_desc): Fix thinko. PR c++/9272 * g++.dg/parse/ctor1.C: New test. PR c++/9294: * g++.dg/parse/qualified1.C: New test. * g++.dg/parse/typename3.C: New test. From-SVN: r61456
2002-12-31cp-tree.def (RETURN_INIT): Remove.Mark Mitchell1-1/+0
* cp-tree.def (RETURN_INIT): Remove. * cp-tree.h (DECL_IN_MEMORY_P): Remove. (scope_kind): Add sk_block, sk_try, sk_catch, sk_for. (note_level_for_for): Remove. (note_level_for_try): Likewise. (note_level_for_catch): Likewise. (finish_named_return_value): Likewise. (do_pushlevel): Change prototype. (pending_lang_change): Remove. * decl.c (begin_scope): Handle sk_block, sk_try, sk_catch, sk_for. (note_level_for_for): Remove. (note_level_for_try): Likewise. (note_level_for_catch): Likewise. (maybe_inject_for_scope_var): Remove use of DECL_IN_MEMORY_P. * parser.c (cp_parser_context_free_list): Make it "deletable". (cp_parser_template_argument): Remove misleading comment. * pt.c (tsubst_expr): Remove RETURN_INIT code. * semantics.c (genrtl_named_return_value): Remove. (do_pushlevel): Take a scope kind as an argument. (begin_if_stmt): Adjust. (begin_while_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (begin_switch_stmt): Likewise. (begin_handler): Likewise. (begin_compound_stmt): Likewise. (finish_named_return_value): Remove. (cp_expand_stmt): Remove RETURN_INIT case. * tree.c (cp_statement_code_p): Remove RETURN_INIT case. * g++.dg/init/array9.C: New test. From-SVN: r60707
2002-12-30config-lang.in, [...]: GCC, not GNU CC.Nathanael Nerode1-5/+5
* config-lang.in, Make-lang.in, operators.def, cp-tree.def: GCC, not GNU CC. From-SVN: r60638
2002-12-19Handle anonymous unions at the tree level.Jason Merrill1-0/+4
C++ ABI change: Mangle anonymous unions using the name of their first named field (by depth-first search). Should not cause binary compatibility problems, though, as the compiler previously didn't emit anything for affected unions. * cp-tree.def (ALIAS_DECL): New tree code. * decl2.c (build_anon_union_vars): Build ALIAS_DECLs. Return the first field, not the largest. (finish_anon_union): Don't mess with RTL. Do set DECL_ASSEMBLER_NAME, push the decl, and write it out at namespace scope. * decl.c (lookup_name_real): See through an ALIAS_DECL. (pushdecl): Add namespace bindings for ALIAS_DECLs. * rtti.c (unemitted_tinfo_decl_p): Don't try to look at the name of a decl which doesn't have one. * typeck.c (build_class_member_access_expr): Don't recurse if we already have the type we want. From-SVN: r60314