diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3d0fe7f9b1a..f0a85039a35 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -177,7 +177,7 @@ (cp_parser_pure_specifier): Likewise. PR c++/26068 - * parser.c (cp_parser_set_storage_class): Check for + * parser.c (cp_parser_set_storage_class): Check for invalid uses of storage classes on unbraced linkage specifications. (cp_parser_decl_specifier_seq): Pass keywords, not storage classes, @@ -212,7 +212,7 @@ (cp_parser_explicit_specialization): Adjust call to cp_parser_single_declaration. (cp_parser_init_declarator): Perform template-parameter access - checks. + checks. (cp_parser_parameter_declaration): Do not defer checks for template parameter default arguments. (cp_parser_template_declaration_after_export): Gather access @@ -398,11 +398,11 @@ type. (build_modify_expr): Remove spurious conversions. * class.c (layout_class_type): Modify the type of bitfields to - indicate a limited range. + indicate a limited range. * call.c (standard_conversion): Adjust the type of bitfield expressions used in an rvalue context. (build_conditional_expr): Likewise. - + 2006-04-22 Kazu Hirata * decl.c: Fix comment typos. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 2167101e2f9..f852c973204 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2835,7 +2835,7 @@ build_new_function_call (tree fn, tree args, bool koenig_p) set, upon return, to the allocation function called. */ tree -build_operator_new_call (tree fnname, tree args, +build_operator_new_call (tree fnname, tree args, tree *size, tree *cookie_size, tree *fn) { @@ -3302,7 +3302,7 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3) || (conv3 && conv3->kind == ck_ambig)) { error ("operands to ?: have different types %qT and %qT", - arg2_type, arg3_type); + arg2_type, arg3_type); result = error_mark_node; } else if (conv2 && (!conv2->bad_p || !conv3)) @@ -3512,8 +3512,8 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3) if (!result_type) { - error ("operands to ?: have different types %qT and %qT", - arg2_type, arg3_type); + error ("operands to ?: have different types %qT and %qT", + arg2_type, arg3_type); return error_mark_node; } @@ -6068,7 +6068,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn) if (warn) { warning (OPT_Wsign_promo, "passing %qT chooses %qT over %qT", - type, type1, type2); + type, type1, type2); warning (OPT_Wsign_promo, " in call to %qD", w->fn); } else diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h index 5dc71ce46cb..82cdef76466 100644 --- a/gcc/cp/cfns.h +++ b/gcc/cp/cfns.h @@ -57,13 +57,13 @@ hash (register const char *str, register unsigned int len) 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 0, 0, - 1, 400, 400, 400, 400, 400, 400, 400, 400, 400, + 1, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 28, 90, 0, 95, 0, 51, 93, 114, 26, 109, 124, 5, 1, - 6, 13, 37, 128, 3, 0, 0, 49, 38, 0, + 6, 13, 37, 128, 3, 0, 0, 49, 38, 0, 104, 45, 0, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, @@ -84,23 +84,23 @@ hash (register const char *str, register unsigned int len) switch (hval) { default: - hval += asso_values[(unsigned char)str[5]+1]; + hval += asso_values[(unsigned char)str[5]+1]; /*FALLTHROUGH*/ case 5: - hval += asso_values[(unsigned char)str[4]]; + hval += asso_values[(unsigned char)str[4]]; /*FALLTHROUGH*/ case 4: - hval += asso_values[(unsigned char)str[3]]; + hval += asso_values[(unsigned char)str[3]]; /*FALLTHROUGH*/ case 3: - hval += asso_values[(unsigned char)str[2]]; + hval += asso_values[(unsigned char)str[2]]; /*FALLTHROUGH*/ case 2: - hval += asso_values[(unsigned char)str[1]]; + hval += asso_values[(unsigned char)str[1]]; /*FALLTHROUGH*/ case 1: - hval += asso_values[(unsigned char)str[0]]; - break; + hval += asso_values[(unsigned char)str[0]]; + break; } return hval + asso_values[(unsigned char)str[len - 1]]; } @@ -329,17 +329,17 @@ libc_name_p (register const char *str, register unsigned int len) register int key = hash (str, len); if (key <= MAX_HASH_VALUE && key >= 0) - { - register int index = lookup[key]; + { + register int index = lookup[key]; - if (index >= 0) - { - register const char *s = wordlist[index]; + if (index >= 0) + { + register const char *s = wordlist[index]; - if (*str == *s && !strcmp (str + 1, s + 1)) - return s; - } - } + if (*str == *s && !strcmp (str + 1, s + 1)) + return s; + } + } } return 0; } diff --git a/gcc/cp/class.c b/gcc/cp/class.c index a1460c0e58d..84ecf77f958 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1066,7 +1066,7 @@ add_method (tree type, tree method, tree using_decl) } } - /* A class should never have more than one destructor. */ + /* A class should never have more than one destructor. */ if (current_fns && DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (method)) return false; @@ -1232,7 +1232,7 @@ check_bases (tree t, dtor is handled in finish_struct_1. */ if (!TYPE_POLYMORPHIC_P (basetype)) warning (OPT_Weffc__, - "base class %q#T has a non-virtual destructor", basetype); + "base class %q#T has a non-virtual destructor", basetype); /* If the base class doesn't have copy constructors or assignment operators that take const references, then the @@ -1547,7 +1547,7 @@ maybe_warn_about_overly_private_class (tree t) if (!has_nonprivate_method) { warning (OPT_Wctor_dtor_privacy, - "all member functions in class %qT are private", t); + "all member functions in class %qT are private", t); return; } } @@ -1559,7 +1559,7 @@ maybe_warn_about_overly_private_class (tree t) if (fn && TREE_PRIVATE (fn)) { warning (OPT_Wctor_dtor_privacy, - "%q#T only defines a private destructor and has no friends", + "%q#T only defines a private destructor and has no friends", t); return; } @@ -1603,7 +1603,7 @@ maybe_warn_about_overly_private_class (tree t) if (nonprivate_ctor == 0) { warning (OPT_Wctor_dtor_privacy, - "%q#T only defines private constructors and has no friends", + "%q#T only defines private constructors and has no friends", t); return; } @@ -2630,7 +2630,7 @@ check_bitfield_decl (tree field) /* Extract the declared width of the bitfield, which has been temporarily stashed in DECL_INITIAL. */ w = DECL_INITIAL (field); - gcc_assert (w != NULL_TREE); + gcc_assert (w != NULL_TREE); /* Remove the bit-field width indicator so that the rest of the compiler does not treat that value as an initializer. */ DECL_INITIAL (field) = NULL_TREE; @@ -3040,13 +3040,13 @@ check_field_decls (tree t, tree *access_decls, if (! TYPE_HAS_INIT_REF (t)) { warning (OPT_Weffc__, - " but does not override %<%T(const %T&)%>", t, t); + " but does not override %<%T(const %T&)%>", t, t); if (!TYPE_HAS_ASSIGN_REF (t)) warning (OPT_Weffc__, " or %", t); } else if (! TYPE_HAS_ASSIGN_REF (t)) warning (OPT_Weffc__, - " but does not override %", t); + " but does not override %", t); } @@ -3136,7 +3136,7 @@ walk_subobject_offsets (tree type, if (type == error_mark_node) return 0; - + if (!TYPE_P (type)) { if (abi_version_at_least (2)) @@ -3336,7 +3336,7 @@ record_subobject_offsets (tree type, other empty classes might later be placed) or at the end of the class (where other objects might then be placed, so other empty subobjects might later overlap). */ - if (is_data_member + if (is_data_member || !is_empty_class (BINFO_TYPE (type))) max_offset = sizeof_biggest_empty_class; else @@ -3503,7 +3503,7 @@ layout_empty_base (tree binfo, tree eoc, splay_tree offsets) (binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo))); else warning (OPT_Wabi, - "offset of empty base %qT may not be ABI-compliant and may" + "offset of empty base %qT may not be ABI-compliant and may" "change in a future version of GCC", BINFO_TYPE (binfo)); } @@ -3616,7 +3616,7 @@ build_base_field (record_layout_info rli, tree binfo, CLASSTYPE_NEARLY_EMPTY_P (t) = 0; else warning (OPT_Wabi, - "class %qT will be considered nearly empty in a " + "class %qT will be considered nearly empty in a " "future version of GCC", t); } } @@ -4361,7 +4361,7 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets) bitsize_unit_node), BINFO_OFFSET (vbase)))) warning (OPT_Wabi, - "offset of virtual base %qT is not ABI-compliant and " + "offset of virtual base %qT is not ABI-compliant and " "may change in a future version of GCC", basetype); @@ -4691,7 +4691,7 @@ layout_class_type (tree t, tree *virtuals_p) /* Versions of G++ before G++ 3.4 did not reset the DECL_MODE. */ warning (OPT_Wabi, - "the offset of %qD may not be ABI-compliant and may " + "the offset of %qD may not be ABI-compliant and may " "change in a future version of GCC", field); } else @@ -4735,9 +4735,9 @@ layout_class_type (tree t, tree *virtuals_p) /* The middle end uses the type of expressions to determine the possible range of expression values. In order to optimize "x.i > 7" to "false" for a 2-bit bitfield "i", the middle end - must be made aware of the width of "i", via its type. + must be made aware of the width of "i", via its type. - Because C++ does not have integer types of arbitrary width, + Because C++ does not have integer types of arbitrary width, we must (for the purposes of the front end) convert from the type assigned here to the declared type of the bitfield whenever a bitfield expression is used as an rvalue. @@ -4750,8 +4750,8 @@ layout_class_type (tree t, tree *virtuals_p) ftype = TREE_TYPE (field); width = tree_low_cst (DECL_SIZE (field), /*unsignedp=*/1); if (width != TYPE_PRECISION (ftype)) - TREE_TYPE (field) - = c_build_bitfield_integer_type (width, + TREE_TYPE (field) + = c_build_bitfield_integer_type (width, TYPE_UNSIGNED (ftype)); } @@ -4811,7 +4811,7 @@ layout_class_type (tree t, tree *virtuals_p) TYPE_SIZE_UNIT (base_t) = size_zero_node; if (warn_abi && !integer_zerop (rli_size_unit_so_far (rli))) warning (OPT_Wabi, - "layout of classes derived from empty class %qT " + "layout of classes derived from empty class %qT " "may change in a future version of GCC", t); } @@ -4907,7 +4907,7 @@ layout_class_type (tree t, tree *virtuals_p) splay_tree_delete (empty_base_offsets); if (CLASSTYPE_EMPTY_P (t) - && tree_int_cst_lt (sizeof_biggest_empty_class, + && tree_int_cst_lt (sizeof_biggest_empty_class, TYPE_SIZE_UNIT (t))) sizeof_biggest_empty_class = TYPE_SIZE_UNIT (t); } @@ -5440,7 +5440,7 @@ pushclass (tree type) current_class_stack_size *= 2; current_class_stack = XRESIZEVEC (struct class_stack_node, current_class_stack, - current_class_stack_size); + current_class_stack_size); } /* Insert a new entry on the class stack. */ @@ -5855,7 +5855,7 @@ resolve_address_of_overloaded_function (tree target_type, build_ptrmemfunc_type (build_pointer_type (instantiation_type)); else if (!is_reference) instantiation_type = build_pointer_type (instantiation_type); - if (can_convert_arg (target_type, instantiation_type, instantiation, + if (can_convert_arg (target_type, instantiation_type, instantiation, LOOKUP_NORMAL)) matches = tree_cons (instantiation, fn, matches); } @@ -5866,8 +5866,8 @@ resolve_address_of_overloaded_function (tree target_type, tree match = most_specialized_instantiation (matches); if (match != error_mark_node) - matches = tree_cons (TREE_PURPOSE (match), - NULL_TREE, + matches = tree_cons (TREE_PURPOSE (match), + NULL_TREE, NULL_TREE); } } @@ -6231,7 +6231,7 @@ get_vfield_name (tree type) type = BINFO_TYPE (binfo); buf = (char *) alloca (sizeof (VFIELD_NAME_FORMAT) - + TYPE_NAME_LENGTH (type) + 2); + + TYPE_NAME_LENGTH (type) + 2); sprintf (buf, VFIELD_NAME_FORMAT, IDENTIFIER_POINTER (constructor_name (type))); return get_identifier (buf); diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 4746103e618..7ded34fb696 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -320,7 +320,7 @@ gimplify_switch_stmt (tree *stmt_p) /* Hook into the middle of gimplifying an OMP_FOR node. This is required in order to properly gimplify CONTINUE statements. Here we merely manage the continue stack; the rest of the job is performed by the - regular gimplifier. */ + regular gimplifier. */ static enum gimplify_status cp_gimplify_omp_for (tree *expr_p) @@ -613,7 +613,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) if (is_invisiref_parm (stmt) /* Don't dereference parms in a thunk, pass the references through. */ && !(DECL_THUNK_P (current_function_decl) - && TREE_CODE (stmt) == PARM_DECL)) + && TREE_CODE (stmt) == PARM_DECL)) { *stmt_p = convert_from_reference (stmt); *walk_subtrees = 0; diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 38e2e5acd82..60503278930 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -125,11 +125,11 @@ cp_init_ts (void) tree_contains_struct[NAMESPACE_DECL][TS_DECL_WRTL] = 1; tree_contains_struct[USING_DECL][TS_DECL_WRTL] = 1; tree_contains_struct[TEMPLATE_DECL][TS_DECL_WRTL] = 1; - + tree_contains_struct[NAMESPACE_DECL][TS_DECL_COMMON] = 1; tree_contains_struct[USING_DECL][TS_DECL_COMMON] = 1; tree_contains_struct[TEMPLATE_DECL][TS_DECL_COMMON] = 1; - + tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1; tree_contains_struct[USING_DECL][TS_DECL_MINIMAL] = 1; tree_contains_struct[TEMPLATE_DECL][TS_DECL_MINIMAL] = 1; diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index 8dae00f742a..cb8369cb53b 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -203,19 +203,19 @@ has_c_linkage (tree decl) return DECL_EXTERN_C_P (decl); } -static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) +static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) htab_t shadowed_var_for_decl; /* Lookup a shadowed var for FROM, and return it if we find one. */ -tree +tree decl_shadowed_for_var_lookup (tree from) { struct tree_map *h, in; in.from = from; - h = (struct tree_map *) htab_find_with_hash (shadowed_var_for_decl, &in, - htab_hash_pointer (from)); + h = (struct tree_map *) htab_find_with_hash (shadowed_var_for_decl, &in, + htab_hash_pointer (from)); if (h) return h->to; return NULL_TREE; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 92537648104..4e83852a304 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -179,7 +179,7 @@ struct diagnostic_context; #define NON_THUNK_FUNCTION_CHECK(NODE) __extension__ \ ({ const tree __t = (NODE); \ if (TREE_CODE (__t) != FUNCTION_DECL && \ - TREE_CODE (__t) != TEMPLATE_DECL && __t->decl_common.lang_specific \ + TREE_CODE (__t) != TEMPLATE_DECL && __t->decl_common.lang_specific \ && __t->decl_common.lang_specific->decl_flags.thunk_p) \ tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \ __t; }) @@ -187,7 +187,7 @@ struct diagnostic_context; ({ const tree __t = (NODE); \ if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \ || !__t->decl_common.lang_specific->decl_flags.thunk_p) \ - tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \ + tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \ __t; }) #else #define NON_THUNK_FUNCTION_CHECK(NODE) (NODE) @@ -2090,7 +2090,7 @@ extern void decl_shadowed_for_var_insert (tree, tree); case, DECL_TEMPLATE_INFO is a TREE_LIST, whose TREE_PURPOSE is the TEMPLATE_DECL of which this entity is a specialization. The TREE_ TREE_VALUE is the template arguments used to specialize the - template. + template. In general, DECL_TEMPLATE_INFO is non-NULL only if DECL_USE_TEMPLATE is nonzero. However, for friends, we sometimes @@ -2102,7 +2102,7 @@ extern void decl_shadowed_for_var_insert (tree, tree); In this case, S::f is, from the point of view of the compiler, an instantiation of a template -- but, from the point of view of the language, each instantiation of S results in a wholly unrelated - global function f. */ + global function f. */ #define DECL_TEMPLATE_INFO(NODE) \ (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \ ->decl_flags.u.template_info) @@ -2521,7 +2521,7 @@ extern void decl_shadowed_for_var_insert (tree, tree); [basic.types] An object type is a (possibly cv-qualified) type that is not a - function type, not a reference type, and not a void type. + function type, not a reference type, and not a void type. Keep these checks in ascending order, for speed. */ #define TYPE_OBJ_P(NODE) \ @@ -2992,12 +2992,12 @@ extern void decl_shadowed_for_var_insert (tree, tree); #define OMP_FOR_GIMPLIFYING_P(NODE) \ (TREE_LANG_FLAG_0 (OMP_FOR_CHECK (NODE))) -/* A language-specific token attached to the OpenMP data clauses to +/* A language-specific token attached to the OpenMP data clauses to hold code (or code fragments) related to ctors, dtors, and op=. See semantics.c for details. */ #define CP_OMP_CLAUSE_INFO(NODE) \ TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \ - OMP_CLAUSE_COPYPRIVATE)) + OMP_CLAUSE_COPYPRIVATE)) /* These macros provide convenient access to the various _STMT nodes created when parsing template declarations. */ @@ -3793,8 +3793,8 @@ 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); +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); @@ -3855,7 +3855,7 @@ extern int cp_complete_array_type (tree *, tree, bool); extern tree build_ptrmemfunc_type (tree); extern tree build_ptrmem_type (tree, tree); /* the grokdeclarator prototype is in decl.h */ -extern tree build_this_parm (tree, cp_cv_quals); +extern tree build_this_parm (tree, cp_cv_quals); extern int copy_fn_p (tree); extern tree get_scope_of_declarator (const cp_declarator *); extern void grok_special_member_properties (tree); @@ -3913,7 +3913,7 @@ extern bool have_extern_spec; /* in decl2.c */ extern bool check_java_method (tree); -extern tree build_memfn_type (tree, tree, cp_cv_quals); +extern tree build_memfn_type (tree, tree, cp_cv_quals); extern void maybe_retrofit_in_chrg (tree); extern void maybe_make_one_only (tree); extern void grokclassfn (tree, tree, @@ -3947,7 +3947,7 @@ extern tree cxx_callgraph_analyze_expr (tree *, int *, tree); extern void mark_needed (tree); extern bool decl_needed_p (tree); extern void note_vague_linkage_fn (tree); -extern tree build_artificial_parm (tree, tree); +extern tree build_artificial_parm (tree, tree); /* in error.c */ extern void init_error (void); @@ -4165,7 +4165,7 @@ extern void stop_deferring_access_checks (void); extern void pop_deferring_access_checks (void); extern tree get_deferred_access_checks (void); extern void pop_to_parent_deferring_access_checks (void); -extern void perform_access_checks (tree); +extern void perform_access_checks (tree); extern void perform_deferred_access_checks (void); extern void perform_or_defer_access_check (tree, tree); extern int stmts_are_full_exprs_p (void); @@ -4245,7 +4245,7 @@ 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 void check_template_keyword (tree); extern tree finish_id_expression (tree, tree, tree, cp_id_kind *, bool, bool, bool *, @@ -4307,7 +4307,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 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); @@ -4347,10 +4347,10 @@ extern int cp_cannot_inline_tree_fn (tree*); extern tree cp_add_pending_fn_decls (void*,tree); extern int cp_auto_var_in_fn_p (tree,tree); extern tree fold_if_not_in_template (tree); -extern tree rvalue (tree); +extern tree rvalue (tree); extern tree convert_bitfield_to_declared_type (tree); -extern tree cp_save_expr (tree); - +extern tree cp_save_expr (tree); + /* in typeck.c */ extern int string_conv_p (tree, tree, int); extern tree cp_truthvalue_conversion (tree); @@ -4368,7 +4368,7 @@ extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code); extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool); #define cxx_sizeof_nowarn(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, false) extern tree inline_conversion (tree); -extern tree is_bitfield_expr_with_lowered_type (tree); +extern tree is_bitfield_expr_with_lowered_type (tree); extern tree decay_conversion (tree); extern tree build_class_member_access_expr (tree, tree, tree, bool); extern tree finish_class_member_access_expr (tree, tree, bool); @@ -4393,7 +4393,7 @@ extern tree build_modify_expr (tree, enum tree_code, tree); extern tree convert_for_initialization (tree, tree, tree, int, const char *, tree, int); extern int comp_ptr_ttypes (tree, tree); -extern bool comp_ptr_ttypes_const (tree, tree); +extern bool comp_ptr_ttypes_const (tree, tree); extern int ptr_reasonably_similar (tree, tree); extern tree build_ptrmemfunc (tree, tree, int, bool); extern int cp_type_quals (tree); diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 43fbe2b3bfa..5ceca61a4cb 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -300,12 +300,12 @@ pp_cxx_constant (cxx_pretty_printer *pp, tree t) { case STRING_CST: { - const bool in_parens = PAREN_STRING_LITERAL_P (t); - if (in_parens) - pp_cxx_left_paren (pp); - pp_c_constant (pp_c_base (pp), t); - if (in_parens) - pp_cxx_right_paren (pp); + const bool in_parens = PAREN_STRING_LITERAL_P (t); + if (in_parens) + pp_cxx_left_paren (pp); + pp_c_constant (pp_c_base (pp), t); + if (in_parens) + pp_cxx_right_paren (pp); } break; @@ -1757,7 +1757,7 @@ pp_cxx_namespace_alias_definition (cxx_pretty_printer *pp, tree t) pp_equal (pp); pp_cxx_whitespace (pp); if (DECL_CONTEXT (DECL_NAMESPACE_ALIAS (t))) - pp_cxx_nested_name_specifier (pp, + pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (DECL_NAMESPACE_ALIAS (t))); pp_cxx_qualified_id (pp, DECL_NAMESPACE_ALIAS (t)); pp_cxx_semicolon (pp); @@ -1803,8 +1803,7 @@ pp_cxx_template_parameter_list (cxx_pretty_printer *pp, tree t) typename identifier(opt) typename identifier(opt) = type-id template < template-parameter-list > class identifier(opt) - template < template-parameter-list > class identifier(opt) = template-name -*/ + template < template-parameter-list > class identifier(opt) = template-name */ static void pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e005d6366b3..eb289d6ab32 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -141,9 +141,7 @@ static tree next_initializable_field (tree); Used by RTTI tree type_info_type_node, tinfo_decl_id, tinfo_decl_type; - tree tinfo_var_id; - -*/ + tree tinfo_var_id; */ tree cp_global_trees[CPTI_MAX]; @@ -204,7 +202,7 @@ struct named_label_entry GTY(()) This is initially set to the binding level in which the label is defined, but is modified as scopes are closed. */ struct cp_binding_level *binding_level; - /* The head of the names list that was current when the label was + /* The head of the names list that was current when the label was defined, or the inner scope popped. These are the decls that will be skipped when jumping to the label. */ tree names_in_scope; @@ -1087,7 +1085,7 @@ check_redeclaration_exception_specification (tree new_decl, if ((pedantic || ! DECL_IN_SYSTEM_HEADER (old_decl)) && ! DECL_IS_BUILTIN (old_decl) && flag_exceptions - && !comp_except_specs (new_exceptions, old_exceptions, + && !comp_except_specs (new_exceptions, old_exceptions, /*exact=*/true)) { error ("declaration of %qF throws different exceptions", new_decl); @@ -1638,7 +1636,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) { DECL_THIS_EXTERN (newdecl) |= DECL_THIS_EXTERN (olddecl); DECL_INITIALIZED_P (newdecl) |= DECL_INITIALIZED_P (olddecl); - DECL_NONTRIVIALLY_INITIALIZED_P (newdecl) + DECL_NONTRIVIALLY_INITIALIZED_P (newdecl) |= DECL_NONTRIVIALLY_INITIALIZED_P (olddecl); DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (newdecl) |= DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (olddecl); @@ -1914,7 +1912,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl); DECL_VISIBILITY_SPECIFIED (newdecl) = 1; } - /* Init priority used to be merged from newdecl to olddecl by the memcpy, + /* Init priority used to be merged from newdecl to olddecl by the memcpy, so keep this behavior. */ if (TREE_CODE (newdecl) == VAR_DECL && DECL_HAS_INIT_PRIORITY_P (newdecl)) { @@ -1976,7 +1974,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) memcpy ((char *) olddecl + sizeof (struct tree_common), (char *) newdecl + sizeof (struct tree_common), sizeof (struct tree_decl_common) - sizeof (struct tree_common)); - switch (TREE_CODE (olddecl)) + switch (TREE_CODE (olddecl)) { case LABEL_DECL: case VAR_DECL: @@ -2282,7 +2280,7 @@ identify_goto (tree decl, const location_t *locus) /* Check that a single previously seen jump to a newly defined label is OK. DECL is the LABEL_DECL or 0; LEVEL is the binding_level for the jump context; NAMES are the names in scope in LEVEL at the jump - context; LOCUS is the source position of the jump or 0. Returns + context; LOCUS is the source position of the jump or 0. Returns true if all is well. */ static bool @@ -3320,7 +3318,7 @@ cp_make_fname_decl (tree id, int type_dep) while (b->level_chain->kind != sk_function_parms) b = b->level_chain; pushdecl_with_scope (decl, b, /*is_friend=*/false); - cp_finish_decl (decl, init, /*init_const_expr_p=*/false, NULL_TREE, + cp_finish_decl (decl, init, /*init_const_expr_p=*/false, NULL_TREE, LOOKUP_ONLYCONVERTING); } else @@ -4405,7 +4403,7 @@ reshape_init_vector (tree type, reshape_iter *d) { error ("invalid type %qT as initializer for a vector of type %qT", TREE_TYPE (d->cur->value), type); - value = error_mark_node; + value = error_mark_node; } ++d->cur; return value; @@ -4461,7 +4459,7 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p) { if (pedantic) pedwarn ("ISO C++ does not allow designated initializers"); - + field = lookup_field_1 (type, d->cur->index, /*want_type=*/false); if (!field || TREE_CODE (field) != FIELD_DECL) @@ -4517,7 +4515,7 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p) error ("braces around scalar initializer for type %qT", type); init = error_mark_node; } - + d->cur++; return init; } @@ -4550,7 +4548,7 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p) tree str_init = init; /* Strip one level of braces if and only if they enclose a single - element (as allowed by [dcl.init.string]). */ + element (as allowed by [dcl.init.string]). */ if (!first_initializer_p && TREE_CODE (str_init) == CONSTRUCTOR && VEC_length (constructor_elt, CONSTRUCTOR_ELTS (str_init)) == 1) @@ -4558,9 +4556,9 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p) str_init = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (str_init), 0)->value; } - + /* If it's a string literal, then it's the initializer for the array - as a whole. Otherwise, continue with normal initialization for + as a whole. Otherwise, continue with normal initialization for array types (one value per array element). */ if (TREE_CODE (str_init) == STRING_CST) { @@ -4707,7 +4705,7 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) else if (init) { /* Do not reshape constructors of vectors (they don't need to be - reshaped. */ + reshaped. */ if (TREE_CODE (init) == CONSTRUCTOR && !COMPOUND_LITERAL_P (init) && !TREE_TYPE (init)) /* ptrmemfunc */ @@ -4982,7 +4980,7 @@ initialize_artificial_var (tree decl, tree init) if the (init) syntax was used. */ void -cp_finish_decl (tree decl, tree init, bool init_const_expr_p, +cp_finish_decl (tree decl, tree init, bool init_const_expr_p, tree asmspec_tree, int flags) { tree type; @@ -5135,7 +5133,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, occurs. Therefore, in: struct S { static const int i = 7 / 0; }; - + we issue an error at this point. It would probably be better to forbid division by zero in integral constant expressions. */ @@ -5808,7 +5806,7 @@ check_class_member_definition_namespace (tree decl) /* Build a PARM_DECL for the "this" parameter. TYPE is the METHOD_TYPE for a non-static member function; QUALS are the cv-qualifiers that apply to the function. */ - + tree build_this_parm (tree type, cp_cv_quals quals) { @@ -5825,7 +5823,7 @@ build_this_parm (tree type, cp_cv_quals quals) parm = build_artificial_parm (this_identifier, qual_type); cp_apply_type_quals_to_decl (this_quals, parm); return parm; -} +} /* CTYPE is class type, or null if non-class. TYPE is type this FUNCTION_DECL should have, either FUNCTION_TYPE @@ -5993,7 +5991,7 @@ grokfndecl (tree ctype, tree newtype; error ("%<::main%> must return %"); newtype = build_function_type (integer_type_node, - oldtypeargs); + oldtypeargs); TREE_TYPE (decl) = newtype; } inlinep = 0; @@ -6990,7 +6988,7 @@ grokdeclarator (const cp_declarator *declarator, } /* [dcl.fct.edf] - + The declarator in a function-definition shall have the form D1 ( parameter-declaration-clause) ... */ if (funcdef_flag && innermost_code != cdk_function) @@ -7502,15 +7500,15 @@ grokdeclarator (const cp_declarator *declarator, is the same as the class name, and we are defining a function, then it is a constructor/destructor, and therefore returns a void type. */ - + /* ISO C++ 12.4/2. A destructor may not be declared const or volatile. A destructor may not be static. - + ISO C++ 12.1. A constructor may not be declared const or volatile. A constructor may not be virtual. A constructor may not be static. */ - if (staticp == 2) + if (staticp == 2) error ((flags == DTOR_FLAG) ? "destructor cannot be static member function" : "constructor cannot be static member function"); @@ -7609,7 +7607,7 @@ grokdeclarator (const cp_declarator *declarator, && (TREE_CODE (type) == FUNCTION_TYPE || memfn_quals)) { memfn_quals |= cp_type_quals (type); - type = build_memfn_type (type, + type = build_memfn_type (type, declarator->u.pointer.class_type, memfn_quals); memfn_quals = TYPE_UNQUALIFIED; @@ -7721,7 +7719,7 @@ grokdeclarator (const cp_declarator *declarator, !COMPLETE_TYPE_P (ctype) && (/* If the function is being defined, then qualifying type must certainly be complete. */ - funcdef_flag + funcdef_flag /* A friend declaration of "T::f" is OK, even if "T" is a template parameter. But, if this function is not a friend, the qualifying type @@ -7849,14 +7847,14 @@ grokdeclarator (const cp_declarator *declarator, in typenames, fields or parameters. */ if (current_lang_name == lang_name_java) TYPE_FOR_JAVA (type) = 1; - + /* This declaration: - typedef void f(int) const; + typedef void f(int) const; - declares a function type which is not a member of any + declares a function type which is not a member of any particular class, but which is cv-qualified; for - example "f S::*" declares a pointer to a const-qualified + example "f S::*" declares a pointer to a const-qualified member function of S. We record the cv-qualification in the function type. */ if (memfn_quals && TREE_CODE (type) == FUNCTION_TYPE) @@ -7931,7 +7929,7 @@ grokdeclarator (const cp_declarator *declarator, || (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl))) C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1; - bad_specifiers (decl, "type", virtualp, + bad_specifiers (decl, "type", virtualp, memfn_quals != TYPE_UNQUALIFIED, inlinep, friendp, raises != NULL_TREE); @@ -8105,7 +8103,7 @@ grokdeclarator (const cp_declarator *declarator, { decl = cp_build_parm_decl (unqualified_id, type); - bad_specifiers (decl, "parameter", virtualp, + bad_specifiers (decl, "parameter", virtualp, memfn_quals != TYPE_UNQUALIFIED, inlinep, friendp, raises != NULL_TREE); } @@ -8308,7 +8306,7 @@ grokdeclarator (const cp_declarator *declarator, } decl = do_friend (ctype, unqualified_id, decl, - *attrlist, flags, + *attrlist, flags, funcdef_flag); return decl; } @@ -8388,7 +8386,7 @@ grokdeclarator (const cp_declarator *declarator, } } - bad_specifiers (decl, "field", virtualp, + bad_specifiers (decl, "field", virtualp, memfn_quals != TYPE_UNQUALIFIED, inlinep, friendp, raises != NULL_TREE); } @@ -8493,7 +8491,7 @@ grokdeclarator (const cp_declarator *declarator, initialized, (type_quals & TYPE_QUAL_CONST) != 0, ctype ? ctype : in_namespace); - bad_specifiers (decl, "variable", virtualp, + bad_specifiers (decl, "variable", virtualp, memfn_quals != TYPE_UNQUALIFIED, inlinep, friendp, raises != NULL_TREE); @@ -10215,7 +10213,7 @@ check_function_type (tree decl, tree current_function_parms) if (!COMPLETE_OR_VOID_TYPE_P (return_type)) { tree args = TYPE_ARG_TYPES (fntype); - + error ("return type %q#T is incomplete", return_type); /* Make it return void instead. */ @@ -10490,7 +10488,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) ignore interface specifications for compiler-generated functions. */ && !DECL_ARTIFICIAL (decl1)); - + if (DECL_INTERFACE_KNOWN (decl1)) { tree ctx = decl_function_context (decl1); @@ -10790,7 +10788,7 @@ begin_destructor_body (void) tables. */ initialize_vtbl_ptrs (current_class_ptr); finish_compound_stmt (compound_stmt); - + /* And insert cleanups for our bases and members so that they will be properly destroyed if we throw. */ push_base_cleanups (); @@ -10821,10 +10819,10 @@ finish_destructor_body (void) an implicit definition), non-placement operator delete shall be looked up in the scope of the destructor's class and if found shall be accessible and unambiguous. */ - exprstmt = build_op_delete_call(DELETE_EXPR, current_class_ptr, + exprstmt = build_op_delete_call(DELETE_EXPR, current_class_ptr, virtual_size, - /*global_p=*/false, - /*placement=*/NULL_TREE, + /*global_p=*/false, + /*placement=*/NULL_TREE, /*alloc_fn=*/NULL_TREE); if_stmt = begin_if_stmt (); @@ -10895,7 +10893,7 @@ finish_function_body (tree compstmt) { if (compstmt == NULL_TREE) return; - + /* Close the block. */ finish_compound_stmt (compstmt); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 0949944d54f..a30fed3064f 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -708,7 +708,7 @@ note_vague_linkage_var (tree var) The other parameters are as for cp_finish_decl. */ void -finish_static_data_member_decl (tree decl, +finish_static_data_member_decl (tree decl, tree init, bool init_const_expr_p, tree asmspec_tree, int flags) @@ -753,7 +753,7 @@ finish_static_data_member_decl (tree decl, /* DECLARATOR and DECLSPECS correspond to a class member. The other parameters are as for cp_finish_decl. Return the DECL for the - class member declared. */ + class member declared. */ tree grokfield (const cp_declarator *declarator, @@ -907,7 +907,7 @@ grokfield (const cp_declarator *declarator, error ("% specifiers are not permitted on non-static data members"); if (DECL_INITIAL (value) == error_mark_node) init = error_mark_node; - cp_finish_decl (value, init, /*init_const_expr_p=*/false, + cp_finish_decl (value, init, /*init_const_expr_p=*/false, NULL_TREE, flags); DECL_INITIAL (value) = init; DECL_IN_AGGR_P (value) = 1; @@ -917,9 +917,9 @@ grokfield (const cp_declarator *declarator, if (asmspec) set_user_assembler_name (value, asmspec); - cp_finish_decl (value, - /*init=*/NULL_TREE, - /*init_const_expr_p=*/false, + cp_finish_decl (value, + /*init=*/NULL_TREE, + /*init_const_expr_p=*/false, asmspec_tree, flags); /* Pass friends back this way. */ @@ -1608,7 +1608,7 @@ determine_visibility (tree decl) && DECL_VISIBILITY_SPECIFIED (decl) && (!class_type || !CLASSTYPE_VISIBILITY_SPECIFIED (class_type))) targetm.cxx.determine_class_data_visibility (decl); - } + } } static void @@ -2420,12 +2420,12 @@ one_static_initialization_or_destruction (tree decl, tree init, bool initp) if (initp) { if (init) - finish_expr_stmt (init); + finish_expr_stmt (init); /* If we're using __cxa_atexit, register a function that calls the - destructor for the object. */ + destructor for the object. */ if (flag_use_cxa_atexit) - finish_expr_stmt (register_dtor_fn (decl)); + finish_expr_stmt (register_dtor_fn (decl)); } else finish_expr_stmt (build_cleanup (decl)); @@ -2498,7 +2498,7 @@ do_static_initialization_or_destruction (tree vars, bool initp) node = TREE_CHAIN (node)) /* Do one initialization or destruction. */ one_static_initialization_or_destruction (TREE_VALUE (node), - TREE_PURPOSE (node), initp); + TREE_PURPOSE (node), initp); /* Finish up the priority if-stmt body. */ finish_then_clause (priority_if_stmt); @@ -2994,7 +2994,7 @@ cp_finish_file (void) DECL_EXTERNAL appropriately, so there's no need to check again, and we do not want to clear DECL_EXTERNAL if a previous call to import_export_decl set it. - + This is done in a separate for cycle, because if some deferred function is contained in another deferred function later in deferred_fns varray, @@ -3087,7 +3087,7 @@ cp_finish_file (void) else { /* If we have a ctor or this is obj-c++ and we need a static init, - call generate_ctor_or_dtor_function. */ + call generate_ctor_or_dtor_function. */ if (static_ctors || (c_dialect_objc () && objc_static_init_needed_p ())) generate_ctor_or_dtor_function (/*constructor_p=*/true, DEFAULT_INIT_PRIORITY, &locus); @@ -3116,7 +3116,7 @@ cp_finish_file (void) if (VEC_length (tree, pending_statics) != 0) { check_global_declarations (VEC_address (tree, pending_statics), - VEC_length (tree, pending_statics)); + VEC_length (tree, pending_statics)); emit_debug_global_declarations (VEC_address (tree, pending_statics), VEC_length (tree, pending_statics)); } @@ -3251,7 +3251,7 @@ mark_used (tree decl) } TREE_USED (decl) = 1; - /* If we don't need a value, then we don't need to synthesize DECL. */ + /* If we don't need a value, then we don't need to synthesize DECL. */ if (skip_evaluation) return; /* Normally, we can wait until instantiation-time to synthesize @@ -3275,9 +3275,9 @@ mark_used (tree decl) saved_processing_template_decl = processing_template_decl; processing_template_decl = 0; } - + if (processing_template_decl) - return; + return; if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl) && !TREE_ASM_WRITTEN (decl)) @@ -3329,12 +3329,12 @@ mark_used (tree decl) template, we now know that we will need to actually do the instantiation. We check that DECL is not an explicit instantiation because that is not checked in instantiate_decl. - + We put off instantiating functions in order to improve compile times. Maintaining a stack of active functions is expensive, and the inliner knows to instantiate any functions it might need. Therefore, we always try to defer instantiation. */ - instantiate_decl (decl, /*defer_ok=*/true, + instantiate_decl (decl, /*defer_ok=*/true, /*expl_inst_class_mem_p=*/false); processing_template_decl = saved_processing_template_decl; diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 8696ff9731e..91a73cca4fc 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1396,9 +1396,9 @@ dump_expr (tree t, int flags) if (TREE_CODE (fn) == ADDR_EXPR) fn = TREE_OPERAND (fn, 0); - /* Nobody is interested in seeing the guts of vcalls. */ - if (TREE_CODE (fn) == OBJ_TYPE_REF) - fn = resolve_virtual_fun_from_obj_type_ref (fn); + /* Nobody is interested in seeing the guts of vcalls. */ + if (TREE_CODE (fn) == OBJ_TYPE_REF) + fn = resolve_virtual_fun_from_obj_type_ref (fn); if (TREE_TYPE (fn) != NULL_TREE && NEXT_CODE (fn) == METHOD_TYPE) { diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 42759104400..a02fc2f5533 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -444,7 +444,7 @@ expand_start_catch_block (tree decl) /* If the C++ object needs constructing, we need to do that before calling __cxa_begin_catch, so that std::uncaught_exception gets the right value during the copy constructor. */ - else if (flag_use_cxa_get_exception_ptr + else if (flag_use_cxa_get_exception_ptr && TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))) { exp = do_get_exception_ptr (); @@ -460,7 +460,7 @@ expand_start_catch_block (tree decl) tree init = do_begin_catch (); exp = create_temporary_var (ptr_type_node); DECL_REGISTER (exp) = 1; - cp_finish_decl (exp, init, /*init_const_expr=*/false, + cp_finish_decl (exp, init, /*init_const_expr=*/false, NULL_TREE, LOOKUP_ONLYCONVERTING); initialize_handler_parm (decl, exp); } @@ -664,9 +664,9 @@ build_throw (tree exp) fn = push_throw_library_fn (fn, tmp); } - /* [except.throw] - - A throw-expression initializes a temporary object, the type + /* [except.throw] + + A throw-expression initializes a temporary object, the type of which is determined by removing any top-level cv-qualifiers from the static type of the operand of throw and adjusting the type from "array of T" or "function return @@ -702,7 +702,7 @@ build_throw (tree exp) if (CLASS_TYPE_P (temp_type)) { /* Call the copy constructor. */ - exp = (build_special_member_call + exp = (build_special_member_call (object, complete_ctor_identifier, build_tree_list (NULL_TREE, exp), TREE_TYPE (object), @@ -714,7 +714,7 @@ build_throw (tree exp) } } else - exp = build2 (INIT_EXPR, temp_type, object, + exp = build2 (INIT_EXPR, temp_type, object, decay_conversion (exp)); /* Pre-evaluate the thrown expression first, since if we allocated diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 8a338faa549..590036b882c 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1320,7 +1320,7 @@ build_offset_ref (tree type, tree member, bool address_p) return member; if (dependent_type_p (type) || type_dependent_expression_p (member)) - return build_qualified_name (NULL_TREE, type, member, + return build_qualified_name (NULL_TREE, type, member, /*template_p=*/false); gcc_assert (TYPE_P (type)); @@ -1339,7 +1339,7 @@ build_offset_ref (tree type, tree member, bool address_p) } /* Entities other than non-static members need no further - processing. */ + processing. */ if (TREE_CODE (member) == TYPE_DECL) return member; if (TREE_CODE (member) == VAR_DECL || TREE_CODE (member) == CONST_DECL) @@ -1451,7 +1451,7 @@ static tree constant_value_1 (tree decl, bool integral_p) { while (TREE_CODE (decl) == CONST_DECL - || (integral_p + || (integral_p ? DECL_INTEGRAL_CONSTANT_VAR_P (decl) : (TREE_CODE (decl) == VAR_DECL && CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl))))) @@ -1466,7 +1466,7 @@ constant_value_1 (tree decl, bool integral_p) instantiation time. */ if (DECL_CLASS_SCOPE_P (decl) && CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl)) - && uses_template_parms (CLASSTYPE_TI_ARGS + && uses_template_parms (CLASSTYPE_TI_ARGS (DECL_CONTEXT (decl)))) { ++processing_template_decl; @@ -1520,7 +1520,7 @@ integral_constant_value (tree decl) tree decl_constant_value (tree decl) { - return constant_value_1 (decl, + return constant_value_1 (decl, /*integral_p=*/processing_template_decl); } @@ -1548,9 +1548,9 @@ build_raw_new_expr (tree placement, tree type, tree nelts, tree init, int use_global_new) { tree new_expr; - - new_expr = build4 (NEW_EXPR, build_pointer_type (type), placement, type, - nelts, init); + + new_expr = build4 (NEW_EXPR, build_pointer_type (type), placement, type, + nelts, init); NEW_EXPR_USE_GLOBAL (new_expr) = use_global_new; TREE_SIDE_EFFECTS (new_expr) = 1; @@ -1565,7 +1565,6 @@ build_raw_new_expr (tree placement, tree type, tree nelts, tree init, static tree build_new_1 (tree placement, tree type, tree nelts, tree init, bool globally_qualified_p) - { tree size, rval; /* True iff this is a call to "operator new[]" instead of just @@ -1894,8 +1893,8 @@ build_new_1 (tree placement, tree type, tree nelts, tree init, = build_vec_init (init_expr, cp_build_binary_op (MINUS_EXPR, outer_nelts, integer_one_node), - init, - explicit_default_init_p, + init, + explicit_default_init_p, /*from_array=*/0); /* An array initialization is stable because the initialization @@ -1920,14 +1919,14 @@ build_new_1 (tree placement, tree type, tree nelts, tree init, { /* We are processing something like `new int (10)', which means allocate an int, and initialize it with 10. */ - + if (TREE_CODE (init) == TREE_LIST) - init = build_x_compound_expr_from_list (init, + init = build_x_compound_expr_from_list (init, "new initializer"); else gcc_assert (TREE_CODE (init) != CONSTRUCTOR || TREE_TYPE (init) != NULL_TREE); - + init_expr = build_modify_expr (init_expr, INIT_EXPR, init); stable = stabilize_init (init_expr, &init_preeval_expr); } @@ -2098,7 +2097,7 @@ build_new (tree placement, tree type, tree nelts, tree init, array with no elements. The pointer returned by the new-expression is non-null. [Note: If the library allocation function is called, the pointer returned is distinct from the - pointer to any other object.] + pointer to any other object.] However, that is not generally useful, so we issue a warning. */ @@ -2276,7 +2275,7 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, deallocate_expr = build_op_delete_call (VEC_DELETE_EXPR, base_tbd, virtual_size, use_global_delete & 1, - /*placement=*/NULL_TREE, + /*placement=*/NULL_TREE, /*alloc_fn=*/NULL_TREE); } @@ -2370,7 +2369,7 @@ get_temp_regvar (tree type, tree init) but use assignment instead of initialization. */ tree -build_vec_init (tree base, tree maxindex, tree init, +build_vec_init (tree base, tree maxindex, tree init, bool explicit_default_init_p, int from_array) { @@ -2579,12 +2578,12 @@ build_vec_init (tree base, tree maxindex, tree init, sorry ("cannot initialize multi-dimensional array with initializer"); elt_init = build_vec_init (build1 (INDIRECT_REF, type, base), - 0, 0, + 0, 0, /*explicit_default_init_p=*/false, 0); } else if (!TYPE_NEEDS_CONSTRUCTING (type)) - elt_init = (build_modify_expr + elt_init = (build_modify_expr (to, INIT_EXPR, build_zero_init (type, size_one_node, /*static_storage_p=*/false))); @@ -2763,8 +2762,8 @@ build_delete (tree type, tree addr, special_function_kind auto_delete, if (auto_delete != sfk_deleting_destructor) return void_zero_node; - return build_op_delete_call (DELETE_EXPR, addr, - cxx_sizeof_nowarn (type), + return build_op_delete_call (DELETE_EXPR, addr, + cxx_sizeof_nowarn (type), use_global_delete, /*placement=*/NULL_TREE, /*alloc_fn=*/NULL_TREE); @@ -2814,7 +2813,7 @@ build_delete (tree type, tree addr, special_function_kind auto_delete, /* Make sure we have access to the member op delete, even though we'll actually be calling it from the destructor. */ build_op_delete_call (DELETE_EXPR, addr, cxx_sizeof_nowarn (type), - /*global_p=*/false, + /*global_p=*/false, /*placement=*/NULL_TREE, /*alloc_fn=*/NULL_TREE); } diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 8e6ffcf4e0b..b8702924d7d 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -44,9 +44,7 @@ mangle_vtbl_for_type: virtual table data mangle_vtt_for_type: VTT data mangle_ctor_vtbl_for_type: `C-in-B' constructor virtual table data - mangle_thunk: thunk function or entry - -*/ + mangle_thunk: thunk function or entry */ #include "config.h" #include "system.h" @@ -2741,8 +2739,7 @@ mangle_call_offset (const tree fixed_offset, const tree virtual_offset) ::= T ::= Tc - -*/ + */ tree mangle_thunk (tree fn_decl, const int this_adjusting, tree fixed_offset, diff --git a/gcc/cp/method.c b/gcc/cp/method.c index ddf79bf8e66..1f06229eb1c 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1077,7 +1077,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p) DECL_ARGUMENTS (fn) = cp_build_parm_decl (NULL_TREE, rhs_parm_type); TREE_READONLY (DECL_ARGUMENTS (fn)) = 1; } - /* Add the "this" parameter. */ + /* Add the "this" parameter. */ this_parm = build_this_parm (fn_type, TYPE_UNQUALIFIED); TREE_CHAIN (this_parm) = DECL_ARGUMENTS (fn); DECL_ARGUMENTS (fn) = this_parm; diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index e41d54f3f65..bf835d7df77 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -1100,11 +1100,11 @@ check_for_out_of_scope_variable (tree decl) if (!(TREE_CODE (decl) == VAR_DECL && DECL_DEAD_FOR_LOCAL (decl))) return decl; - shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (decl) + shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (decl) ? DECL_SHADOWED_FOR_VAR (decl) : NULL_TREE ; while (shadowed != NULL_TREE && TREE_CODE (shadowed) == VAR_DECL && DECL_DEAD_FOR_LOCAL (shadowed)) - shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (shadowed) + shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (shadowed) ? DECL_SHADOWED_FOR_VAR (shadowed) : NULL_TREE; if (!shadowed) shadowed = IDENTIFIER_NAMESPACE_VALUE (DECL_NAME (decl)); @@ -2774,14 +2774,14 @@ do_class_using_decl (tree scope, tree name) } scope_dependent_p = dependent_type_p (scope); - name_dependent_p = (scope_dependent_p + name_dependent_p = (scope_dependent_p || (IDENTIFIER_TYPENAME_P (name) && dependent_type_p (TREE_TYPE (name)))); bases_dependent_p = false; if (processing_template_decl) for (binfo = TYPE_BINFO (current_class_type), i = 0; - BINFO_BASE_ITERATE (binfo, i, base_binfo); + BINFO_BASE_ITERATE (binfo, i, base_binfo); i++) if (dependent_type_p (TREE_TYPE (base_binfo))) { @@ -2794,8 +2794,8 @@ do_class_using_decl (tree scope, tree name) /* From [namespace.udecl]: A using-declaration used as a member-declaration shall refer to a - member of a base class of the class being defined. - + member of a base class of the class being defined. + In general, we cannot check this constraint in a template because we do not know the entire set of base classes of the current class type. However, if all of the base classes are @@ -2817,7 +2817,7 @@ do_class_using_decl (tree scope, tree name) decl = lookup_member (binfo, name, 0, false); if (!decl) { - error ("no members matching %<%T::%D%> in %q#T", scope, name, + error ("no members matching %<%T::%D%> in %q#T", scope, name, scope); return NULL_TREE; } @@ -4796,7 +4796,7 @@ pushtag (tree name, tree type, tag_scope scope) b = b->level_chain; gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); - + /* Do C++ gratuitous typedefing. */ if (IDENTIFIER_TYPE_VALUE (name) != type) { @@ -4807,7 +4807,7 @@ pushtag (tree name, tree type, tag_scope scope) if (! context) { tree cs = current_scope (); - + if (scope == ts_current) context = cs; else if (cs != NULL_TREE && TYPE_P (cs)) @@ -4844,7 +4844,7 @@ pushtag (tree name, tree type, tag_scope scope) (type, scope == ts_within_enclosing_non_class, b); if (decl == error_mark_node) POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl); - + if (! in_class) set_identifier_type_value_with_scope (name, tdef, b); @@ -4879,11 +4879,11 @@ pushtag (tree name, tree type, tag_scope scope) { maybe_add_class_template_decl_list (current_class_type, type, /*friend_p=*/0); - + if (CLASSTYPE_NESTED_UTDS (current_class_type) == NULL) CLASSTYPE_NESTED_UTDS (current_class_type) = binding_table_new (SCOPE_DEFAULT_HT_SIZE); - + binding_table_insert (CLASSTYPE_NESTED_UTDS (current_class_type), name, type); } diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h index ede7747d00d..0d99f9beafa 100644 --- a/gcc/cp/name-lookup.h +++ b/gcc/cp/name-lookup.h @@ -121,7 +121,7 @@ typedef enum scope_kind { specialization. Since, by definition, an explicit specialization is introduced by "template <>", this scope is always empty. */ - sk_omp /* An OpenMP structured block. */ + sk_omp /* An OpenMP structured block. */ } scope_kind; /* The scope where the class/struct/union/enum tag applies. */ diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0628b22d80c..ee807295e6b 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -513,7 +513,7 @@ cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n) /* N is 1-based, not zero-based. */ gcc_assert (n > 0); - + if (cp_lexer_debugging_p (lexer)) fprintf (cp_lexer_debug_stream, "cp_lexer: peeking ahead %ld at token: ", (long)n); @@ -2132,8 +2132,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id) form `ID a', where `ID' is an id-expression and `a' is a plain identifier. Usually, `ID' should name a type, but if we got here it means that it does not. We try to emit the best possible error message depending on - how exactly the id-expression looks like. -*/ + how exactly the id-expression looks like. */ static bool cp_parser_parse_and_diagnose_invalid_type_name (cp_parser *parser) @@ -2455,7 +2454,7 @@ cp_parser_make_typename_type (cp_parser *parser, tree scope, tree id) if (TREE_CODE (id) == IDENTIFIER_NODE) { result = make_typename_type (scope, id, typename_type, - /*complain=*/tf_none); + /*complain=*/tf_none); if (result == error_mark_node) cp_parser_diagnose_invalid_type_name (parser, scope, id); return result; @@ -2711,25 +2710,25 @@ cp_parser_translation_unit (cp_parser* parser) } cp_parser_declaration_seq_opt (parser); - + /* If there are no tokens left then all went well. */ if (cp_lexer_next_token_is (parser->lexer, CPP_EOF)) { /* Get rid of the token array; we don't need it any more. */ cp_lexer_destroy (parser->lexer); parser->lexer = NULL; - + /* This file might have been a context that's implicitly extern - "C". If so, pop the lang context. (Only relevant for PCH.) */ + "C". If so, pop the lang context. (Only relevant for PCH.) */ if (parser->implicit_extern_c) - { - pop_lang_context (); - parser->implicit_extern_c = false; - } - + { + pop_lang_context (); + parser->implicit_extern_c = false; + } + /* Finish up. */ finish_translation_unit (); - + success = true; } else @@ -2737,7 +2736,7 @@ cp_parser_translation_unit (cp_parser* parser) cp_parser_error (parser, "expected declaration"); success = false; } - + /* Make sure the declarator obstack was fully cleaned up. */ gcc_assert (obstack_next_free (&declarator_obstack) == declarator_obstack_base); @@ -3094,7 +3093,7 @@ cp_parser_primary_expression (cp_parser *parser, } } - decl = (finish_id_expression + decl = (finish_id_expression (id_expression, decl, parser->scope, idk, parser->integral_constant_expression_p, @@ -3292,7 +3291,7 @@ static tree cp_parser_unqualified_id (cp_parser* parser, bool template_keyword_p, bool check_dependency_p, - bool declarator_p, + bool declarator_p, bool optional_p) { cp_token *token; @@ -3691,7 +3690,7 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, error ("%qD used without template parameters", decl); else if (ambiguous_decls) { - error ("reference to %qD is ambiguous", + error ("reference to %qD is ambiguous", token->value); print_candidates (ambiguous_decls); decl = error_mark_node; @@ -3773,7 +3772,7 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, /* Purge all subsequent tokens. */ cp_lexer_purge_tokens_after (parser->lexer, start); } - + if (start) pop_to_parent_deferring_access_checks (); @@ -4133,8 +4132,8 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p) } /* It must be a primary-expression. */ - postfix_expression - = cp_parser_primary_expression (parser, address_p, cast_p, + postfix_expression + = cp_parser_primary_expression (parser, address_p, cast_p, /*template_arg_p=*/false, &idk); } @@ -4507,8 +4506,8 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser, pseudo-destructor-name. */ bool template_p; /* Parse the id-expression. */ - name = (cp_parser_id_expression - (parser, + name = (cp_parser_id_expression + (parser, cp_parser_optional_template_keyword (parser), /*check_dependency_p=*/true, &template_p, @@ -5969,8 +5968,7 @@ cp_parser_constant_expression (cp_parser* parser, offsetof-member-designator: id-expression | offsetof-member-designator "." id-expression - | offsetof-member-designator "[" expression "]" -*/ + | offsetof-member-designator "[" expression "]" */ static tree cp_parser_builtin_offsetof (cp_parser *parser) @@ -6061,7 +6059,7 @@ cp_parser_builtin_offsetof (cp_parser *parser) declaration-statement try-block - IN_COMPOUND is true when the statement is nested inside a + IN_COMPOUND is true when the statement is nested inside a cp_parser_compound_statement; this matters for certain pragmas. */ static void @@ -6149,7 +6147,7 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr, /* Only certain OpenMP pragmas are attached to statements, and thus are considered statements themselves. All others are not. In the context of a compound, accept the pragma as a "statement" and - return so that we can check for a close brace. Otherwise we + return so that we can check for a close brace. Otherwise we require a real statement and must go back and read one. */ if (in_compound) cp_parser_pragma (parser, pragma_compound); @@ -6545,7 +6543,7 @@ cp_parser_condition (cp_parser* parser) attributes, /*prefix_attributes=*/NULL_TREE, &pushed_scope); /* Parse the assignment-expression. */ - initializer + initializer = cp_parser_constant_expression (parser, /*allow_non_constant_p=*/true, &non_constant_p); @@ -6554,7 +6552,7 @@ cp_parser_condition (cp_parser* parser) /* Process the initializer. */ cp_finish_decl (decl, - initializer, !non_constant_p, + initializer, !non_constant_p, asm_specification, LOOKUP_ONLYCONVERTING); @@ -7673,8 +7671,8 @@ cp_parser_function_specifier_opt (cp_parser* parser, case RID_VIRTUAL: /* 14.5.2.3 [temp.mem] - - A member function template shall not be virtual. */ + + A member function template shall not be virtual. */ if (PROCESSING_REAL_TEMPLATE_DECL_P ()) error ("templates may not be %"); else if (decl_specs) @@ -9062,8 +9060,8 @@ cp_parser_template_argument_list (cp_parser* parser) saved_in_template_argument_list_p = parser->in_template_argument_list_p; parser->in_template_argument_list_p = true; /* Even if the template-id appears in an integral - constant-expression, the contents of the argument list do - not. */ + constant-expression, the contents of the argument list do + not. */ saved_ice_p = parser->integral_constant_expression_p; parser->integral_constant_expression_p = false; saved_non_ice_p = parser->non_integral_constant_expression_p; @@ -9268,7 +9266,7 @@ cp_parser_template_argument (cp_parser* parser) if (TREE_CODE (argument) == BASELINK) /* We don't need the information about what class was used - to name the overloaded functions. */ + to name the overloaded functions. */ argument = BASELINK_FUNCTIONS (argument); if (TREE_CODE (argument) == VAR_DECL) @@ -9400,7 +9398,7 @@ cp_parser_explicit_instantiation (cp_parser* parser) pop_deferring_access_checks (); if (type) do_type_instantiation (type, extension_specifier, - /*complain=*/tf_error); + /*complain=*/tf_error); } else { @@ -9465,9 +9463,9 @@ cp_parser_explicit_specialization (cp_parser* parser) /* We have processed another parameter list. */ ++parser->num_template_parameter_lists; /* [temp] - + A template ... explicit specialization ... shall not have C - linkage. */ + linkage. */ if (current_lang_name == lang_name_c) { error ("template specialization with C linkage"); @@ -10249,13 +10247,13 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, warning (OPT_Wattributes, "type attributes are honored only at type definition"); - template_p = + template_p = (parser->num_template_parameter_lists && (cp_parser_next_token_starts_class_definition_p (parser) || cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))); /* An unqualified name was used to reference this type, so there were no qualifying templates. */ - if (!cp_parser_check_template_parameters (parser, + if (!cp_parser_check_template_parameters (parser, /*num_templates=*/0)) return error_mark_node; type = xref_tag (tag_type, identifier, ts, template_p); @@ -11537,7 +11535,7 @@ cp_parser_direct_declarator (cp_parser* parser, abstract_ok = (dcl_kind == CP_PARSER_DECLARATOR_EITHER); if (abstract_ok) cp_parser_parse_tentatively (parser); - unqualified_name + unqualified_name = cp_parser_declarator_id (parser, /*optional_p=*/abstract_ok); qualifying_scope = parser->scope; if (abstract_ok) @@ -11658,7 +11656,7 @@ cp_parser_direct_declarator (cp_parser* parser, *ctor_dtor_or_conv_p = -1; } } - declarator = make_id_declarator (qualifying_scope, + declarator = make_id_declarator (qualifying_scope, unqualified_name, sfk); declarator->id_loc = token->location; @@ -12825,7 +12823,7 @@ cp_parser_class_name (cp_parser *parser, if (typename_p && decl != error_mark_node) { decl = make_typename_type (scope, decl, typename_type, - /*complain=*/tf_error); + /*complain=*/tf_error); if (decl != error_mark_node) decl = TYPE_NAME (decl); } @@ -12968,7 +12966,7 @@ cp_parser_class_specifier (cp_parser* parser) tree fn; tree class_type = NULL_TREE; tree pushed_scope = NULL_TREE; - + /* In a first pass, parse default arguments to the functions. Then, in a second pass, parse the bodies of the functions. This two-phased approach handles cases like: @@ -13879,7 +13877,7 @@ cp_parser_pure_specifier (cp_parser* parser) /* c_lex_with_flags marks a single digit '0' with PURE_ZERO. */ if (token->type != CPP_NUMBER || !(token->flags & PURE_ZERO)) { - cp_parser_error (parser, + cp_parser_error (parser, "invalid pure specifier (only `= 0' is allowed)"); cp_parser_skip_to_end_of_statement (parser); return error_mark_node; @@ -14754,12 +14752,12 @@ cp_parser_label_declaration (cp_parser* parser) If AMBIGUOUS_DECLS is non-NULL, *AMBIGUOUS_DECLS is set to a TREE_LIST of candidates if name-lookup results in an ambiguity, and - NULL_TREE otherwise. */ + NULL_TREE otherwise. */ static tree cp_parser_lookup_name (cp_parser *parser, tree name, enum tag_types tag_type, - bool is_template, + bool is_template, bool is_namespace, bool check_dependency, tree *ambiguous_decls) @@ -15447,7 +15445,7 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p) if (!cp_parser_require (parser, CPP_LESS, "`<'")) return; /* [temp] - + A template ... shall not have C linkage. */ if (current_lang_name == lang_name_c) { @@ -15993,7 +15991,7 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) if (!processing_template_decl) parsed_arg = check_default_argument (TREE_VALUE (parm), parsed_arg); - + TREE_PURPOSE (parm) = parsed_arg; /* Update any instantiations we've already created. */ @@ -16158,7 +16156,7 @@ cp_parser_set_storage_class (cp_parser *parser, decl_specs->specs[(int) ds_thread] = 0; } - switch (keyword) + switch (keyword) { case RID_AUTO: storage_class = sc_auto; @@ -16924,7 +16922,7 @@ cp_parser_objc_selector_expression (cp_parser* parser) token = cp_lexer_peek_token (parser->lexer); while (cp_parser_objc_selector_p (token->type) || token->type == CPP_COLON - || token->type == CPP_SCOPE) + || token->type == CPP_SCOPE) { tree selector = NULL_TREE; @@ -16933,7 +16931,7 @@ cp_parser_objc_selector_expression (cp_parser* parser) selector = cp_parser_objc_selector (parser); if (cp_lexer_next_token_is_not (parser->lexer, CPP_COLON) - && cp_lexer_next_token_is_not (parser->lexer, CPP_SCOPE)) + && cp_lexer_next_token_is_not (parser->lexer, CPP_SCOPE)) { /* Detect if we have a unary selector. */ if (maybe_unary_selector_p) @@ -16948,9 +16946,9 @@ cp_parser_objc_selector_expression (cp_parser* parser) } maybe_unary_selector_p = false; token = cp_lexer_consume_token (parser->lexer); - + if (token->type == CPP_SCOPE) - { + { sel_seq = chainon (sel_seq, build_tree_list (selector, NULL_TREE)); @@ -17457,7 +17455,7 @@ cp_parser_objc_class_ivars (cp_parser* parser) cplus_decl_attributes (&decl, attributes, /*flags=*/0); } else - decl = grokfield (declarator, &declspecs, + decl = grokfield (declarator, &declspecs, NULL_TREE, /*init_const_expr_p=*/false, NULL_TREE, attributes); @@ -17822,7 +17820,7 @@ cp_parser_omp_clause_name (cp_parser *parser) case 'c': if (!strcmp ("copyin", p)) result = PRAGMA_OMP_CLAUSE_COPYIN; - else if (!strcmp ("copyprivate", p)) + else if (!strcmp ("copyprivate", p)) result = PRAGMA_OMP_CLAUSE_COPYPRIVATE; break; case 'f': @@ -18001,7 +17999,7 @@ cp_parser_omp_clause_default (cp_parser *parser, tree list) cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, /*or_comma=*/false, /*consume_paren=*/true); - + if (kind == OMP_CLAUSE_DEFAULT_UNSPECIFIED) return list; @@ -18165,8 +18163,7 @@ cp_parser_omp_clause_reduction (cp_parser *parser, tree list) schedule ( schedule-kind , expression ) schedule-kind: - static | dynamic | guided | runtime -*/ + static | dynamic | guided | runtime */ static tree cp_parser_omp_clause_schedule (cp_parser *parser, tree list) @@ -18191,7 +18188,7 @@ cp_parser_omp_clause_schedule (cp_parser *parser, tree list) OMP_CLAUSE_SCHEDULE_KIND (c) = OMP_CLAUSE_SCHEDULE_DYNAMIC; break; - case 'g': + case 'g': if (strcmp ("guided", p) != 0) goto invalid_kind; OMP_CLAUSE_SCHEDULE_KIND (c) = OMP_CLAUSE_SCHEDULE_GUIDED; @@ -18476,8 +18473,7 @@ cp_parser_omp_atomic (cp_parser *parser, cp_token *pragma_tok) /* OpenMP 2.5: - # pragma omp barrier new-line -*/ + # pragma omp barrier new-line */ static void cp_parser_omp_barrier (cp_parser *parser, cp_token *pragma_tok) @@ -18488,8 +18484,7 @@ cp_parser_omp_barrier (cp_parser *parser, cp_token *pragma_tok) /* OpenMP 2.5: # pragma omp critical [(name)] new-line - structured-block -*/ + structured-block */ static tree cp_parser_omp_critical (cp_parser *parser, cp_token *pragma_tok) @@ -18501,7 +18496,7 @@ cp_parser_omp_critical (cp_parser *parser, cp_token *pragma_tok) cp_lexer_consume_token (parser->lexer); name = cp_parser_identifier (parser); - + if (name == error_mark_node || !cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, @@ -18633,8 +18628,7 @@ cp_parser_omp_for_loop (cp_parser *parser) /* OpenMP 2.5: #pragma omp for for-clause[optseq] new-line - for-loop -*/ + for-loop */ #define OMP_FOR_CLAUSE_MASK \ ( (1u << PRAGMA_OMP_CLAUSE_PRIVATE) \ @@ -18669,8 +18663,7 @@ cp_parser_omp_for (cp_parser *parser, cp_token *pragma_tok) /* OpenMP 2.5: # pragma omp master new-line - structured-block -*/ + structured-block */ static tree cp_parser_omp_master (cp_parser *parser, cp_token *pragma_tok) @@ -18681,8 +18674,7 @@ cp_parser_omp_master (cp_parser *parser, cp_token *pragma_tok) /* OpenMP 2.5: # pragma omp ordered new-line - structured-block -*/ + structured-block */ static tree cp_parser_omp_ordered (cp_parser *parser, cp_token *pragma_tok) @@ -18721,7 +18713,7 @@ cp_parser_omp_sections_scope (cp_parser *parser) while (1) { - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false); tok = cp_lexer_peek_token (parser->lexer); if (tok->pragma_kind == PRAGMA_OMP_SECTION) @@ -18776,8 +18768,7 @@ cp_parser_omp_sections_scope (cp_parser *parser) /* OpenMP 2.5: # pragma omp sections sections-clause[optseq] newline - sections-scope -*/ + sections-scope */ #define OMP_SECTIONS_CLAUSE_MASK \ ( (1u << PRAGMA_OMP_CLAUSE_PRIVATE) \ @@ -18804,8 +18795,7 @@ cp_parser_omp_sections (cp_parser *parser, cp_token *pragma_tok) /* OpenMP 2.5: # pragma parallel parallel-clause new-line # pragma parallel for parallel-for-clause new-line - # pragma parallel sections parallel-sections-clause new-line -*/ + # pragma parallel sections parallel-sections-clause new-line */ #define OMP_PARALLEL_CLAUSE_MASK \ ( (1u << PRAGMA_OMP_CLAUSE_IF) \ @@ -18886,8 +18876,7 @@ cp_parser_omp_parallel (cp_parser *parser, cp_token *pragma_tok) /* OpenMP 2.5: # pragma omp single single-clause[optseq] new-line - structured-block -*/ + structured-block */ #define OMP_SINGLE_CLAUSE_MASK \ ( (1u << PRAGMA_OMP_CLAUSE_PRIVATE) \ @@ -18977,7 +18966,7 @@ static GTY (()) cp_parser *the_parser; PCH file, which is a GC collection point. So we need to handle this first pragma without benefit of an existing lexer structure. - Always returns one token to the caller in *FIRST_TOKEN. This is + Always returns one token to the caller in *FIRST_TOKEN. This is either the true first token of the file, or the first token after the initial pragma. */ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 8066e08eff5..8b2f0d3054e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -104,7 +104,7 @@ static tree classtype_mangled_name (tree); static char* mangle_class_name_for_template (const char *, tree, tree); static tree tsubst_initializer_list (tree, tree); static tree get_class_bindings (tree, tree, tree); -static tree coerce_template_parms (tree, tree, tree, tsubst_flags_t, +static tree coerce_template_parms (tree, tree, tree, tsubst_flags_t, bool, bool); static void tsubst_enum (tree, tree, tree); static tree add_to_template_args (tree, tree); @@ -658,7 +658,7 @@ check_explicit_instantiation_namespace (tree spec) tree ns; /* DR 275: An explicit instantiation shall appear in an enclosing - namespace of its template. */ + namespace of its template. */ ns = decl_namespace_context (spec); if (!is_ancestor (current_namespace, ns)) pedwarn ("explicit instantiation of %qD in namespace %qD " @@ -895,7 +895,7 @@ static tree retrieve_local_specialization (tree tmpl) { tree spec = (tree) htab_find_with_hash (local_specializations, tmpl, - htab_hash_pointer (tmpl)); + htab_hash_pointer (tmpl)); return spec ? TREE_PURPOSE (spec) : NULL_TREE; } @@ -1187,15 +1187,15 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend) DECL_INITIAL (fn) = NULL_TREE; duplicate_decls (spec, fn, is_friend); /* The call to duplicate_decls will have applied - [temp.expl.spec]: + [temp.expl.spec]: - An explicit specialization of a function template + An explicit specialization of a function template is inline only if it is explicitly declared to be, and independently of whether its function template is. to the primary function; now copy the inline bits to - the various clones. */ + the various clones. */ FOR_EACH_CLONE (clone, fn) { DECL_DECLARED_INLINE_P (clone) @@ -1451,7 +1451,7 @@ determine_specialization (tree template_id, if (current_binding_level->kind == sk_template_parms && !current_binding_level->explicit_spec_p && (TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (fn)) - != TREE_VEC_LENGTH (INNERMOST_TEMPLATE_PARMS + != TREE_VEC_LENGTH (INNERMOST_TEMPLATE_PARMS (current_template_parms)))) continue; @@ -2150,14 +2150,14 @@ check_explicit_specialization (tree declarator, /* If DECL is a friend declaration, declared using an unqualified name, the namespace associated with DECL may have been set incorrectly. For example, in: - - template void f(T); - namespace N { - struct S { friend void f(int); } - } - we will have set the DECL_CONTEXT for the friend - declaration to N, rather than to the global namespace. */ + template void f(T); + namespace N { + struct S { friend void f(int); } + } + + we will have set the DECL_CONTEXT for the friend + declaration to N, rather than to the global namespace. */ if (DECL_NAMESPACE_SCOPE_P (decl)) DECL_CONTEXT (decl) = DECL_CONTEXT (tmpl); @@ -3962,7 +3962,7 @@ convert_template_argument (tree parm, val = arg; /* We only form one instance of each template specialization. Therefore, if we use a non-canonical variant (i.e., a - typedef), any future messages referring to the type will use + typedef), any future messages referring to the type will use the typedef, which is confusing if those future uses do not themselves also use the typedef. */ if (TYPE_P (val)) @@ -4464,7 +4464,7 @@ lookup_template_class (tree d1, arglist = add_to_template_args (current_template_args (), arglist); arglist2 = coerce_template_parms (parmlist, arglist, template, - complain, + complain, /*require_all_args=*/true, /*use_default_args=*/true); if (arglist2 == error_mark_node @@ -4535,7 +4535,7 @@ lookup_template_class (tree d1, { tree a = coerce_template_parms (TREE_VALUE (t), arglist, template, - complain, + complain, /*require_all_args=*/true, /*use_default_args=*/true); @@ -4566,7 +4566,7 @@ lookup_template_class (tree d1, = coerce_template_parms (INNERMOST_TEMPLATE_PARMS (parmlist), INNERMOST_TEMPLATE_ARGS (arglist), template, - complain, + complain, /*require_all_args=*/true, /*use_default_args=*/true); @@ -5539,12 +5539,12 @@ instantiate_class_template (tree type) specialization. We replace the innermost set of ARGS with the arguments appropriate for substitution. For example, given: - - template struct S {}; + + template struct S {}; template struct S {}; and supposing that we are instantiating S, ARGS will - presently be {int*} -- but we need {int}. */ + presently be {int*} -- but we need {int}. */ pattern = TREE_TYPE (t); args = TREE_PURPOSE (t); } @@ -5762,15 +5762,15 @@ instantiate_class_template (tree type) not occur unless the static data member is itself used in a way that requires the definition of the static data member to - exist. + exist. Therefore, we do not substitute into the - initialized for the static data member here. */ - finish_static_data_member_decl - (r, - /*init=*/NULL_TREE, + initialized for the static data member here. */ + finish_static_data_member_decl + (r, + /*init=*/NULL_TREE, /*init_const_expr_p=*/false, - /*asmspec_tree=*/NULL_TREE, + /*asmspec_tree=*/NULL_TREE, /*flags=*/0); if (DECL_INITIALIZED_IN_CLASS_P (r)) check_static_variable_definition (r, TREE_TYPE (r)); @@ -6133,7 +6133,7 @@ tsubst_aggr_type (tree t, entering_scope, complain); r = cp_build_qualified_type_real (r, TYPE_QUALS (t), complain); } - + skip_evaluation = saved_skip_evaluation; return r; @@ -6322,7 +6322,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) tree new_type; ++processing_template_decl; new_type = tsubst (TREE_TYPE (t), args, complain, in_decl); - --processing_template_decl; + --processing_template_decl; if (new_type == error_mark_node) return error_mark_node; @@ -6345,7 +6345,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) DECL_TI_TEMPLATE (new_decl) = r; TREE_TYPE (r) = TREE_TYPE (new_decl); DECL_TI_ARGS (r) = DECL_TI_ARGS (new_decl); - DECL_CONTEXT (r) = DECL_CONTEXT (new_decl); + DECL_CONTEXT (r) = DECL_CONTEXT (new_decl); } SET_DECL_IMPLICIT_INSTANTIATION (r); @@ -6745,7 +6745,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) { tree ve = DECL_VALUE_EXPR (t); ve = tsubst_expr (ve, args, complain, in_decl); - SET_DECL_VALUE_EXPR (r, ve); + SET_DECL_VALUE_EXPR (r, ve); } } else if (DECL_SELF_REFERENCE_P (t)) @@ -7674,8 +7674,8 @@ tsubst_qualified_id (tree qualified_id, tree args, expr = name; if (dependent_type_p (scope)) - return build_qualified_name (/*type=*/NULL_TREE, - scope, expr, + return build_qualified_name (/*type=*/NULL_TREE, + scope, expr, QUALIFIED_NAME_IS_TEMPLATE (qualified_id)); if (!BASELINK_P (name) && !DECL_P (expr)) @@ -7726,7 +7726,7 @@ tsubst_qualified_id (tree qualified_id, tree args, { expr = (adjust_result_of_qualified_name_lookup (expr, scope, current_class_type)); - expr = (finish_qualified_id_expr + expr = (finish_qualified_id_expr (scope, expr, done, address_p, QUALIFIED_NAME_IS_TEMPLATE (qualified_id), /*template_arg_p=*/false)); @@ -7917,7 +7917,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) complain, in_decl); name = build1 (BIT_NOT_EXPR, NULL_TREE, name); name = build_qualified_name (/*type=*/NULL_TREE, - base, name, + base, name, /*template_p=*/false); } else if (TREE_CODE (name) == BASELINK) @@ -8885,7 +8885,7 @@ tsubst_copy_and_build (tree t, } else qualified_p = false; - + function = tsubst_copy_and_build (function, args, complain, in_decl, !qualified_p); @@ -9191,14 +9191,14 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain) if (nt) { /* DR 488 makes use of a type with no linkage cause - type deduction to fail. */ + type deduction to fail. */ if (complain & tf_error) { if (TYPE_ANONYMOUS_P (nt)) error ("%qT is/uses anonymous type", t); else error ("template argument for %qD uses local type %qT", - tmpl, t); + tmpl, t); } result = true; } @@ -9623,10 +9623,10 @@ type_unification_real (tree tparms, if (same_type_p (parm, type)) continue; if (strict != DEDUCE_EXACT - && can_convert_arg (parm, type, TYPE_P (arg) ? NULL_TREE : arg, + && can_convert_arg (parm, type, TYPE_P (arg) ? NULL_TREE : arg, flags)) continue; - + return 1; } @@ -10183,8 +10183,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict) typename Block> void operator+(float, View const&); - template + template struct Lvalue_proxy { operator float() const; }; void @@ -10196,8 +10196,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict) Here, if Lvalue_proxy is permitted to bind to View, then the global operator+ will be used; if they are not, the - Lvalue_proxy will be converted to float. */ - if (coerce_template_parms (argtmplvec, parmvec, + Lvalue_proxy will be converted to float. */ + if (coerce_template_parms (argtmplvec, parmvec, TYPE_TI_TEMPLATE (parm), tf_none, /*require_all_args=*/true, @@ -10513,9 +10513,9 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict) return 1; /* CV qualifications for methods can never be deduced, they must - match exactly. We need to check them explicitly here, - because type_unification_real treats them as any other - cvqualified parameter. */ + match exactly. We need to check them explicitly here, + because type_unification_real treats them as any other + cvqualified parameter. */ if (TREE_CODE (parm) == METHOD_TYPE && (!check_cv_quals_for_unify (UNIFY_ALLOW_NONE, @@ -10706,7 +10706,7 @@ more_specialized_fn (tree pat1, tree pat2, int len) tree args2 = TYPE_ARG_TYPES (TREE_TYPE (decl2)); int better1 = 0; int better2 = 0; - + /* Remove the this parameter from non-static member functions. If one is a non-static member function and the other is not a static member function, remove the first parameter from that function @@ -10729,7 +10729,7 @@ more_specialized_fn (tree pat1, tree pat2, int len) args1 = TREE_CHAIN (args1); } } - + /* If only one is a conversion operator, they are unordered. */ if (DECL_CONV_FN_P (decl1) != DECL_CONV_FN_P (decl2)) return 0; @@ -10854,7 +10854,7 @@ more_specialized_fn (tree pat1, tree pat2, int len) specialized. See [temp.class.order] for information about determining which of - two templates is more specialized. */ + two templates is more specialized. */ static int more_specialized_class (tree pat1, tree pat2) @@ -10871,13 +10871,13 @@ more_specialized_class (tree pat1, tree pat2) types in the arguments, and we need our dependency check functions to behave correctly. */ ++processing_template_decl; - targs = get_class_bindings (TREE_VALUE (pat1), + targs = get_class_bindings (TREE_VALUE (pat1), CLASSTYPE_TI_ARGS (tmpl1), CLASSTYPE_TI_ARGS (tmpl2)); if (targs) --winner; - targs = get_class_bindings (TREE_VALUE (pat2), + targs = get_class_bindings (TREE_VALUE (pat2), CLASSTYPE_TI_ARGS (tmpl2), CLASSTYPE_TI_ARGS (tmpl1)); if (targs) @@ -10919,7 +10919,7 @@ get_bindings (tree fn, tree decl, tree explicit_args, bool check_rettype) converted_args = coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (tmpl), explicit_args, NULL_TREE, - tf_none, + tf_none, /*require_all_args=*/false, /*use_default_args=*/false); if (converted_args == error_mark_node) @@ -10976,11 +10976,11 @@ get_class_bindings (tree tparms, tree spec_args, tree args) innermost_deduced_args); } else - deduced_args = innermost_deduced_args; + deduced_args = innermost_deduced_args; - if (unify (tparms, deduced_args, - INNERMOST_TEMPLATE_ARGS (spec_args), - INNERMOST_TEMPLATE_ARGS (args), + if (unify (tparms, deduced_args, + INNERMOST_TEMPLATE_ARGS (spec_args), + INNERMOST_TEMPLATE_ARGS (args), UNIFY_ALLOW_NONE)) return NULL_TREE; @@ -10990,7 +10990,7 @@ get_class_bindings (tree tparms, tree spec_args, tree args) /* Verify that nondeduced template arguments agree with the type obtained from argument deduction. - + For example: struct A { typedef int X; }; @@ -11168,8 +11168,8 @@ most_specialized_class (tree type, tree tmpl) tree spec_args; partial_spec_args = CLASSTYPE_TI_ARGS (TREE_TYPE (t)); - spec_args = get_class_bindings (TREE_VALUE (t), - partial_spec_args, + spec_args = get_class_bindings (TREE_VALUE (t), + partial_spec_args, args); if (spec_args) { @@ -11331,11 +11331,11 @@ do_decl_instantiation (tree decl, tree storage) } else error ("storage class %qD applied to template instantiation", storage); - + check_explicit_instantiation_namespace (result); mark_decl_instantiated (result, extern_p); if (! extern_p) - instantiate_decl (result, /*defer_ok=*/1, + instantiate_decl (result, /*defer_ok=*/1, /*expl_inst_class_mem_p=*/false); } @@ -11373,7 +11373,7 @@ instantiate_class_member (tree decl, int extern_p) { mark_decl_instantiated (decl, extern_p); if (! extern_p) - instantiate_decl (decl, /*defer_ok=*/1, + instantiate_decl (decl, /*defer_ok=*/1, /*expl_inst_class_mem_p=*/true); } @@ -11671,7 +11671,7 @@ template_for_substitution (tree decl) explicitly instantiated class template. */ tree -instantiate_decl (tree d, int defer_ok, +instantiate_decl (tree d, int defer_ok, bool expl_inst_class_mem_p) { tree tmpl = DECL_TI_TEMPLATE (d); @@ -11736,9 +11736,9 @@ instantiate_decl (tree d, int defer_ok, code_pattern = DECL_TEMPLATE_RESULT (td); /* We should never be trying to instantiate a member of a class - template or partial specialization. */ + template or partial specialization. */ gcc_assert (d != code_pattern); - + if ((DECL_NAMESPACE_SCOPE_P (d) && !DECL_INITIALIZED_IN_CLASS_P (d)) || DECL_TEMPLATE_SPECIALIZATION (td)) /* In the case of a friend template whose definition is provided @@ -11769,9 +11769,9 @@ instantiate_decl (tree d, int defer_ok, /* If D is a member of an explicitly instantiated class template, and no definition is available, treat it like an implicit - instantiation. */ - if (!pattern_defined && expl_inst_class_mem_p - && DECL_EXPLICIT_INSTANTIATION (d)) + instantiation. */ + if (!pattern_defined && expl_inst_class_mem_p + && DECL_EXPLICIT_INSTANTIATION (d)) { DECL_NOT_REALLY_EXTERN (d) = 0; DECL_INTERFACE_KNOWN (d) = 0; @@ -11817,14 +11817,14 @@ instantiate_decl (tree d, int defer_ok, && ! (TREE_CODE (d) == FUNCTION_DECL && DECL_INLINE (d)) /* ... we instantiate static data members whose values are needed in integral constant expressions. */ - && ! (TREE_CODE (d) == VAR_DECL + && ! (TREE_CODE (d) == VAR_DECL && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (d))) goto out; /* Defer all other templates, unless we have been explicitly forbidden from doing so. */ if (/* If there is no definition, we cannot instantiate the template. */ - ! pattern_defined + ! pattern_defined /* If it's OK to postpone instantiation, do so. */ || defer_ok /* If this is a static data member that will be defined @@ -11836,7 +11836,7 @@ instantiate_decl (tree d, int defer_ok, /* The definition of the static data member is now required so we must substitute the initializer. */ if (TREE_CODE (d) == VAR_DECL - && !DECL_INITIAL (d) + && !DECL_INITIAL (d) && DECL_INITIAL (code_pattern)) { tree ns; @@ -11845,7 +11845,7 @@ instantiate_decl (tree d, int defer_ok, ns = decl_namespace_context (d); push_nested_namespace (ns); push_nested_class (DECL_CONTEXT (d)); - init = tsubst_expr (DECL_INITIAL (code_pattern), + init = tsubst_expr (DECL_INITIAL (code_pattern), args, tf_warning_or_error, NULL_TREE); cp_finish_decl (d, init, /*init_const_expr_p=*/false, @@ -12058,7 +12058,7 @@ instantiate_pending_templates (int retries) fn; fn = TREE_CHAIN (fn)) if (! DECL_ARTIFICIAL (fn)) - instantiate_decl (fn, + instantiate_decl (fn, /*defer_ok=*/0, /*expl_inst_class_mem_p=*/false); if (COMPLETE_TYPE_P (instantiation)) @@ -12080,7 +12080,7 @@ instantiate_pending_templates (int retries) if (!DECL_TEMPLATE_SPECIALIZATION (instantiation) && !DECL_TEMPLATE_INSTANTIATED (instantiation)) { - instantiation + instantiation = instantiate_decl (instantiation, /*defer_ok=*/0, /*expl_inst_class_mem_p=*/false); @@ -12742,7 +12742,7 @@ type_dependent_expression_p (tree expression) } gcc_assert (TREE_CODE (expression) != TYPE_DECL); - + return (dependent_type_p (TREE_TYPE (expression))); } @@ -12984,7 +12984,7 @@ build_non_dependent_expr (tree expr) /* If the type is unknown, it can't really be non-dependent */ gcc_assert (TREE_TYPE (expr) != unknown_type_node); - + /* Otherwise, build a NON_DEPENDENT_EXPR. REFERENCE_TYPEs are not stripped for expressions in templates diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c index c222bdcaecd..246e88b9875 100644 --- a/gcc/cp/ptree.c +++ b/gcc/cp/ptree.c @@ -172,7 +172,7 @@ cxx_print_xnode (FILE *file, tree node, int indent) case BASELINK: print_node (file, "functions", BASELINK_FUNCTIONS (node), indent + 4); print_node (file, "binfo", BASELINK_BINFO (node), indent + 4); - print_node (file, "access_binfo", BASELINK_ACCESS_BINFO (node), + print_node (file, "access_binfo", BASELINK_ACCESS_BINFO (node), indent + 4); break; case OVERLOAD: diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 7a469967132..898db00f311 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -89,8 +89,8 @@ typedef enum tinfo_kind TK_POINTER_MEMBER_TYPE, /* abi::__pointer_to_member_type_info */ TK_CLASS_TYPE, /* abi::__class_type_info */ TK_SI_CLASS_TYPE, /* abi::__si_class_type_info */ - TK_FIXED /* end of fixed descriptors. */ - /* ... abi::__vmi_type_info */ + TK_FIXED /* end of fixed descriptors. */ + /* ... abi::__vmi_type_info */ } tinfo_kind; /* A vector of all tinfo decls that haven't yet been emitted. */ @@ -865,7 +865,7 @@ tinfo_base_init (tinfo_s *ti, tree target) size_binop (MULT_EXPR, size_int (2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE), TYPE_SIZE_UNIT (vtable_entry_type))); - + ti->vtable = vtable_ptr; } @@ -890,7 +890,7 @@ static tree generic_initializer (tinfo_s *ti, tree target) { tree init = tinfo_base_init (ti, target); - + init = build_constructor_from_list (NULL_TREE, init); TREE_CONSTANT (init) = 1; TREE_INVARIANT (init) = 1; @@ -949,7 +949,7 @@ ptm_initializer (tinfo_s *ti, tree target) init = tree_cons (NULL_TREE, get_tinfo_ptr (klass), init); - + init = build_constructor_from_list (NULL_TREE, nreverse (init)); TREE_CONSTANT (init) = 1; TREE_INVARIANT (init) = 1; @@ -1007,16 +1007,16 @@ static tree get_pseudo_ti_init (tree type, unsigned tk_index) { tinfo_s *ti = VEC_index (tinfo_s, tinfo_descs, tk_index); - + gcc_assert (at_eof); switch (tk_index) { case TK_POINTER_MEMBER_TYPE: return ptm_initializer (ti, type); - + case TK_POINTER_TYPE: return ptr_initializer (ti, type); - + case TK_BUILTIN_TYPE: case TK_ENUMERAL_TYPE: case TK_FUNCTION_TYPE: @@ -1046,9 +1046,9 @@ get_pseudo_ti_init (tree type, unsigned tk_index) VEC(tree,gc) *base_accesses = BINFO_BASE_ACCESSES (binfo); tree base_inits = NULL_TREE; int ix; - + gcc_assert (tk_index >= TK_FIXED); - + /* Generate the base information initializer. */ for (ix = nbases; ix--;) { @@ -1057,21 +1057,21 @@ get_pseudo_ti_init (tree type, unsigned tk_index) int flags = 0; tree tinfo; tree offset; - + if (VEC_index (tree, base_accesses, ix) == access_public_node) flags |= 2; tinfo = get_tinfo_ptr (BINFO_TYPE (base_binfo)); if (BINFO_VIRTUAL_P (base_binfo)) { /* We store the vtable offset at which the virtual - base offset can be found. */ + base offset can be found. */ offset = BINFO_VPTR_FIELD (base_binfo); offset = convert (sizetype, offset); flags |= 1; } else offset = BINFO_OFFSET (base_binfo); - + /* Combine offset and flags into one field. */ offset = cp_build_binary_op (LSHIFT_EXPR, offset, build_int_cst (NULL_TREE, 8)); @@ -1167,29 +1167,29 @@ static unsigned get_pseudo_ti_index (tree type) { unsigned ix; - + switch (TREE_CODE (type)) { case OFFSET_TYPE: ix = TK_POINTER_MEMBER_TYPE; break; - + case POINTER_TYPE: ix = TK_POINTER_TYPE; break; - + case ENUMERAL_TYPE: ix = TK_ENUMERAL_TYPE; break; - + case FUNCTION_TYPE: ix = TK_FUNCTION_TYPE; break; - + case ARRAY_TYPE: ix = TK_ARRAY_TYPE; break; - + case UNION_TYPE: case RECORD_TYPE: if (TYPE_PTRMEMFUNC_P (type)) @@ -1235,7 +1235,7 @@ get_pseudo_ti_index (tree type) { /* too short, extend. */ unsigned len = VEC_length (tinfo_s, tinfo_descs); - + VEC_safe_grow (tinfo_s, gc, tinfo_descs, ix + 1); while (VEC_iterate (tinfo_s, tinfo_descs, len++, ti)) ti->type = ti->vtable = ti->name = NULL_TREE; @@ -1282,11 +1282,11 @@ static void create_tinfo_types (void) { tinfo_s *ti; - + gcc_assert (!tinfo_descs); VEC_safe_grow (tinfo_s, gc, tinfo_descs, TK_FIXED); - + push_nested_namespace (abi_node); /* Create the internal type_info structure. This is used as a base for @@ -1317,15 +1317,15 @@ create_tinfo_types (void) create_pseudo_type_info (TK_ARRAY_TYPE, "__array_type_info", NULL); create_pseudo_type_info (TK_FUNCTION_TYPE, "__function_type_info", NULL); create_pseudo_type_info (TK_ENUMERAL_TYPE, "__enum_type_info", NULL); - + /* Class type_info. No additional fields. */ create_pseudo_type_info (TK_CLASS_TYPE, "__class_type_info", NULL); - - /* Single public non-virtual base class. Add pointer to base class. + + /* Single public non-virtual base class. Add pointer to base class. This is really a descendant of __class_type_info. */ create_pseudo_type_info (TK_SI_CLASS_TYPE, "__si_class_type_info", - build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), - NULL); + build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), + NULL); /* Base class internal helper. Pointer to base type, offset to base, flags. */ @@ -1338,9 +1338,9 @@ create_tinfo_types (void) field = build_decl (FIELD_DECL, NULL_TREE, integer_types[itk_long]); TREE_CHAIN (field) = fields; fields = field; - + ti = VEC_index (tinfo_s, tinfo_descs, TK_BASE_TYPE); - + ti->type = make_aggr_type (RECORD_TYPE); ti->vtable = NULL_TREE; ti->name = NULL_TREE; @@ -1362,10 +1362,10 @@ create_tinfo_types (void) This is really a descendant of __pbase_type_info. */ create_pseudo_type_info (TK_POINTER_MEMBER_TYPE, "__pointer_to_member_type_info", - build_decl (FIELD_DECL, NULL_TREE, integer_type_node), - build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), - build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), - NULL); + build_decl (FIELD_DECL, NULL_TREE, integer_type_node), + build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), + build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), + NULL); pop_nested_namespace (abi_node); } @@ -1482,7 +1482,7 @@ emit_tinfo_decl (tree decl) if (DECL_NOT_REALLY_EXTERN (decl) && decl_needed_p (decl)) { tree init; - + DECL_EXTERNAL (decl) = 0; init = get_pseudo_ti_init (type, get_pseudo_ti_index (type)); DECL_INITIAL (decl) = init; diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 6622fb5e20e..21d1b776246 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -875,8 +875,8 @@ accessible_p (tree type, tree decl, bool consider_local_p) instantiation. However, PROCESSING_TEMPLATE_DECL is set in the parameter list for a template (because we may see dependent types in default arguments for template parameters), and access - checking should be performed in the outermost parameter list. */ - if (processing_template_decl + checking should be performed in the outermost parameter list. */ + if (processing_template_decl && (!processing_template_parmlist || processing_template_decl > 1)) return 1; diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 06ed52d2eab..b4e9505b75b 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1212,17 +1212,17 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands, if (!lvalue_or_else (operand, lv_asm)) operand = error_mark_node; - if (operand != error_mark_node + if (operand != error_mark_node && (TREE_READONLY (operand) || CP_TYPE_CONST_P (TREE_TYPE (operand)) - /* Functions are not modifiable, even though they are - lvalues. */ - || TREE_CODE (TREE_TYPE (operand)) == FUNCTION_TYPE - || TREE_CODE (TREE_TYPE (operand)) == METHOD_TYPE - /* If it's an aggregate and any field is const, then it is - effectively const. */ - || (CLASS_TYPE_P (TREE_TYPE (operand)) - && C_TYPE_FIELDS_READONLY (TREE_TYPE (operand))))) + /* Functions are not modifiable, even though they are + lvalues. */ + || TREE_CODE (TREE_TYPE (operand)) == FUNCTION_TYPE + || TREE_CODE (TREE_TYPE (operand)) == METHOD_TYPE + /* If it's an aggregate and any field is const, then it is + effectively const. */ + || (CLASS_TYPE_P (TREE_TYPE (operand)) + && C_TYPE_FIELDS_READONLY (TREE_TYPE (operand))))) readonly_error (operand, "assignment (via 'asm' output)", 0); constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t))); @@ -1517,10 +1517,10 @@ check_accessibility_of_qualified_id (tree decl, is true iff this qualified name appears as a template argument. */ tree -finish_qualified_id_expr (tree qualifying_class, - tree expr, +finish_qualified_id_expr (tree qualifying_class, + tree expr, bool done, - bool address_p, + bool address_p, bool template_p, bool template_arg_p) { @@ -1603,7 +1603,7 @@ finish_stmt_expr_expr (tree expr, tree stmt_expr) return error_mark_node; /* If the last statement does not have "void" type, then the value - of the last statement is the value of the entire expression. */ + of the last statement is the value of the entire expression. */ if (expr) { tree type; @@ -1633,9 +1633,9 @@ finish_stmt_expr_expr (tree expr, tree stmt_expr) statement-expression. */ if (!processing_template_decl && !VOID_TYPE_P (type)) { - tree target_expr; - if (CLASS_TYPE_P (type) - && !TYPE_HAS_TRIVIAL_INIT_REF (type)) + tree target_expr; + if (CLASS_TYPE_P (type) + && !TYPE_HAS_TRIVIAL_INIT_REF (type)) { target_expr = build_target_expr_with_type (expr, type); expr = TARGET_EXPR_INITIAL (target_expr); @@ -1648,7 +1648,7 @@ finish_stmt_expr_expr (tree expr, tree stmt_expr) problem described above. */ target_expr = force_target_expr (type, expr); expr = TARGET_EXPR_INITIAL (target_expr); - expr = build2 (INIT_EXPR, + expr = build2 (INIT_EXPR, type, TARGET_EXPR_SLOT (target_expr), expr); @@ -2043,7 +2043,7 @@ finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list) { /* If this compound-literal appears outside of a function, then the corresponding variable has static storage duration, just - like the variable in whose initializer it appears. */ + like the variable in whose initializer it appears. */ TREE_STATIC (var) = 1; /* The variable has internal linkage, since there is no need to reference it from another translation unit. */ @@ -2056,7 +2056,7 @@ finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list) pushdecl (var); /* Initialize the variable as we would any other variable with a brace-enclosed initializer. */ - cp_finish_decl (var, compound_literal, + cp_finish_decl (var, compound_literal, /*init_const_expr_p=*/false, /*asmspec_tree=*/NULL_TREE, LOOKUP_ONLYCONVERTING); @@ -3603,7 +3603,7 @@ finish_omp_clauses (tree clauses) inner_type, LOOKUP_NORMAL); /* We'll have called convert_from_reference on the call, which - may well have added an indirect_ref. It's unneeded here, + may well have added an indirect_ref. It's unneeded here, and in the way, so kill it. */ if (TREE_CODE (t) == INDIRECT_REF) t = TREE_OPERAND (t, 0); @@ -3811,9 +3811,9 @@ finish_omp_for (location_t locus, tree decl, tree init, tree cond, void finish_omp_atomic (enum tree_code code, tree lhs, tree rhs) { - /* If either of the operands are dependent, we can't do semantic + /* If either of the operands are dependent, we can't do semantic processing yet. Stuff the values away for now. We cheat a bit - and use the same tree code for this, even though the operands + and use the same tree code for this, even though the operands are of totally different form, thus we need to remember which statements are which, thus the lang_flag bit. */ /* ??? We ought to be using type_dependent_expression_p, but the diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index fdf491ae55b..7b44ad6df19 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -825,7 +825,7 @@ debug_binfo (tree elem) the type of the result expression, if known, or NULL_TREE if the resulting expression is type-dependent. If TEMPLATE_P is true, NAME is known to be a template because the user explicitly used the - "template" keyword after the "::". + "template" keyword after the "::". All SCOPE_REFs should be built by use of this function. */ @@ -2170,8 +2170,8 @@ decl_linkage (tree decl) /* Things that are TREE_PUBLIC have external linkage. */ if (TREE_PUBLIC (decl)) return lk_external; - - /* Linkage of a CONST_DECL depends on the linkage of the enumeration + + /* Linkage of a CONST_DECL depends on the linkage of the enumeration type. */ if (TREE_CODE (decl) == CONST_DECL) return decl_linkage (TYPE_NAME (TREE_TYPE (decl))); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 7ddbf2346aa..a47c35e64fb 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1318,7 +1318,7 @@ static tree cxx_alignof_expr (tree e) { tree t; - + if (e == error_mark_node) return error_mark_node; @@ -1505,7 +1505,7 @@ decay_conversion (tree exp) adr = build_unary_op (ADDR_EXPR, exp, 1); return cp_convert (ptrtype, adr); } - + /* If a bitfield is used in a context where integral promotion applies, then the caller is expected to have used default_conversion. That function promotes bitfields correctly @@ -1546,7 +1546,7 @@ default_conversion (tree exp) { /* Perform the integral promotions first so that bitfield expressions (which may promote to "int", even if the bitfield is - declared "unsigned") are promoted correctly. */ + declared "unsigned") are promoted correctly. */ if (INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (exp))) exp = perform_integral_promotions (exp); /* Perform the other conversions. */ @@ -1990,8 +1990,8 @@ check_template_keyword (tree decl) template, the program is ill-formed. DR 228 removed the restriction that the template be a member - template. - + template. + DR 96, if accepted would add the further restriction that explicit template arguments must be provided if the template keyword is used, but, as of 2005-10-16, that DR is still in "drafting". If @@ -2199,7 +2199,7 @@ finish_class_member_access_expr (tree object, tree name, bool template_p) orig_object, orig_name, NULL_TREE); } - + return expr; } @@ -3215,8 +3215,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, case EQ_EXPR: case NE_EXPR: if (code0 == REAL_TYPE || code1 == REAL_TYPE) - warning (OPT_Wfloat_equal, - "comparing floating point with == or != is unsafe"); + warning (OPT_Wfloat_equal, + "comparing floating point with == or != is unsafe"); if ((TREE_CODE (orig_op0) == STRING_CST && !integer_zerop (op1)) || (TREE_CODE (orig_op1) == STRING_CST && !integer_zerop (op0))) warning (OPT_Wstring_literal_comparison, @@ -5711,7 +5711,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE ? 1 + (modifycode != INIT_EXPR): 0; - return build_vec_init (lhs, NULL_TREE, newrhs, + return build_vec_init (lhs, NULL_TREE, newrhs, /*explicit_default_init_p=*/false, from_array); } @@ -6201,7 +6201,7 @@ convert_for_assignment (tree type, tree rhs, "%s might be a candidate for a format attribute", errtype); } - + return perform_implicit_conversion (strip_top_quals (type), rhs); } @@ -6421,8 +6421,8 @@ check_return_expr (tree retval, bool *no_warning) return!). */ current_function_returns_null = 0; /* And signal caller that TREE_NO_WARNING should be set on the - RETURN_EXPR to avoid control reaches end of non-void function - warnings in tree-cfg.c. */ + RETURN_EXPR to avoid control reaches end of non-void function + warnings in tree-cfg.c. */ *no_warning = true; } /* Check for a return statement with a value in a function that @@ -6551,7 +6551,7 @@ check_return_expr (tree retval, bool *no_warning) was an incomplete type. Just treat this as 'return;' */ if (VOID_TYPE_P (functype)) return error_mark_node; - + /* First convert the value to the function's return type, then to the type of return value's location to handle the case that functype is smaller than the valtype. */ diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 5356faa25fa..97d5eaa37be 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -839,7 +839,7 @@ process_init_constructor_array (tree type, tree init) add anything to the CONSTRUCTOR. */ break; - flags |= picflag_from_initializer (next); + flags |= picflag_from_initializer (next); CONSTRUCTOR_APPEND_ELT (v, size_int (i), next); } @@ -894,7 +894,7 @@ process_init_constructor_record (tree type, tree init) gcc_assert (TREE_CODE (ce->index) == FIELD_DECL || TREE_CODE (ce->index) == IDENTIFIER_NODE); if (ce->index != field - && ce->index != DECL_NAME (field)) + && ce->index != DECL_NAME (field)) sorry ("non-trivial designated initializers not supported"); } @@ -1021,7 +1021,7 @@ process_init_constructor_union (tree type, tree init) After the execution, the initializer will have TREE_CONSTANT if all elts are constant, and TREE_STATIC set if, in addition, all elts are simple enough constants that the assembler and linker can compute them. - + The function returns the initializer itself, or error_mark_node in case of error. */