X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fcp%2Fcp-tree.h;h=2f67f374ff31b50af2f9047feeeb158ac2a4faa4;hb=25a2ad4875b69343fd99e50239e70a91cfe874cc;hp=2803f51da271ad1c842a9c48a34a4762bb135fb8;hpb=fcb3f76e49122610579aff6585c27613be286f99;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 2803f51da27..2f67f374ff3 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1,6 +1,6 @@ /* Definitions for C++ parsing and type checking. Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GCC. @@ -51,6 +51,8 @@ struct diagnostic_context; BIND_EXPR_TRY_BLOCK (in BIND_EXPR) TYPENAME_IS_ENUM_P (in TYPENAME_TYPE) REFERENCE_REF_P (in INDIRECT_EXPR) + QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF) + BASELINK_QUALIFIED_P (in BASELINK) 1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE) TI_PENDING_TEMPLATE_FLAG. TEMPLATE_PARMS_FOR_INLINE. @@ -69,6 +71,7 @@ struct diagnostic_context; FN_TRY_BLOCK_P (in TRY_BLOCK) IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE) BIND_EXPR_BODY_BLOCK (in BIND_EXPR) + DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL) 4: TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR, or FIELD_DECL). IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE) @@ -255,6 +258,8 @@ typedef struct ptrmem_cst * ptrmem_cst_t; /* Used to mark the block around the member initializers and cleanups. */ #define BIND_EXPR_BODY_BLOCK(NODE) \ TREE_LANG_FLAG_3 (BIND_EXPR_CHECK (NODE)) +#define FUNCTION_NEEDS_BODY_BLOCK(NODE) \ + (DECL_CONSTRUCTOR_P (NODE) || DECL_DESTRUCTOR_P (NODE)) #define STATEMENT_LIST_NO_SCOPE(NODE) \ TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE)) @@ -337,6 +342,9 @@ struct tree_overload GTY(()) requested. */ #define BASELINK_OPTYPE(NODE) \ (TREE_CHAIN (BASELINK_CHECK (NODE))) +/* Non-zero if this baselink was from a qualified lookup. */ +#define BASELINK_QUALIFIED_P(NODE) \ + TREE_LANG_FLAG_0 (BASELINK_CHECK (NODE)) struct tree_baselink GTY(()) { @@ -1512,7 +1520,8 @@ struct lang_decl_flags GTY(()) unsigned thunk_p : 1; unsigned this_thunk_p : 1; unsigned repo_available_p : 1; - unsigned dummy : 3; + unsigned hidden_friend_p : 1; + unsigned dummy : 2; union lang_decl_u { /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is @@ -1781,11 +1790,17 @@ struct lang_decl GTY(()) should be allocated. */ #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE)) -/* Nonzero for a VAR_DECL means that the variable's initialization has - been processed. */ +/* Nonzero for a VAR_DECL means that the variable's initialization (if + any) has been processed. (In general, DECL_INITIALIZED_P is + !DECL_EXTERN, but static data members may be initialized even if + not defined.) */ #define DECL_INITIALIZED_P(NODE) \ (TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE))) +/* Nonzero for a VAR_DECL iff an explicit initializer was provided. */ +#define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \ + (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE))) + /* Nonzero for a VAR_DECL that was initialized with a constant-expression. */ #define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \ @@ -1814,9 +1829,8 @@ struct lang_decl GTY(()) #define DECL_INITIALIZED_IN_CLASS_P(DECL) \ (DECL_LANG_SPECIFIC (DECL)->decl_flags.initialized_in_class) -/* Nonzero for FUNCTION_DECL means that this decl is just a - friend declaration, and should not be added to the list of - member functions for this class. */ +/* Nonzero for DECL means that this decl is just a friend declaration, + and should not be added to the list of members for this class. */ #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.friend_attr) /* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */ @@ -2321,11 +2335,19 @@ extern void decl_shadowed_for_var_insert (tree, tree); #define DECL_LOCAL_FUNCTION_P(NODE) \ DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE)) -/* Nonzero if NODE is a FUNCTION_DECL for a built-in function, and we have - not yet seen a prototype for that function. */ +/* Nonzero if NODE is a DECL which we know about but which has not + been explicitly declared, such as a built-in function or a friend + declared inside a class. In the latter case DECL_HIDDEN_FRIEND_P + will be set. */ #define DECL_ANTICIPATED(NODE) \ (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.anticipated_p) +/* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend + within a class but has not been declared in the surrounding scope. + The function is invisible except via argument dependent lookup. */ +#define DECL_HIDDEN_FRIEND_P(NODE) \ + (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.hidden_friend_p) + /* Record whether a typedef for type `int' was actually `signed int'. */ #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP) @@ -2336,12 +2358,12 @@ extern void decl_shadowed_for_var_insert (tree, tree); #define DECL_EXTERNAL_LINKAGE_P(DECL) \ (decl_linkage (DECL) == lk_external) -/* Keep these codes in ascending code order. CHAR_TYPE is used here - to completely fill the range. */ +/* Keep these codes in ascending code order. */ -#define INTEGRAL_CODE_P(CODE) \ - ((CODE) == ENUMERAL_TYPE || (CODE) == BOOLEAN_TYPE \ - || (CODE) == CHAR_TYPE || (CODE) == INTEGER_TYPE) +#define INTEGRAL_CODE_P(CODE) \ + ((CODE) == ENUMERAL_TYPE \ + || (CODE) == BOOLEAN_TYPE \ + || (CODE) == INTEGER_TYPE) /* [basic.fundamental] @@ -2350,11 +2372,9 @@ extern void decl_shadowed_for_var_insert (tree, tree); Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration types as well, which is incorrect in C++. Keep these checks in - ascending code order. CHAR_TYPE is added to complete the interval of - values. */ + ascending code order. */ #define CP_INTEGRAL_TYPE_P(TYPE) \ (TREE_CODE (TYPE) == BOOLEAN_TYPE \ - || TREE_CODE (TYPE) == CHAR_TYPE \ || TREE_CODE (TYPE) == INTEGER_TYPE) /* Returns true if TYPE is an integral or enumeration name. Keep @@ -2418,6 +2438,11 @@ extern void decl_shadowed_for_var_insert (tree, tree); #define BRACE_ENCLOSED_INITIALIZER_P(NODE) \ (TREE_CODE (NODE) == CONSTRUCTOR && !TREE_TYPE (NODE)) +/* True if NODE is a compound-literal, i.e., a brace-enclosed + initializer cast to a particular type. */ +#define COMPOUND_LITERAL_P(NODE) \ + (TREE_CODE (NODE) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (NODE)) + #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \ && VEC_empty (constructor_elt, \ CONSTRUCTOR_ELTS (NODE)) \ @@ -2702,12 +2727,13 @@ extern void decl_shadowed_for_var_insert (tree, tree); For a class template, this list contains the partial specializations of this template. (Full specializations are not - recorded on this list.) The TREE_PURPOSE holds the innermost - arguments used in the partial specialization (e.g., for `template - struct S' this will be `T*'.) The TREE_VALUE - holds the innermost template parameters for the specialization - (e.g., `T' in the example above.) The TREE_TYPE is the _TYPE node - for the partial specialization. + recorded on this list.) The TREE_PURPOSE holds the arguments used + in the partial specialization (e.g., for `template struct + S' this will be `T*'.) The arguments will also include + any outer template arguments. The TREE_VALUE holds the innermost + template parameters for the specialization (e.g., `T' in the + example above.) The TREE_TYPE is the _TYPE node for the partial + specialization. This list is not used for static variable templates. */ #define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE (NODE) @@ -2916,6 +2942,11 @@ extern void decl_shadowed_for_var_insert (tree, tree); #define THUNK_TARGET(NODE) \ (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes) +/* True for a SCOPE_REF iff the "template" keyword was used to + indicate that the qualified name denotes a template. */ +#define QUALIFIED_NAME_IS_TEMPLATE(NODE) \ + (TREE_LANG_FLAG_0 (SCOPE_REF_CHECK (NODE))) + /* These macros provide convenient access to the various _STMT nodes created when parsing template declarations. */ #define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0) @@ -3075,10 +3106,12 @@ typedef enum tsubst_flags_t { instantiate_type use) */ tf_user = 1 << 5, /* found template must be a user template (lookup_template_class use) */ - tf_conv = 1 << 6 /* We are determining what kind of + tf_conv = 1 << 6, /* We are determining what kind of conversion might be permissible, not actually performing the conversion. */ + /* Convenient substitution flags combinations. */ + tf_warning_or_error = tf_warning | tf_error } tsubst_flags_t; /* The kind of checking we can do looking in a class hierarchy. */ @@ -3247,13 +3280,6 @@ extern GTY(()) VEC(tree,gc) *local_classes; && IDENTIFIER_POINTER (ID_NODE)[1] == '_') #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */ -/* Returns nonzero iff NODE is a declaration for the global function - `main'. */ -#define DECL_MAIN_P(NODE) \ - (DECL_EXTERN_C_FUNCTION_P (NODE) \ - && DECL_NAME (NODE) != NULL_TREE \ - && MAIN_NAME_P (DECL_NAME (NODE))) - /* Nonzero if we're done parsing and into end-of-file activities. */ @@ -3644,7 +3670,7 @@ extern bool null_ptr_cst_p (tree); extern bool sufficient_parms_p (tree); extern tree type_decays_to (tree); extern tree build_user_type_conversion (tree, tree, int); -extern tree build_new_function_call (tree, tree); +extern tree build_new_function_call (tree, tree, bool); extern tree build_operator_new_call (tree, tree, tree *, tree *); extern tree build_new_method_call (tree, tree, tree, tree, int); extern tree build_special_member_call (tree, tree, tree, tree, int); @@ -3682,7 +3708,7 @@ extern tree build_vfn_ref (tree, tree); extern tree get_vtable_decl (tree, int); extern void resort_type_method_vec (void *, void *, gt_pointer_operator, void *); -extern void add_method (tree, tree, tree); +extern bool add_method (tree, tree, tree); extern int currently_open_class (tree); extern tree currently_open_derived_class (tree); extern tree finish_struct (tree, tree); @@ -3708,21 +3734,20 @@ extern void cxx_print_error_function (struct diagnostic_context *, const char *); extern void build_self_reference (void); extern int same_signature_p (tree, tree); -extern void warn_hidden (tree); extern void maybe_add_class_template_decl_list (tree, tree, int); extern void unreverse_member_declarations (tree); extern void invalidate_class_lookup_cache (void); extern void maybe_note_name_used_in_class (tree, tree); extern void note_name_declared_in_class (tree, tree); extern tree get_vtbl_decl_for_binfo (tree); -extern tree get_vtt_name (tree); -extern tree get_primary_binfo (tree); extern void debug_class (tree); extern void debug_thunks (tree); extern tree cp_fold_obj_type_ref (tree, tree); extern void set_linkage_according_to_type (tree, tree); extern void determine_key_method (tree); extern void check_for_override (tree, tree); +extern void push_class_stack (void); +extern void pop_class_stack (void); /* in cvt.c */ extern tree convert_to_reference (tree, tree, int, int, tree); @@ -3732,7 +3757,6 @@ extern tree ocp_convert (tree, tree, int, int); extern tree cp_convert (tree, tree); extern tree convert_to_void (tree, const char */*implicit context*/); extern tree convert_force (tree, tree, int); -extern tree build_type_conversion (tree, tree); extern tree build_expr_type_conversion (int, tree, bool); extern tree type_promotes_to (tree); extern tree perform_qualification_conversions (tree, tree); @@ -3743,6 +3767,7 @@ extern void adjust_clone_args (tree); extern tree poplevel (int, int, int); extern void insert_block (tree); extern tree pushdecl (tree); +extern tree pushdecl_maybe_friend (tree, bool); extern void cxx_init_decl_processing (void); enum cp_tree_node_structure_enum cp_tree_node_structure (union lang_tree_node *); @@ -3756,10 +3781,10 @@ extern void pop_switch (void); extern tree pushtag (tree, tree, tag_scope); extern tree make_anon_name (void); extern int decls_match (tree, tree); -extern tree duplicate_decls (tree, tree); +extern tree duplicate_decls (tree, tree, bool); extern tree pushdecl_top_level (tree); +extern tree pushdecl_top_level_maybe_friend (tree, bool); extern tree pushdecl_top_level_and_finish (tree, tree); -extern tree push_using_decl (tree, tree); extern tree declare_local_label (tree); extern tree define_label (location_t, tree); extern void check_goto (tree); @@ -3777,7 +3802,7 @@ extern tree shadow_tag (cp_decl_specifier_seq *); extern tree groktypename (cp_decl_specifier_seq *, const cp_declarator *); extern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *); extern void start_decl_1 (tree); -extern void cp_finish_decl (tree, tree, tree, int); +extern void cp_finish_decl (tree, tree, bool, tree, int); extern void finish_decl (tree, tree, tree); extern int cp_complete_array_type (tree *, tree, bool); extern tree build_ptrmemfunc_type (tree); @@ -3820,7 +3845,6 @@ extern tree force_target_expr (tree, tree); extern tree build_target_expr_with_type (tree, tree); extern int local_variable_p (tree); extern int nonstatic_local_decl_p (tree); -extern tree declare_global_var (tree, tree); extern tree register_dtor_fn (tree); extern tmpl_spec_kind current_tmpl_spec_kind (int); extern tree cp_fname_init (const char *, tree *); @@ -3835,6 +3859,7 @@ extern const char *cxx_comdat_group (tree); extern bool cp_missing_noreturn_ok_p (tree); extern void initialize_artificial_var (tree, tree); extern tree check_var_type (tree, tree); +extern tree reshape_init (tree, tree); extern bool have_extern_spec; @@ -3851,7 +3876,7 @@ extern tree delete_sanity (tree, tree, bool, int); extern tree check_classfn (tree, tree, tree); extern void check_member_template (tree); extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *, - tree, tree, tree); + tree, bool, tree, tree); extern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *, tree); extern void cplus_decl_attributes (tree *, tree, int); @@ -3866,7 +3891,7 @@ extern tree build_cleanup (tree); extern tree build_offset_ref_call_from_tree (tree, tree); extern void check_default_args (tree); extern void mark_used (tree); -extern void finish_static_data_member_decl (tree, tree, tree, int); +extern void finish_static_data_member_decl (tree, tree, bool, tree, int); extern tree cp_build_parm_decl (tree, tree); extern tree get_guard (tree); extern tree get_guard_cond (tree); @@ -3907,7 +3932,7 @@ extern tree cplus_expand_constant (tree); extern int is_friend (tree, tree); extern void make_friend_class (tree, tree, bool); extern void add_friend (tree, tree, bool); -extern tree do_friend (tree, tree, tree, tree, enum overload_flags, cp_cv_quals, int); +extern tree do_friend (tree, tree, tree, tree, enum overload_flags, cp_cv_quals, bool); /* in init.c */ extern tree expand_member_init (tree); @@ -3920,7 +3945,6 @@ extern tree build_zero_init (tree, tree, bool); extern tree build_offset_ref (tree, tree, bool); extern tree build_new (tree, tree, tree, tree, int); extern tree build_vec_init (tree, tree, tree, bool, int); -extern tree build_x_delete (tree, int, tree); extern tree build_delete (tree, tree, special_function_kind, int, int); @@ -3955,8 +3979,6 @@ extern tree make_thunk (tree, bool, tree, tree); extern void finish_thunk (tree); extern void use_thunk (tree, bool); extern void synthesize_method (tree); -extern tree implicitly_declare_fn (special_function_kind, - tree, bool); extern tree lazily_declare_fn (special_function_kind, tree); extern tree skip_artificial_parms_for (tree, tree); @@ -3981,9 +4003,8 @@ extern tree check_explicit_specialization (tree, tree, int, int); extern tree process_template_parm (tree, tree, bool); extern tree end_template_parm_list (tree); extern void end_template_decl (void); -extern tree current_template_args (void); extern tree push_template_decl (tree); -extern tree push_template_decl_real (tree, int); +extern tree push_template_decl_real (tree, bool); extern void redeclare_class_template (tree, tree); extern tree lookup_template_class (tree, tree, tree, tree, int, tsubst_flags_t); @@ -3996,13 +4017,9 @@ extern int fn_type_unification (tree, tree, tree, tree, tree, unification_kind_t, int); extern void mark_decl_instantiated (tree, int); extern int more_specialized_fn (tree, tree, int); -extern void mark_class_instantiated (tree, int); extern void do_decl_instantiation (tree, tree); extern void do_type_instantiation (tree, tree, tsubst_flags_t); extern tree instantiate_decl (tree, int, bool); -extern int push_tinst_level (tree); -extern void pop_tinst_level (void); -extern int more_specialized_class (tree, tree, tree); extern int comp_template_parms (tree, tree); extern int template_class_depth (tree); extern int is_specialization_of (tree, tree); @@ -4035,7 +4052,6 @@ extern tree build_non_dependent_expr (tree); extern tree build_non_dependent_args (tree); extern bool reregister_specialization (tree, tree, tree); extern tree fold_non_dependent_expr (tree); -extern tree fold_decl_constant_value (tree); /* in repo.c */ extern void init_repo (void); @@ -4181,9 +4197,11 @@ extern tree finish_template_type (tree, tree, int); extern tree finish_base_specifier (tree, tree, bool); extern void finish_member_declaration (tree); extern void qualified_name_lookup_error (tree, tree, tree); +extern void check_template_keyword (tree); extern tree finish_id_expression (tree, tree, tree, - cp_id_kind *, tree *, + cp_id_kind *, bool, bool, bool *, + bool, bool, bool, bool, const char **); extern tree finish_typeof (tree); extern void finish_decl_cleanup (tree, tree); @@ -4193,7 +4211,8 @@ extern void finish_mem_initializers (tree); extern tree check_template_template_default_arg (tree); extern void expand_or_defer_fn (tree); extern void check_accessibility_of_qualified_id (tree, tree, tree); -extern tree finish_qualified_id_expr (tree, tree, bool, bool); +extern tree finish_qualified_id_expr (tree, tree, bool, bool, + bool, bool); extern void simplify_aggr_init_expr (tree *); extern void finalize_nrv (tree *, tree, tree); extern void note_decl_for_pch (tree); @@ -4223,6 +4242,7 @@ extern tree get_target_expr (tree); extern tree build_cplus_array_type (tree, tree); extern tree hash_tree_cons (tree, tree, tree); extern tree hash_tree_chain (tree, tree); +extern tree build_qualified_name (tree, tree, tree, bool); extern int is_overloaded_fn (tree); extern tree get_first_fn (tree); extern tree ovl_cons (tree, tree); @@ -4250,12 +4270,11 @@ extern tree make_ptrmem_cst (tree, tree); extern tree cp_build_type_attribute_variant (tree, tree); extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t); #define cp_build_qualified_type(TYPE, QUALS) \ - cp_build_qualified_type_real ((TYPE), (QUALS), tf_error | tf_warning) + cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error) extern special_function_kind special_function_p (tree); extern int count_trees (tree); extern int char_type_p (tree); extern void verify_stmt_tree (tree); -extern tree find_tree (tree, tree); extern linkage_kind decl_linkage (tree); extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn, void*, struct pointer_set_t*); @@ -4273,7 +4292,6 @@ extern tree require_complete_type (tree); extern tree complete_type (tree); extern tree complete_type_or_else (tree, tree); extern int type_unknown_p (tree); -extern tree original_type (tree); extern bool comp_except_specs (tree, tree, bool); extern bool comptypes (tree, tree, int); extern bool compparms (tree, tree); @@ -4286,7 +4304,7 @@ extern tree inline_conversion (tree); extern tree decay_conversion (tree); extern tree default_conversion (tree); extern tree build_class_member_access_expr (tree, tree, tree, bool); -extern tree finish_class_member_access_expr (tree, tree); +extern tree finish_class_member_access_expr (tree, tree, bool); extern tree build_x_indirect_ref (tree, const char *); extern tree build_indirect_ref (tree, const char *); extern tree build_array_ref (tree, tree); @@ -4317,12 +4335,11 @@ extern bool at_least_as_qualified_p (tree, tree); extern void cp_apply_type_quals_to_decl (int, tree); extern tree build_ptrmemfunc1 (tree, tree, tree); extern void expand_ptrmemfunc_cst (tree, tree *, tree *); -extern tree pfn_from_ptrmemfunc (tree); extern tree type_after_usual_arithmetic_conversions (tree, tree); extern tree composite_pointer_type (tree, tree, tree, tree, const char*); extern tree merge_types (tree, tree); -extern tree check_return_expr (tree); +extern tree check_return_expr (tree, bool *); #define cp_build_binary_op(code, arg1, arg2) \ build_binary_op(code, arg1, arg2, 1) #define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true) @@ -4404,5 +4421,8 @@ extern void cp_genericize (tree); #else #define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m) #endif +extern void cp_cpp_error (cpp_reader *, int, + const char *, va_list *) + ATTRIBUTE_GCC_CXXDIAG(3,0); #endif /* ! GCC_CP_TREE_H */