From: Jason Merrill Date: Sat, 29 Jun 2019 05:40:58 +0000 (-0400) Subject: Remove trailing whitespace in C++ front end. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=43e1e8b5b8ed9f0e4311c0974b9e459471a275b0;p=gcc.git Remove trailing whitespace in C++ front end. From-SVN: r272809 --- diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index d42be758485..a1849f69836 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -734,7 +734,7 @@ struct GTY(()) tree_overload { /* Iterator for a 1 dimensional overload. Permits iterating over the outer level of a 2-d overload when explicitly enabled. */ -class ovl_iterator +class ovl_iterator { tree ovl; const bool allow_inner; /* Only used when checking. */ @@ -1296,7 +1296,7 @@ enum cp_trait_kind struct GTY (()) tree_trait_expr { struct tree_common common; tree type1; - tree type2; + tree type2; enum cp_trait_kind kind; }; @@ -1613,7 +1613,7 @@ union GTY((desc ("cp_tree_node_structure (&%h)"), struct tree_deferred_parse GTY ((tag ("TS_CP_DEFERRED_PARSE"))) deferred_parse; struct tree_deferred_noexcept GTY ((tag ("TS_CP_DEFERRED_NOEXCEPT"))) deferred_noexcept; struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier; - struct tree_static_assert GTY ((tag ("TS_CP_STATIC_ASSERT"))) + struct tree_static_assert GTY ((tag ("TS_CP_STATIC_ASSERT"))) static_assertion; struct tree_argument_pack_select GTY ((tag ("TS_CP_ARGUMENT_PACK_SELECT"))) argument_pack_select; @@ -3680,7 +3680,7 @@ struct GTY(()) lang_decl { select. */ #define ARGUMENT_PACK_SELECT_INDEX(NODE) \ (((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->index) - + #define FOLD_EXPR_CHECK(NODE) \ TREE_CHECK4 (NODE, UNARY_LEFT_FOLD_EXPR, UNARY_RIGHT_FOLD_EXPR, \ BINARY_LEFT_FOLD_EXPR, BINARY_RIGHT_FOLD_EXPR) @@ -4080,7 +4080,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* [basic.fundamental] Integral and floating types are collectively called arithmetic - types. + types. As a GNU extension, we also accept complex types. @@ -4098,7 +4098,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) Arithmetic types, enumeration types, pointer types, pointer-to-member types, and std::nullptr_t are collectively called scalar types. - + Keep these checks in ascending code order. */ #define SCALAR_TYPE_P(TYPE) \ (TYPE_PTRDATAMEM_P (TYPE) \ @@ -4118,7 +4118,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) Scoped enumeration types are different from normal (unscoped) enumeration types in several ways: - + - The enumerators of a scoped enumeration type are only available within the scope of the enumeration type and not in the enclosing scope. For example, the Red color can be referred to @@ -4581,7 +4581,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) parameter). The TREE_PURPOSE is the default value, if any. The TEMPLATE_PARM_INDEX for the parameter is available as the DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a - TYPE_DECL). + TYPE_DECL). FIXME: CONST_CAST_TREE is a hack that hopefully will go away after tree is converted to C++ class hiearchy. */ @@ -4733,18 +4733,18 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) template <> int min (int, int), 3=explicit instantiation, e.g.: - + template int min (int, int); Note that NODE will be marked as a specialization even if the template it is instantiating is not a primary template. For example, given: - template struct O { + template struct O { void f(); - struct I {}; + struct I {}; }; - + both O::f and O::I will be marked as instantiations. If DECL_USE_TEMPLATE is nonzero, then DECL_TEMPLATE_INFO will also @@ -6747,7 +6747,7 @@ extern void append_type_to_template_for_access_check (tree, tree, tree, extern tree convert_generic_types_to_packs (tree, int, int); extern tree splice_late_return_type (tree, tree); extern bool is_auto (const_tree); -extern tree process_template_parm (tree, location_t, tree, +extern tree process_template_parm (tree, location_t, tree, bool, bool); extern tree end_template_parm_list (tree); extern void end_template_parm_list (void); @@ -7404,7 +7404,7 @@ extern tree cp_build_unary_op (enum tree_code, tree, bool, tsubst_flags_t); extern tree genericize_compound_lvalue (tree); extern tree unary_complex_lvalue (enum tree_code, tree); -extern tree build_x_conditional_expr (location_t, tree, tree, tree, +extern tree build_x_conditional_expr (location_t, tree, tree, tree, tsubst_flags_t); extern tree build_x_compound_expr_from_list (tree, expr_list_kind, tsubst_flags_t); @@ -7449,7 +7449,7 @@ extern void expand_ptrmemfunc_cst (tree, tree *, tree *); extern tree type_after_usual_arithmetic_conversions (tree, tree); extern tree common_pointer_type (tree, tree); extern tree composite_pointer_type (tree, tree, tree, tree, - composite_pointer_operation, + composite_pointer_operation, tsubst_flags_t); extern tree merge_types (tree, tree); extern tree strip_array_domain (tree); diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index a0088a257a2..038f3009039 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -3023,7 +3023,6 @@ pp_cxx_constraint (cxx_pretty_printer *pp, tree t) } } - typedef c_pretty_print_fn pp_fun; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0a3edb3229d..12814102465 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -824,7 +824,7 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) { /* Warn about the C++0x keyword (but still treat it as an identifier). */ - warning (OPT_Wc__11_compat, + warning (OPT_Wc__11_compat, "identifier %qE is a keyword in C++11", token->u.value); @@ -969,7 +969,7 @@ cp_keyword_starts_decl_specifier_p (enum rid keyword) case RID_FLOAT: case RID_DOUBLE: case RID_VOID: - /* GNU extensions. */ + /* GNU extensions. */ case RID_ATTRIBUTE: case RID_TYPEOF: /* C++0x extensions. */ @@ -1646,7 +1646,7 @@ make_array_declarator (cp_declarator *element, tree bounds) /* Determine whether the declarator we've seen so far can be a parameter pack, when followed by an ellipsis. */ -static bool +static bool declarator_can_be_parameter_pack (cp_declarator *declarator) { if (declarator && declarator->parameter_pack_p) @@ -1727,7 +1727,7 @@ function_declarator_p (const cp_declarator *declarator) } return false; } - + /* The parser. */ /* Overview @@ -2173,7 +2173,7 @@ static tree cp_parser_simple_type_specifier (cp_parser *, cp_decl_specifier_seq *, cp_parser_flags); static tree cp_parser_type_name (cp_parser *, bool); -static tree cp_parser_nonclass_name +static tree cp_parser_nonclass_name (cp_parser* parser); static tree cp_parser_elaborated_type_specifier (cp_parser *, bool, bool); @@ -2251,7 +2251,7 @@ static tree cp_parser_parameter_declaration_list (cp_parser *, cp_parser_flags); static cp_parameter_declarator *cp_parser_parameter_declaration (cp_parser *, cp_parser_flags, bool, bool *); -static tree cp_parser_default_argument +static tree cp_parser_default_argument (cp_parser *, bool); static void cp_parser_function_body (cp_parser *, bool); @@ -2491,9 +2491,9 @@ static tree cp_parser_objc_statement (cp_parser *); static bool cp_parser_objc_valid_prefix_attributes (cp_parser *, tree *); -static void cp_parser_objc_at_property_declaration +static void cp_parser_objc_at_property_declaration (cp_parser *) ; -static void cp_parser_objc_at_synthesize_declaration +static void cp_parser_objc_at_synthesize_declaration (cp_parser *) ; static void cp_parser_objc_at_dynamic_declaration (cp_parser *) ; @@ -2997,7 +2997,7 @@ cp_parser_name_lookup_error (cp_parser* parser, break; default: gcc_unreachable (); - + } } else if (parser->scope == global_namespace) @@ -3096,7 +3096,7 @@ cp_parser_check_for_definition_in_return_type (cp_declarator *declarator, { error_at (type_location, "new types may not be defined in a return type"); - inform (type_location, + inform (type_location, "(perhaps a semicolon is missing after the definition of %qT)", type); } @@ -3369,7 +3369,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree id, if (TREE_CODE (field) == TYPE_DECL && DECL_NAME (field) == id) { - inform (location, + inform (location, "(perhaps % was intended)", BINFO_TYPE (b), id); break; @@ -4655,7 +4655,7 @@ static void cp_parser_translation_unit (cp_parser* parser) { gcc_checking_assert (!cp_error_declarator); - + /* Create the declarator obstack. */ gcc_obstack_init (&declarator_obstack); /* Create the error declarator. */ @@ -4671,7 +4671,7 @@ cp_parser_translation_unit (cp_parser* parser) for (;;) { cp_token *token = cp_lexer_peek_token (parser->lexer); - + /* If we're entering or exiting a region that's implicitly extern "C", modify the lang context appropriately. */ if (implicit_extern_c @@ -5121,14 +5121,14 @@ cp_parser_fold_expression (cp_parser *parser, tree expr1) __builtin_offsetof ( type-id , offsetof-expression ) C++ Extensions: - __has_nothrow_assign ( type-id ) + __has_nothrow_assign ( type-id ) __has_nothrow_constructor ( type-id ) __has_nothrow_copy ( type-id ) - __has_trivial_assign ( type-id ) + __has_trivial_assign ( type-id ) __has_trivial_constructor ( type-id ) __has_trivial_copy ( type-id ) __has_trivial_destructor ( type-id ) - __has_virtual_destructor ( type-id ) + __has_virtual_destructor ( type-id ) __is_abstract ( type-id ) __is_base_of ( type-id , type-id ) __is_class ( type-id ) @@ -5516,10 +5516,10 @@ cp_parser_primary_expression (cp_parser *parser, case RID_HAS_NOTHROW_ASSIGN: case RID_HAS_NOTHROW_CONSTRUCTOR: - case RID_HAS_NOTHROW_COPY: + case RID_HAS_NOTHROW_COPY: case RID_HAS_TRIVIAL_ASSIGN: case RID_HAS_TRIVIAL_CONSTRUCTOR: - case RID_HAS_TRIVIAL_COPY: + case RID_HAS_TRIVIAL_COPY: case RID_HAS_TRIVIAL_DESTRUCTOR: case RID_HAS_UNIQUE_OBJ_REPRESENTATIONS: case RID_HAS_VIRTUAL_DESTRUCTOR: @@ -6687,7 +6687,7 @@ cp_parser_qualifying_entity (cp_parser *parser, saved_object_scope = parser->object_scope; /* Try for a class-name first. If the SAVED_SCOPE is a type, then there is no need to look for a namespace-name. */ - only_class_p = template_keyword_p + only_class_p = template_keyword_p || (saved_scope && TYPE_P (saved_scope) && cxx_dialect == cxx98); if (!only_class_p) cp_parser_parse_tentatively (parser); @@ -6734,7 +6734,7 @@ cp_parser_compound_literal_p (cp_parser *parser) = (cp_parser_skip_to_closing_parenthesis (parser, false, false, /*consume_paren=*/true) && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)); - + /* Roll back the tokens we skipped. */ cp_lexer_rollback_tokens (parser->lexer); @@ -6884,7 +6884,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, break; case RID_REINTCAST: postfix_expression - = build_reinterpret_cast (type, expression, + = build_reinterpret_cast (type, expression, tf_warning_or_error); break; case RID_CONSTCAST: @@ -7766,7 +7766,7 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser, (name, parser->scope, scope); postfix_expression = finish_class_member_access_expr (postfix_expression, name, - template_p, + template_p, tf_warning_or_error); /* Build a location e.g.: ptr->access_expr @@ -8687,7 +8687,7 @@ cp_parser_new_expression (cp_parser* parser) { error_at (token->location, "array bound forbidden after parenthesized type-id"); - inform (token->location, + inform (token->location, "try removing the parentheses around the type-id"); cp_parser_direct_new_declarator (parser); } @@ -8861,7 +8861,7 @@ cp_parser_new_declarator_opt (cp_parser* parser) { enum tree_code code; tree type, std_attributes = NULL_TREE; - cp_cv_quals cv_quals; + cp_cv_quals cv_quals; /* We don't know if there's a ptr-operator next, or not. */ cp_parser_parse_tentatively (parser); @@ -9345,7 +9345,7 @@ cp_parser_cast_expression (cp_parser *parser, bool address_p, bool cast_p, return expr; } } - else + else cp_parser_abort_tentative_parse (parser); } @@ -10316,7 +10316,7 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword) if (binary) { cp_parser_require (parser, CPP_COMMA, RT_COMMA); - + { type_id_in_expr_sentinel s (parser); type2 = cp_parser_type_id (parser); @@ -11227,7 +11227,7 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr, } cp_parser_declaration_statement (parser); return; - + case RID_TRANSACTION_ATOMIC: case RID_TRANSACTION_RELAXED: case RID_SYNCHRONIZED: @@ -11649,12 +11649,12 @@ cp_parser_statement_seq_opt (cp_parser* parser, tree in_statement_expr) || token->type == CPP_PRAGMA_EOL || (token->type == CPP_KEYWORD && token->keyword == RID_AT_END)) break; - + /* If we are in a compound statement and find 'else' then something went wrong. */ else if (token->type == CPP_KEYWORD && token->keyword == RID_ELSE) { - if (parser->in_statement & IN_IF_STMT) + if (parser->in_statement & IN_IF_STMT) break; else { @@ -12092,7 +12092,7 @@ cp_parser_condition (cp_parser* parser) if (cp_lexer_next_token_is_not (parser->lexer, CPP_EQ) && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)) cp_parser_simulate_error (parser); - + /* If we did see an `=' or '{', then we are looking at a declaration for sure. */ if (cp_parser_parse_definitely (parser)) @@ -12857,7 +12857,7 @@ cp_parser_jump_statement (cp_parser* parser) switch (keyword) { case RID_BREAK: - in_statement = parser->in_statement & ~IN_IF_STMT; + in_statement = parser->in_statement & ~IN_IF_STMT; switch (in_statement) { case 0: @@ -14050,7 +14050,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser, GNU Extension: thread */ case RID_AUTO: - if (cxx_dialect == cxx98) + if (cxx_dialect == cxx98) { /* Consume the token. */ cp_lexer_consume_token (parser->lexer); @@ -14421,12 +14421,12 @@ cp_parser_linkage_specification (cp_parser* parser) /* Parse a static_assert-declaration. static_assert-declaration: - static_assert ( constant-expression , string-literal ) ; + static_assert ( constant-expression , string-literal ) ; static_assert ( constant-expression ) ; (C++17) If MEMBER_P, this static_assert is a class member. */ -static void +static void cp_parser_static_assert(cp_parser *parser, bool member_p) { cp_expr condition; @@ -14439,7 +14439,7 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) token_loc = cp_lexer_peek_token (parser->lexer)->location; /* Look for the `static_assert' keyword. */ - if (!cp_parser_require_keyword (parser, RID_STATIC_ASSERT, + if (!cp_parser_require_keyword (parser, RID_STATIC_ASSERT, RT_STATIC_ASSERT)) return; @@ -14454,7 +14454,7 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) /* Parse the constant-expression. Allow a non-constant expression here in order to give better diagnostics in finish_static_assert. */ - condition = + condition = cp_parser_constant_expression (parser, /*allow_non_constant_p=*/true, /*non_constant_p=*/&dummy); @@ -14477,14 +14477,14 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) cp_parser_require (parser, CPP_COMMA, RT_COMMA); /* Parse the string-literal message. */ - message = cp_parser_string_literal (parser, + message = cp_parser_string_literal (parser, /*translate=*/false, /*wide_ok=*/true); /* A `)' completes the static assertion. */ if (!parens.require_close (parser)) - cp_parser_skip_to_closing_parenthesis (parser, - /*recovering=*/true, + cp_parser_skip_to_closing_parenthesis (parser, + /*recovering=*/true, /*or_comma=*/false, /*consume_paren=*/true); } @@ -14499,7 +14499,7 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) if (assert_loc == UNKNOWN_LOCATION) assert_loc = token_loc; - /* Complete the static assertion, which may mean either processing + /* Complete the static assertion, which may mean either processing the static assert now or saving it for template instantiation. */ finish_static_assert (condition, message, assert_loc, member_p); } @@ -14573,7 +14573,7 @@ cp_parser_decltype_expr (cp_parser *parser, id_expression_or_member_access_p = true; } - if (expr + if (expr && expr != error_mark_node && cp_lexer_peek_token (parser->lexer)->type == CPP_CLOSE_PAREN) /* We have an id-expression. */ @@ -14593,7 +14593,7 @@ cp_parser_decltype_expr (cp_parser *parser, /*cast_p=*/false, /*decltype*/true, /*member_access_only_p=*/true, NULL); - if (expr + if (expr && expr != error_mark_node && cp_lexer_peek_token (parser->lexer)->type == CPP_CLOSE_PAREN) /* We have an id-expression. */ @@ -14652,7 +14652,7 @@ cp_parser_decltype (cp_parser *parser) push_deferring_access_checks (dk_deferred); tree expr = NULL_TREE; - + if (cxx_dialect >= cxx14 && cp_lexer_next_token_is_keyword (parser->lexer, RID_AUTO)) /* decltype (auto) */ @@ -14737,7 +14737,7 @@ cp_parser_decltype (cp_parser *parser) cp_lexer_purge_tokens_after (parser->lexer, start_token); pop_to_parent_deferring_access_checks (); - + return expr; } @@ -15109,7 +15109,7 @@ cp_parser_mem_initializer_id (cp_parser* parser) /* `typename' is not allowed in this context ([temp.res]). */ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME)) { - error_at (token->location, + error_at (token->location, "keyword % not allowed in this context (a qualified " "member initializer is implicitly a type)"); cp_lexer_consume_token (parser->lexer); @@ -15639,7 +15639,7 @@ cp_parser_template_parameter_list (cp_parser* parser) /* Parse the template-parameter. */ parm_loc = cp_lexer_peek_token (parser->lexer)->location; - parameter = cp_parser_template_parameter (parser, + parameter = cp_parser_template_parameter (parser, &is_non_type, &is_parameter_pack); /* Add it to the list. */ @@ -16916,7 +16916,7 @@ cp_parser_template_argument (cp_parser* parser) Here 'X()' is a valid type-id of a function type, but the user just wanted to write the expression "X() >> 5". Thus, we remember that we found a valid type-id, but we still try to parse the argument as an - expression to see what happens. + expression to see what happens. In C++0x, the '>>' will be considered two separate '>' tokens. */ @@ -17542,7 +17542,7 @@ cp_parser_type_specifier (cp_parser* parser, simple-type-specifier: auto - decltype ( expression ) + decltype ( expression ) char16_t char32_t __underlying_type ( type-id ) @@ -18036,12 +18036,12 @@ cp_parser_type_name (cp_parser* parser, bool typename_keyword_p) /*is_declaration=*/false); /* Note that this must be an instantiation of an alias template because [temp.names]/6 says: - + A template-id that names an alias template specialization is a type-name. Whereas [temp.names]/7 says: - + A simple-template-id that names a class template specialization is a class-name. @@ -18192,7 +18192,7 @@ cp_parser_nonclass_name (cp_parser* parser) type_decl = cp_parser_lookup_name_simple (parser, identifier, token->location); type_decl = strip_using_decl (type_decl); - + /* If we found an overload set, then it may refer to a concept-name. */ if (tree decl = cp_parser_maybe_concept_name (parser, type_decl)) type_decl = decl; @@ -18230,7 +18230,7 @@ cp_parser_nonclass_name (cp_parser* parser) else if (type_decl != error_mark_node && !parser->scope) maybe_note_name_used_in_class (identifier, type_decl); - + return type_decl; } @@ -18395,7 +18395,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, /* If the `typename' keyword is in effect and DECL is not a type decl, then type is non existent. */ else if (tag_type == typename_type && TREE_CODE (decl) != TYPE_DECL) - ; + ; else if (TREE_CODE (decl) == TYPE_DECL) { type = check_elaborated_type_specifier (tag_type, decl, @@ -18410,7 +18410,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, check_unqualified_spec_or_inst (type, token->location); } else if (decl == error_mark_node) - type = error_mark_node; + type = error_mark_node; } if (!type) @@ -18658,7 +18658,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, enum-key identifier enum-base [opt] ; GNU Extensions: - enum-key attributes[opt] identifier [opt] enum-base [opt] + enum-key attributes[opt] identifier [opt] enum-base [opt] { enumerator-list [opt] }attributes[opt] enum-key attributes[opt] identifier [opt] enum-base [opt] { enumerator-list, }attributes[opt] [C++0x] @@ -19237,7 +19237,7 @@ cp_parser_namespace_definition (cp_parser* parser) for (;;) { identifier = NULL_TREE; - + bool nested_inline_p = cp_lexer_next_token_is_keyword (parser->lexer, RID_INLINE); if (nested_inline_p && nested_definition_count != 0) @@ -19271,7 +19271,7 @@ cp_parser_namespace_definition (cp_parser* parser) is_inline |= nested_inline_p; break; } - + if (!nested_definition_count && cxx_dialect < cxx17) pedwarn (input_location, OPT_Wpedantic, "nested namespace definitions only available with " @@ -19290,7 +19290,7 @@ cp_parser_namespace_definition (cp_parser* parser) if (nested_definition_count && !identifier) cp_parser_error (parser, "namespace name required"); - + if (nested_definition_count && attribs) error_at (token->location, "a nested namespace definition cannot have attributes"); @@ -19356,7 +19356,7 @@ cp_parser_namespace_alias_definition (cp_parser* parser) return; /* Look for the `=' token. */ if (!cp_parser_uncommitted_to_tentative_parse_p (parser) - && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) + && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) { error_at (token->location, "% definition is not allowed here"); /* Skip the definition. */ @@ -19406,15 +19406,15 @@ cp_parser_qualified_namespace_specifier (cp_parser* parser) using-declaration: using typename [opt] :: [opt] nested-name-specifier unqualified-id ; - using :: unqualified-id ; + using :: unqualified-id ; access-declaration: - qualified-id ; + qualified-id ; */ static bool -cp_parser_using_declaration (cp_parser* parser, +cp_parser_using_declaration (cp_parser* parser, bool access_declaration_p) { cp_token *token; @@ -19435,7 +19435,7 @@ cp_parser_using_declaration (cp_parser* parser, { /* Look for the `using' keyword. */ cp_parser_require_keyword (parser, RID_USING, RT_USING); - + again: /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); @@ -20530,7 +20530,7 @@ cp_parser_init_declarator (cp_parser* parser, /* Core issue #226 (C++0x only): A default template-argument shall not be specified in a friend class template declaration. */ - check_default_tmpl_args (decl, current_template_parms, /*is_primary=*/true, + check_default_tmpl_args (decl, current_template_parms, /*is_primary=*/true, /*is_partial=*/false, /*is_friend_decl=*/1); if (!friend_p && pushed_scope) @@ -21870,7 +21870,7 @@ cp_parser_type_id_1 (cp_parser *parser, cp_parser_flags flags, return error_mark_node; } } - + return groktypename (&type_specifier_seq, abstract_declarator, is_template_arg); } @@ -22475,7 +22475,7 @@ cp_parser_parameter_declaration (cp_parser *parser, /* Consume the `...'. */ cp_lexer_consume_token (parser->lexer); maybe_warn_variadic_templates (); - + /* Build a pack expansion type */ if (template_parm_p) template_parameter_pack_p = true; @@ -22529,11 +22529,11 @@ cp_parser_parameter_declaration (cp_parser *parser, || (decl_specifiers.type && PACK_EXPANSION_P (decl_specifiers.type))) { - /* Find the name of the parameter pack. */ + /* Find the name of the parameter pack. */ cp_declarator *id_declarator = declarator; while (id_declarator && id_declarator->kind != cdk_id) id_declarator = id_declarator->declarator; - + if (id_declarator && id_declarator->kind == cdk_id) error_at (declarator_token_start->location, template_parm_p @@ -22824,7 +22824,7 @@ cp_parser_initializer_clause (cp_parser* parser, bool* non_constant_p) production is used). The TREE_TYPE for the CONSTRUCTOR will be NULL_TREE. There is no way to detect whether or not the optional trailing `,' was provided. NON_CONSTANT_P is as for - cp_parser_initializer. */ + cp_parser_initializer. */ static cp_expr cp_parser_braced_list (cp_parser* parser, bool* non_constant_p) @@ -22925,7 +22925,7 @@ cp_parser_array_designator_p (cp_parser *parser) bool array_designator_p = (cp_parser_skip_to_closing_square_bracket (parser) && cp_lexer_next_token_is (parser->lexer, CPP_EQ)); - + /* Roll back the tokens we skipped. */ cp_lexer_rollback_tokens (parser->lexer); @@ -23313,7 +23313,7 @@ cp_parser_class_name (cp_parser *parser, /* In Objective-C 2.0, a classname followed by '.' starts a dot-syntax expression, and it's not a type-name. */ || (c_dialect_objc () - && cp_lexer_peek_token (parser->lexer)->type == CPP_DOT + && cp_lexer_peek_token (parser->lexer)->type == CPP_DOT && objc_is_class_name (decl))) decl = error_mark_node; @@ -24296,7 +24296,7 @@ cp_parser_type_parameter_key (cp_parser* parser) if (pedantic && tag_type == typename_type && cxx_dialect < cxx17) /* typename is not allowed in a template template parameter by the standard until C++17. */ - pedwarn (token->location, OPT_Wpedantic, + pedwarn (token->location, OPT_Wpedantic, "ISO C++ forbids typename key in template template parameter;" " use %<-std=c++17%> or %<-std=gnu++17%>"); } @@ -24385,7 +24385,7 @@ cp_parser_member_specification_opt (cp_parser* parser) member-declarator: declarator attributes [opt] pure-specifier [opt] declarator attributes [opt] constant-initializer [opt] - identifier [opt] attributes [opt] : constant-expression + identifier [opt] attributes [opt] : constant-expression C++0x Extensions: @@ -24696,7 +24696,7 @@ cp_parser_member_declaration (cp_parser* parser) } } else - { + { /* Look for attributes that apply to the bitfield after the `:' token and width. This is where GCC used to parse attributes in the past, pedwarn if there is @@ -25882,8 +25882,8 @@ cp_parser_asm_operand_list (cp_parser* parser) /* Look for the `)'. */ parens.require_close (parser); - if (name == error_mark_node - || string_literal == error_mark_node + if (name == error_mark_node + || string_literal == error_mark_node || expression == error_mark_node) invalid_operands = true; @@ -26166,7 +26166,7 @@ cp_parser_gnu_attribute_list (cp_parser* parser, bool exactly_one /* = false */) /* Save away the identifier that indicates which attribute this is. */ - identifier = (token->type == CPP_KEYWORD) + identifier = (token->type == CPP_KEYWORD) /* For keywords, use the canonical spelling, not the parsed identifier. */ ? ridpointers[(int) token->keyword] @@ -26183,9 +26183,9 @@ cp_parser_gnu_attribute_list (cp_parser* parser, bool exactly_one /* = false */) vec *vec; int attr_flag = (attribute_takes_identifier_p (identifier) ? id_attr : normal_attr); - vec = cp_parser_parenthesized_expression_list - (parser, attr_flag, /*cast_p=*/false, - /*allow_expansion_p=*/false, + vec = cp_parser_parenthesized_expression_list + (parser, attr_flag, /*cast_p=*/false, + /*allow_expansion_p=*/false, /*non_constant_p=*/NULL); if (vec == NULL) arguments = error_mark_node; @@ -27538,7 +27538,7 @@ cp_parser_check_declarator_template_parameters (cp_parser* parser, template_id_p = true; } - return cp_parser_check_template_parameters + return cp_parser_check_template_parameters (parser, num_templates, template_id_p, declarator_location, declarator); } @@ -27590,14 +27590,14 @@ cp_parser_check_template_parameters (cp_parser* parser, { if (declarator && !current_function_decl) error_at (location, "specializing member %<%T::%E%> " - "requires %%> syntax", + "requires %%> syntax", declarator->u.id.qualifying_scope, declarator->u.id.unqualified_name); else if (declarator) error_at (location, "invalid declaration of %<%T::%E%>", declarator->u.id.qualifying_scope, declarator->u.id.unqualified_name); - else + else error_at (location, "too few template-parameter-lists"); return false; } @@ -29307,8 +29307,8 @@ cp_parser_set_storage_class (cp_parser *parser, decl_specs->storage_class = storage_class; set_and_check_decl_spec_loc (decl_specs, ds_storage_class, token); - /* A storage class specifier cannot be applied alongside a typedef - specifier. If there is a typedef specifier present then set + /* A storage class specifier cannot be applied alongside a typedef + specifier. If there is a typedef specifier present then set conflicting_specifiers_p which will trigger an error later on in grokdeclarator. */ if (decl_spec_seq_has_spec_p (decl_specs, ds_typedef)) @@ -29415,7 +29415,7 @@ set_and_check_decl_spec_loc (cp_decl_specifier_seq *decl_specs, { decl_specs->locations[ds_long_long] = location; pedwarn_cxx98 (location, - OPT_Wlong_long, + OPT_Wlong_long, "ISO C++ 1998 does not support %"); } } @@ -29843,7 +29843,7 @@ cp_parser_next_token_ends_template_argument_p (cp_parser *parser) cp_token *token; token = cp_lexer_peek_token (parser->lexer); - return (token->type == CPP_COMMA + return (token->type == CPP_COMMA || token->type == CPP_GREATER || token->type == CPP_ELLIPSIS || ((cxx_dialect != cxx98) && token->type == CPP_RSHIFT)); @@ -30528,7 +30528,7 @@ cp_parser_objc_message_receiver (cp_parser* parser) if (cp_parser_parse_definitely (parser)) return objc_get_class_reference (rcv); - + cp_parser_error (parser, "objective-c++ message receiver expected"); return error_mark_node; } @@ -30629,7 +30629,7 @@ cp_parser_objc_encode_expression (cp_parser* parser) if (!type) { - error_at (token->location, + error_at (token->location, "%<@encode%> must specify a type as an argument"); return error_mark_node; } @@ -30811,7 +30811,7 @@ cp_parser_objc_identifier_list (cp_parser* parser) identifier = cp_parser_identifier (parser); if (identifier == error_mark_node) - return error_mark_node; + return error_mark_node; list = build_tree_list (NULL_TREE, identifier); sep = cp_lexer_peek_token (parser->lexer); @@ -30827,7 +30827,7 @@ cp_parser_objc_identifier_list (cp_parser* parser) identifier)); sep = cp_lexer_peek_token (parser->lexer); } - + return list; } @@ -30866,11 +30866,11 @@ cp_parser_objc_class_declaration (cp_parser* parser) while (true) { tree id; - + id = cp_parser_identifier (parser); if (id == error_mark_node) break; - + objc_declare_class (id); if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)) @@ -30994,7 +30994,7 @@ cp_parser_objc_typename (cp_parser* parser) if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN)) { cp_type = cp_parser_type_id (parser); - + /* If the type could not be parsed, an error has already been produced. For error recovery, behave as if it had not been specified, which will use the default type @@ -31126,7 +31126,7 @@ cp_parser_objc_method_keyword_params (cp_parser* parser, tree* attributes) if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON) || cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) return params; - cp_parser_error (parser, + cp_parser_error (parser, "method attributes must be specified at the end"); return error_mark_node; } @@ -31142,7 +31142,7 @@ cp_parser_objc_method_keyword_params (cp_parser* parser, tree* attributes) /* Parse the non-keyword Objective-C params. */ static tree -cp_parser_objc_method_tail_params_opt (cp_parser* parser, bool *ellipsisp, +cp_parser_objc_method_tail_params_opt (cp_parser* parser, bool *ellipsisp, tree* attributes) { tree params = make_node (TREE_LIST); @@ -31187,12 +31187,12 @@ cp_parser_objc_method_tail_params_opt (cp_parser* parser, bool *ellipsisp, || cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) return params; } - else - /* We have an error, but parse the attributes, so that we can + else + /* We have an error, but parse the attributes, so that we can carry on. */ *attributes = cp_parser_attributes_opt (parser); - cp_parser_error (parser, + cp_parser_error (parser, "method attributes must be specified at the end"); return error_mark_node; } @@ -31269,11 +31269,11 @@ cp_parser_objc_method_signature (cp_parser* parser, tree* attributes) static bool cp_parser_objc_method_maybe_bad_prefix_attributes (cp_parser* parser) { - tree tattr; + tree tattr; cp_lexer_save_tokens (parser->lexer); tattr = cp_parser_attributes_opt (parser); gcc_assert (tattr) ; - + /* If the attributes are followed by a method introducer, this is not allowed. Dump the attributes and flag the situation. */ if (cp_lexer_next_token_is (parser->lexer, CPP_PLUS) @@ -31283,7 +31283,7 @@ cp_parser_objc_method_maybe_bad_prefix_attributes (cp_parser* parser) /* Otherwise, the attributes introduce some interstitial code, possibly so rewind to allow that check. */ cp_lexer_rollback_tokens (parser->lexer); - return false; + return false; } /* Parse an Objective-C method prototype list. */ @@ -31315,10 +31315,10 @@ cp_parser_objc_method_prototype_list (cp_parser* parser) } else if (token->keyword == RID_AT_PROPERTY) cp_parser_objc_at_property_declaration (parser); - else if (token->keyword == RID_ATTRIBUTE + else if (token->keyword == RID_ATTRIBUTE && cp_parser_objc_method_maybe_bad_prefix_attributes(parser)) - warning_at (cp_lexer_peek_token (parser->lexer)->location, - OPT_Wattributes, + warning_at (cp_lexer_peek_token (parser->lexer)->location, + OPT_Wattributes, "prefix attributes are ignored for methods"); else /* Allow for interspersed non-ObjC++ code. */ @@ -31371,7 +31371,7 @@ cp_parser_objc_method_definition_list (cp_parser* parser) cp_lexer_consume_token (parser->lexer); ptk = cp_lexer_peek_token (parser->lexer); - if (!(ptk->type == CPP_PLUS || ptk->type == CPP_MINUS + if (!(ptk->type == CPP_PLUS || ptk->type == CPP_MINUS || ptk->type == CPP_EOF || ptk->keyword == RID_AT_END)) { perform_deferred_access_checks (tf_warning_or_error); @@ -31390,7 +31390,7 @@ cp_parser_objc_method_definition_list (cp_parser* parser) cp_parser_objc_at_synthesize_declaration (parser); else if (token->keyword == RID_AT_DYNAMIC) cp_parser_objc_at_dynamic_declaration (parser); - else if (token->keyword == RID_ATTRIBUTE + else if (token->keyword == RID_ATTRIBUTE && cp_parser_objc_method_maybe_bad_prefix_attributes(parser)) warning_at (token->location, OPT_Wattributes, "prefix attributes are ignored for methods"); @@ -31422,7 +31422,7 @@ cp_parser_objc_class_ivars (cp_parser* parser) cp_lexer_consume_token (parser->lexer); /* Eat '{'. */ token = cp_lexer_peek_token (parser->lexer); - while (token->type != CPP_CLOSE_BRACE + while (token->type != CPP_CLOSE_BRACE && token->keyword != RID_AT_END && token->type != CPP_EOF) { cp_decl_specifier_seq declspecs; @@ -31442,7 +31442,7 @@ cp_parser_objc_class_ivars (cp_parser* parser) /* auto, register, static, extern, mutable. */ if (declspecs.storage_class != sc_none) { - cp_parser_error (parser, "invalid type for instance variable"); + cp_parser_error (parser, "invalid type for instance variable"); declspecs.storage_class = sc_none; } @@ -31452,7 +31452,7 @@ cp_parser_objc_class_ivars (cp_parser* parser) cp_parser_error (parser, "invalid type for instance variable"); declspecs.locations[ds_thread] = 0; } - + /* typedef. */ if (decl_spec_seq_has_spec_p (&declspecs, ds_typedef)) { @@ -31552,10 +31552,10 @@ cp_parser_objc_class_ivars (cp_parser* parser) cp_parser_error (parser, "expected %<}%>"); /* Do not consume the RID_AT_END, so it will be read again as terminating - the @interface of @implementation. */ + the @interface of @implementation. */ if (token->keyword != RID_AT_END && token->type != CPP_EOF) cp_lexer_consume_token (parser->lexer); /* Eat '}'. */ - + /* For historical reasons, we accept an optional semicolon. */ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) cp_lexer_consume_token (parser->lexer); @@ -31587,13 +31587,13 @@ cp_parser_objc_protocol_declaration (cp_parser* parser, tree attributes) while (true) { tree id; - + id = cp_parser_identifier (parser); if (id == error_mark_node) break; - + objc_declare_protocol (id, attributes); - + if(cp_lexer_next_token_is (parser->lexer, CPP_COMMA)) cp_lexer_consume_token (parser->lexer); else @@ -31615,7 +31615,7 @@ cp_parser_objc_protocol_declaration (cp_parser* parser, tree attributes) /* Parse an Objective-C superclass or category. */ static void -cp_parser_objc_superclass_or_category (cp_parser *parser, +cp_parser_objc_superclass_or_category (cp_parser *parser, bool iface_p, tree *super, tree *categ, bool *is_class_extension) @@ -31810,7 +31810,7 @@ cp_parser_objc_declaration (cp_parser* parser, tree attributes) Returns NULL_TREE. PS: This function is identical to c_parser_objc_try_catch_finally_statement - for C. Keep them in sync. */ + for C. Keep them in sync. */ static tree cp_parser_objc_try_catch_finally_statement (cp_parser *parser) @@ -31875,7 +31875,7 @@ cp_parser_objc_try_catch_finally_statement (cp_parser *parser) going. */ if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_PAREN)) cp_lexer_consume_token (parser->lexer); - + /* If these is no immediate closing parenthesis, the user probably doesn't know that parenthesis are required at all (ie, they typed "@catch NSException *e"). So, just @@ -31977,9 +31977,9 @@ cp_parser_objc_statement (cp_parser * parser) return error_mark_node; } -/* If we are compiling ObjC++ and we see an __attribute__ we neeed to +/* If we are compiling ObjC++ and we see an __attribute__ we neeed to look ahead to see if an objc keyword follows the attributes. This - is to detect the use of prefix attributes on ObjC @interface and + is to detect the use of prefix attributes on ObjC @interface and @protocol. */ static bool @@ -31994,7 +31994,7 @@ cp_parser_objc_valid_prefix_attributes (cp_parser* parser, tree *attrib) return true; } cp_lexer_rollback_tokens (parser->lexer); - return false; + return false; } /* This routine is a minimal replacement for @@ -32031,14 +32031,14 @@ cp_parser_objc_struct_declaration (cp_parser *parser) cp_parser_error (parser, "invalid type for property"); declspecs.storage_class = sc_none; } - + /* thread_local. */ if (decl_spec_seq_has_spec_p (&declspecs, ds_thread)) { cp_parser_error (parser, "invalid type for property"); declspecs.locations[ds_thread] = 0; } - + /* typedef. */ if (decl_spec_seq_has_spec_p (&declspecs, ds_typedef)) { @@ -32075,7 +32075,7 @@ cp_parser_objc_struct_declaration (cp_parser *parser) if (decl == error_mark_node || decl == NULL_TREE) return error_mark_node; - + /* Reset PREFIX_ATTRIBUTES. */ if (attributes != error_mark_node) { @@ -32130,7 +32130,7 @@ cp_parser_objc_struct_declaration (cp_parser *parser) PS: This function is identical to c_parser_objc_at_property_declaration for C. Keep them in sync. */ -static void +static void cp_parser_objc_at_property_declaration (cp_parser *parser) { /* The following variables hold the attributes of the properties as @@ -32281,7 +32281,7 @@ cp_parser_objc_at_property_declaration (cp_parser *parser) /* Comma-separated properties are chained together in reverse order; add them one by one. */ properties = nreverse (properties); - + for (; properties; properties = TREE_CHAIN (properties)) objc_add_property_declaration (loc, copy_node (properties), property_readonly, property_readwrite, @@ -32289,7 +32289,7 @@ cp_parser_objc_at_property_declaration (cp_parser *parser) property_copy, property_nonatomic, property_getter_ident, property_setter_ident); } - + cp_parser_consume_semicolon_at_end_of_statement (parser); } @@ -32313,7 +32313,7 @@ cp_parser_objc_at_property_declaration (cp_parser *parser) PS: This function is identical to c_parser_objc_at_synthesize_declaration for C. Keep them in sync. */ -static void +static void cp_parser_objc_at_synthesize_declaration (cp_parser *parser) { tree list = NULL_TREE; @@ -32364,7 +32364,7 @@ cp_parser_objc_at_synthesize_declaration (cp_parser *parser) PS: This function is identical to c_parser_objc_at_dynamic_declaration for C. Keep them in sync. */ -static void +static void cp_parser_objc_at_dynamic_declaration (cp_parser *parser) { tree list = NULL_TREE; @@ -33147,7 +33147,7 @@ cp_parser_oacc_clause_tile (cp_parser *parser, location_t clause_loc, tree list) { if (tile && !cp_parser_require (parser, CPP_COMMA, RT_COMMA)) return list; - + if (cp_lexer_next_token_is (parser->lexer, CPP_MULT) && (cp_lexer_nth_token_is (parser->lexer, 2, CPP_COMMA) || cp_lexer_nth_token_is (parser->lexer, 2, CPP_CLOSE_PAREN))) @@ -34472,7 +34472,7 @@ cp_parser_omp_clause_lastprivate (cp_parser *parser, tree list) linear ( modifier ( variable-list ) : expression ) */ static tree -cp_parser_omp_clause_linear (cp_parser *parser, tree list, +cp_parser_omp_clause_linear (cp_parser *parser, tree list, bool declare_simd) { tree nlist, c, step = integer_one_node; @@ -36700,10 +36700,10 @@ cp_parser_omp_for_loop_init (cp_parser *parser, attributes = cp_parser_attributes_opt (parser); asm_specification = cp_parser_asm_specification_opt (parser); - if (declarator == cp_error_declarator) + if (declarator == cp_error_declarator) cp_parser_skip_to_end_of_statement (parser); - else + else { tree pushed_scope, auto_node; @@ -36715,7 +36715,7 @@ cp_parser_omp_for_loop_init (cp_parser *parser, auto_node = type_uses_auto (TREE_TYPE (decl)); if (cp_lexer_next_token_is_not (parser->lexer, CPP_EQ)) { - if (cp_lexer_next_token_is (parser->lexer, + if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN)) error ("parenthesized initialization is not allowed in " "OpenMP % loop"); @@ -36746,7 +36746,7 @@ cp_parser_omp_for_loop_init (cp_parser *parser, && !type_dependent_expression_p (decl)) goto non_class; } - + cp_finish_decl (decl, init, !is_non_constant_init, asm_specification, LOOKUP_ONLYCONVERTING); @@ -36806,7 +36806,7 @@ cp_parser_omp_for_loop_init (cp_parser *parser, pop_scope (pushed_scope); } } - else + else { cp_id_kind idk; /* If parsing a type specifier sequence failed, then @@ -39855,7 +39855,7 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok, cp_token_cache *cp; int errs; void *p; - + /* Get the high-water mark for the DECLARATOR_OBSTACK. */ p = obstack_alloc (&declarator_obstack, 0); @@ -41364,7 +41364,7 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context, bool *if_p) break; case PRAGMA_OMP_SECTION: - error_at (pragma_tok->location, + error_at (pragma_tok->location, "%<#pragma omp section%> may only be used in " "%<#pragma omp sections%> construct"); break; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index cc306fcaa89..c5161a7782f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2238,10 +2238,10 @@ determine_specialization (tree template_id, /* Skip the "this" parameter and, for constructors of classes with virtual bases, the VTT parameter. A full specialization of a constructor will have a VTT - parameter, but a template never will. */ - decl_arg_types + parameter, but a template never will. */ + decl_arg_types = skip_artificial_parms_for (decl, decl_arg_types); - fn_arg_types + fn_arg_types = skip_artificial_parms_for (fn, fn_arg_types); /* Function templates cannot be specializations; there are @@ -2913,7 +2913,7 @@ check_explicit_specialization (tree declarator, for (; t; t = TREE_CHAIN (t)) if (TREE_PURPOSE (t)) { - permerror (input_location, + permerror (input_location, "default argument specified in explicit specialization"); break; } @@ -3303,18 +3303,18 @@ comp_template_parms (const_tree parms1, const_tree parms2) /* Determine whether PARM is a parameter pack. */ -bool +bool template_parameter_pack_p (const_tree parm) { /* Determine if we have a non-type template parameter pack. */ if (TREE_CODE (parm) == PARM_DECL) - return (DECL_TEMPLATE_PARM_P (parm) + return (DECL_TEMPLATE_PARM_P (parm) && TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm))); if (TREE_CODE (parm) == TEMPLATE_PARM_INDEX) return TEMPLATE_PARM_PARAMETER_PACK (parm); /* If this is a list of template parameters, we could get a - TYPE_DECL or a TEMPLATE_DECL. */ + TYPE_DECL or a TEMPLATE_DECL. */ if (TREE_CODE (parm) == TYPE_DECL || TREE_CODE (parm) == TEMPLATE_DECL) parm = TREE_TYPE (parm); @@ -3366,7 +3366,7 @@ function_parameter_expanded_from_pack_p (tree param_decl, tree pack) /* Determine whether ARGS describes a variadic template args list, i.e., one that is terminated by a template argument pack. */ -static bool +static bool template_args_variadic_p (tree args) { int nargs; @@ -3640,7 +3640,7 @@ expand_builtin_pack_call (tree call, tree args, tsubst_flags_t complain, } /* Structure used to track the progress of find_parameter_packs_r. */ -struct find_parameter_pack_data +struct find_parameter_pack_data { /* TREE_LIST that will contain all of the parameter packs found by the traversal. */ @@ -3661,7 +3661,7 @@ static tree find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) { tree t = *tp; - struct find_parameter_pack_data* ppd = + struct find_parameter_pack_data* ppd = (struct find_parameter_pack_data*)data; bool parameter_pack_p = false; @@ -3746,22 +3746,22 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) } if (TYPE_P (t)) - cp_walk_tree (&TYPE_CONTEXT (t), + cp_walk_tree (&TYPE_CONTEXT (t), &find_parameter_packs_r, ppd, ppd->visited); /* This switch statement will return immediately if we don't find a parameter pack. */ - switch (TREE_CODE (t)) + switch (TREE_CODE (t)) { case TEMPLATE_PARM_INDEX: return NULL_TREE; case BOUND_TEMPLATE_TEMPLATE_PARM: /* Check the template itself. */ - cp_walk_tree (&TREE_TYPE (TYPE_TI_TEMPLATE (t)), + cp_walk_tree (&TREE_TYPE (TYPE_TI_TEMPLATE (t)), &find_parameter_packs_r, ppd, ppd->visited); /* Check the template arguments. */ - cp_walk_tree (&TYPE_TI_ARGS (t), &find_parameter_packs_r, ppd, + cp_walk_tree (&TYPE_TI_ARGS (t), &find_parameter_packs_r, ppd, ppd->visited); *walk_subtrees = 0; return NULL_TREE; @@ -3802,26 +3802,26 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd, ppd->visited); return NULL_TREE; - + case TYPENAME_TYPE: cp_walk_tree (&TYPENAME_TYPE_FULLNAME (t), &find_parameter_packs_r, ppd, ppd->visited); *walk_subtrees = 0; return NULL_TREE; - + case TYPE_PACK_EXPANSION: case EXPR_PACK_EXPANSION: *walk_subtrees = 0; return NULL_TREE; case INTEGER_TYPE: - cp_walk_tree (&TYPE_MAX_VALUE (t), &find_parameter_packs_r, + cp_walk_tree (&TYPE_MAX_VALUE (t), &find_parameter_packs_r, ppd, ppd->visited); *walk_subtrees = 0; return NULL_TREE; case IDENTIFIER_NODE: - cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd, + cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd, ppd->visited); *walk_subtrees = 0; return NULL_TREE; @@ -3894,7 +3894,7 @@ uses_parameter_packs (tree t) expansion. If all goes well, the resulting node will be an EXPR_PACK_EXPANSION, TYPE_PACK_EXPANSION, or TREE_LIST, respectively. */ -tree +tree make_pack_expansion (tree arg, tsubst_flags_t complain) { tree result; @@ -3936,7 +3936,7 @@ make_pack_expansion (tree arg, tsubst_flags_t complain) ppd.parameter_packs = ¶meter_packs; ppd.type_pack_expansion_p = false; gcc_assert (TYPE_P (TREE_PURPOSE (arg))); - cp_walk_tree (&TREE_PURPOSE (arg), &find_parameter_packs_r, + cp_walk_tree (&TREE_PURPOSE (arg), &find_parameter_packs_r, &ppd, ppd.visited); if (parameter_packs == NULL_TREE) @@ -4033,11 +4033,11 @@ make_pack_expansion (tree arg, tsubst_flags_t complain) where "args" is a parameter pack. check_for_bare_parameter_packs should not be called for the subexpressions args, h(args), g(h(args)), or f(g(h(args))), because we would produce erroneous - error messages. + error messages. Returns TRUE and emits an error if there were bare parameter packs, returns FALSE otherwise. */ -bool +bool check_for_bare_parameter_packs (tree t, location_t loc /* = UNKNOWN_LOCATION */) { tree parameter_packs = NULL_TREE; @@ -4060,7 +4060,7 @@ check_for_bare_parameter_packs (tree t, location_t loc /* = UNKNOWN_LOCATION */) cp_walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited); delete ppd.visited; - if (parameter_packs) + if (parameter_packs) { if (loc == UNKNOWN_LOCATION) loc = cp_expr_loc_or_loc (t, input_location); @@ -4298,7 +4298,7 @@ reduce_template_parm_level (tree index, tree type, int levels, tree args, TEMPLATE_PARM_ORIG_LEVEL (index), decl, type); TEMPLATE_PARM_DESCENDANTS (index) = t; - TEMPLATE_PARM_PARAMETER_PACK (t) + TEMPLATE_PARM_PARAMETER_PACK (t) = TEMPLATE_PARM_PARAMETER_PACK (index); /* Template template parameters need this. */ @@ -4391,7 +4391,7 @@ process_template_parm (tree list, location_t parm_loc, tree parm, processing_template_decl, decl, TREE_TYPE (parm)); - TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm)) + TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm)) = is_parameter_pack; } else @@ -4900,7 +4900,7 @@ process_partial_specialization (tree decl) The type of a template parameter corresponding to a specialized non-type argument shall not be dependent on a parameter of the - specialization. + specialization. Also, we verify that pack expansions only occur at the end of the argument list. */ @@ -5279,7 +5279,7 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary, error ("parameter pack %q+D must be at the end of the" " template parameter list", TREE_VALUE (parm)); - TREE_VALUE (TREE_VEC_ELT (inner_parms, i)) + TREE_VALUE (TREE_VEC_ELT (inner_parms, i)) = error_mark_node; no_errors = false; } @@ -5288,7 +5288,7 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary, } if (((cxx_dialect == cxx98) && TREE_CODE (decl) != TYPE_DECL) - || is_partial + || is_partial || !is_primary || is_friend_decl) /* For an ordinary class template, default template arguments are @@ -5497,7 +5497,7 @@ push_template_decl_real (tree decl, bool is_friend) if (is_primary) { warning (OPT_Wtemplates, "template %qD declared", decl); - + if (DECL_CLASS_SCOPE_P (decl)) member_template_p = true; if (TREE_CODE (decl) == TYPE_DECL @@ -6244,7 +6244,7 @@ convert_nontype_argument_function (tree type, tree expr, fn_no_ptr = TREE_OPERAND (fn_no_ptr, 0); if (BASELINK_P (fn_no_ptr)) fn_no_ptr = BASELINK_FUNCTIONS (fn_no_ptr); - + /* [temp.arg.nontype]/1 A template-argument for a non-type, non-template template-parameter @@ -7228,10 +7228,10 @@ coerce_template_template_parm (tree parm, if (arg == NULL_TREE || error_operand_p (arg) || parm == NULL_TREE || error_operand_p (parm)) return 0; - + if (TREE_CODE (arg) != TREE_CODE (parm)) return 0; - + switch (TREE_CODE (parm)) { case TEMPLATE_DECL: @@ -7241,23 +7241,23 @@ coerce_template_template_parm (tree parm, { tree parmparm = DECL_INNERMOST_TEMPLATE_PARMS (parm); tree argparm = DECL_INNERMOST_TEMPLATE_PARMS (arg); - + if (!coerce_template_template_parms (parmparm, argparm, complain, in_decl, outer_args)) return 0; } /* Fall through. */ - + case TYPE_DECL: if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (arg)) && !TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (parm))) /* Argument is a parameter pack but parameter is not. */ return 0; break; - + case PARM_DECL: /* The tsubst call is used to handle cases such as - + template class C {}; template class TT> class D {}; D d; @@ -7270,12 +7270,12 @@ coerce_template_template_parm (tree parm, && !same_type_p (t, TREE_TYPE (arg))) return 0; } - + if (TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (arg)) && !TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm))) /* Argument is a parameter pack but parameter is not. */ return 0; - + break; default: @@ -7595,7 +7595,7 @@ coerce_template_template_parms (tree parm_parms, if (TREE_VEC_ELT (parm_parms, nparms - 1) != error_mark_node) { parm = TREE_VALUE (TREE_VEC_ELT (parm_parms, nparms - 1)); - + if (error_operand_p (parm)) return 0; @@ -7606,17 +7606,17 @@ coerce_template_template_parms (tree parm_parms, if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (parm))) variadic_p = 1; break; - + case PARM_DECL: if (TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm))) variadic_p = 1; break; - + default: gcc_unreachable (); } } - + if (nargs != nparms && !(variadic_p && nargs >= nparms - 1)) return 0; @@ -7652,9 +7652,9 @@ coerce_template_template_parms (tree parm_parms, { if (TREE_VEC_ELT (arg_parms, i) == error_mark_node) continue; - + arg = TREE_VALUE (TREE_VEC_ELT (arg_parms, i)); - + if (!coerce_template_template_parm (parm, arg, complain, in_decl, outer_args)) return 0; @@ -7672,7 +7672,7 @@ coerce_template_template_parms (tree parm_parms, routine can only be called after all template arguments have been deduced. It will return TRUE if all of the template template parameter bindings are okay, FALSE otherwise. */ -bool +bool template_template_parm_bindings_ok_p (tree tparms, tree targs) { int i, ntparms = TREE_VEC_LENGTH (tparms); @@ -7916,7 +7916,7 @@ convert_template_argument (tree parm, } } - is_tmpl_type = + is_tmpl_type = ((TREE_CODE (arg) == TEMPLATE_DECL && TREE_CODE (DECL_TEMPLATE_RESULT (arg)) == TYPE_DECL) || (requires_tmpl_type && TREE_CODE (arg) == TYPE_ARGUMENT_PACK) @@ -8270,7 +8270,7 @@ coerce_template_parameter_pack (tree parms, error ("template argument %d is invalid", arg_idx + 1); } else - arg = convert_template_argument (actual_parm, + arg = convert_template_argument (actual_parm, arg, new_args, complain, parm_idx, in_decl); if (arg == error_mark_node) @@ -8474,7 +8474,7 @@ coerce_template_parms (tree parms, /* Get the Ith template parameter. */ parm = TREE_VEC_ELT (parms, parm_idx); - + if (parm == error_mark_node) { TREE_VEC_ELT (new_inner_args, arg_idx) = error_mark_node; @@ -8493,7 +8493,7 @@ coerce_template_parms (tree parms, { /* Some arguments will be placed in the template parameter pack PARM. */ - arg = coerce_template_parameter_pack (parms, parm_idx, args, + arg = coerce_template_parameter_pack (parms, parm_idx, args, inner_args, arg_idx, new_args, &lost, in_decl, complain); @@ -8527,7 +8527,7 @@ coerce_template_parms (tree parms, fixed_pack_adjust += pack_adjust; } } - + continue; } else if (arg) @@ -8597,7 +8597,7 @@ coerce_template_parms (tree parms, } else arg = convert_template_argument (TREE_VALUE (parm), - arg, new_args, complain, + arg, new_args, complain, parm_idx, in_decl); if (arg == error_mark_node) @@ -9963,7 +9963,7 @@ for_each_template_parm_r (tree *tp, int *walk_subtrees, void *d) case UNDERLYING_TYPE: if (pfd->include_nondeduced_p && for_each_template_parm (TYPE_VALUES_RAW (t), fn, data, - pfd->visited, + pfd->visited, pfd->include_nondeduced_p, pfd->any_fn)) return error_mark_node; @@ -11246,10 +11246,10 @@ instantiate_class_template_1 (tree type) if (TREE_CODE (t) == STATIC_ASSERT) { tree condition; - + ++c_inhibit_evaluation_warnings; condition = - tsubst_expr (STATIC_ASSERT_CONDITION (t), args, + tsubst_expr (STATIC_ASSERT_CONDITION (t), args, tf_warning_or_error, NULL_TREE, /*integral_constant_expression_p=*/true); --c_inhibit_evaluation_warnings; @@ -12185,7 +12185,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, packs used in the expansion expression. While we're at it, compute the number of arguments to be expanded and make sure it is consistent. */ - for (pack = PACK_EXPANSION_PARAMETER_PACKS (t); pack; + for (pack = PACK_EXPANSION_PARAMETER_PACKS (t); pack; pack = TREE_CHAIN (pack)) { tree parm_pack = TREE_VALUE (pack); @@ -12273,7 +12273,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, orig_arg = arg_pack; if (arg_pack && TREE_CODE (arg_pack) == ARGUMENT_PACK_SELECT) arg_pack = ARGUMENT_PACK_SELECT_FROM_PACK (arg_pack); - + if (arg_pack && !ARGUMENT_PACK_P (arg_pack)) /* This can only happen if we forget to expand an argument pack somewhere else. Just return an error, silently. */ @@ -12428,7 +12428,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, continue; template_parm_level_and_index (parm, &level, &idx); - + /* Update the corresponding argument. */ if (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (args)) TREE_VEC_ELT (TREE_VEC_ELT (args, level -1 ), idx) = @@ -12443,7 +12443,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, delete local_specializations; local_specializations = saved_local_specializations; } - + /* If the dependent pack arguments were such that we end up with only a single pack expansion again, there's no need to keep it in a TREE_VEC. */ if (len == 1 && TREE_CODE (result) == TREE_VEC @@ -13766,7 +13766,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) /* T is a static data member or namespace-scope entity. We have to substitute into namespace-scope variables (not just variable templates) because of cases like: - + template void f() { extern T t; } where the entity referenced is not known until @@ -13827,7 +13827,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) spec = retrieve_local_specialization (t); } /* If we already have the specialization we need, there is - nothing more to do. */ + nothing more to do. */ if (spec) { r = spec; @@ -13883,7 +13883,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) void g() { f x; } declares a function, not a variable. However: - + typedef void f(); template void g() { T t; } template void g(); @@ -14052,7 +14052,7 @@ tsubst_arg_types (tree arg_types, while (i > 0) { --i; - + if (expanded_args) type = TREE_VEC_ELT (expanded_args, i); else if (!type) @@ -14073,7 +14073,7 @@ tsubst_arg_types (tree arg_types, /* DR 657. */ if (abstract_virtuals_error_sfinae (ACU_PARM, type, complain)) return error_mark_node; - + /* Do array-to-pointer, function-to-pointer conversion, and ignore top-level qualifiers as required. */ type = cv_unqualified (type_decays_to (type)); @@ -14102,10 +14102,10 @@ tsubst_arg_types (tree arg_types, remaining_arg_types); } else - remaining_arg_types = + remaining_arg_types = hash_tree_cons (default_arg, type, remaining_arg_types); } - + return remaining_arg_types; } @@ -14326,7 +14326,7 @@ tsubst_exception_specification (tree fntype, /* We're substituting into a member template, so we got a TYPE_PACK_EXPANSION back. Add that expansion and move on. */ - gcc_assert (TREE_CODE (expanded_specs) + gcc_assert (TREE_CODE (expanded_specs) == TYPE_PACK_EXPANSION); new_specs = add_exception_specifier (new_specs, expanded_specs, @@ -14535,7 +14535,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) r = NULL_TREE; gcc_assert (TREE_VEC_LENGTH (args) > 0); - template_parm_level_and_index (t, &level, &idx); + template_parm_level_and_index (t, &level, &idx); levels = TMPL_ARGS_DEPTH (args); if (level <= levels @@ -14572,7 +14572,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) gcc_assert (TYPE_P (arg)); quals = cp_type_quals (arg) | cp_type_quals (t); - + return cp_build_qualified_type_real (arg, quals, complain | tf_ignore_bad_quals); } @@ -15567,7 +15567,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) mangling. */ DECL_CONTEXT (r) = DECL_CONTEXT (t); } - + if (TREE_CODE (r) == ARGUMENT_PACK_SELECT) r = argument_pack_select_arg (r); if (!mark_used (r, complain) && !(complain & tf_error)) @@ -16353,7 +16353,7 @@ tsubst_omp_clauses (tree clauses, enum c_omp_region_type ort, case OMP_CLAUSE_ASYNC: case OMP_CLAUSE_WAIT: OMP_CLAUSE_OPERAND (nc, 0) - = tsubst_expr (OMP_CLAUSE_OPERAND (oc, 0), args, complain, + = tsubst_expr (OMP_CLAUSE_OPERAND (oc, 0), args, complain, in_decl, /*integral_constant_expression_p=*/false); break; case OMP_CLAUSE_REDUCTION: @@ -18475,7 +18475,7 @@ tsubst_copy_and_build (tree t, complain|decltype_flag)); case FIX_TRUNC_EXPR: - gcc_unreachable (); + gcc_unreachable (); case ADDR_EXPR: op1 = TREE_OPERAND (t, 0); @@ -18569,7 +18569,7 @@ tsubst_copy_and_build (tree t, || ARGUMENT_PACK_P (TREE_OPERAND (t, 0))) RETURN (tsubst_copy (t, args, complain, in_decl)); /* Fall through */ - + case ALIGNOF_EXPR: { tree r; @@ -19211,7 +19211,7 @@ tsubst_copy_and_build (tree t, RETURN (tree_cons (purposevec, valuevec, chain)); } - + /* Convert the argument vectors into a TREE_LIST */ i = len; while (i > 0) @@ -19221,7 +19221,7 @@ tsubst_copy_and_build (tree t, purpose = purposevec ? TREE_VEC_ELT (purposevec, i) : NULL_TREE; value - = valuevec ? convert_from_reference (TREE_VEC_ELT (valuevec, i)) + = valuevec ? convert_from_reference (TREE_VEC_ELT (valuevec, i)) : NULL_TREE; /* Build the list (backwards). */ @@ -19523,7 +19523,7 @@ tsubst_copy_and_build (tree t, type2 = RECUR (type2); else if (type2) type2 = tsubst (type2, args, complain, in_decl); - + RETURN (finish_trait_expr (TRAIT_EXPR_KIND (t), type1, type2)); } @@ -20901,7 +20901,7 @@ type_unification_real (tree tparms, return 1; } - if (parms + if (parms && parms != void_list_node && TREE_CODE (TREE_VALUE (parms)) == TYPE_PACK_EXPANSION) { @@ -20909,7 +20909,7 @@ type_unification_real (tree tparms, tree argvec; tree parmvec = make_tree_vec (1); - /* Allocate a TREE_VEC and copy in all of the arguments */ + /* Allocate a TREE_VEC and copy in all of the arguments */ argvec = make_tree_vec (nargs - ia); for (i = 0; ia < nargs; ++ia, ++i) TREE_VEC_ELT (argvec, i) = args[ia]; @@ -20998,7 +20998,7 @@ type_unification_real (tree tparms, /* Core issue #226 (C++0x) [temp.deduct]: If a template argument has not been deduced, its - default template argument, if any, is used. + default template argument, if any, is used. When we are in C++98 mode, TREE_PURPOSE will either be NULL_TREE or ERROR_MARK_NODE, so we do not need @@ -21667,7 +21667,7 @@ check_cv_quals_for_unify (int strict, tree arg, tree parm) } /* Determines the LEVEL and INDEX for the template parameter PARM. */ -void +void template_parm_level_and_index (tree parm, int* level, int* index) { if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM @@ -21700,11 +21700,11 @@ template_parm_level_and_index (tree parm, int* level, int* index) lists. */ static int -unify_pack_expansion (tree tparms, tree targs, tree packed_parms, +unify_pack_expansion (tree tparms, tree targs, tree packed_parms, tree packed_args, unification_kind_t strict, bool subr, bool explain_p) { - tree parm + tree parm = TREE_VEC_ELT (packed_parms, TREE_VEC_LENGTH (packed_parms) - 1); tree pattern = PACK_EXPANSION_PATTERN (parm); tree pack, packs = NULL_TREE; @@ -21720,7 +21720,7 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms, /* Determine the parameter packs we will be deducing from the pattern, and record their current deductions. */ - for (pack = PACK_EXPANSION_PARAMETER_PACKS (parm); + for (pack = PACK_EXPANSION_PARAMETER_PACKS (parm); pack; pack = TREE_CHAIN (pack)) { tree parm_pack = TREE_VALUE (pack); @@ -21741,7 +21741,7 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms, packs = tree_cons (parm_pack, TMPL_ARG (targs, level, idx), packs); TREE_TYPE (packs) = make_tree_vec (len - start); } - + /* Loop through all of the arguments that have not yet been unified and unify each with the pattern. */ for (i = start; i < len; i++) @@ -23310,7 +23310,7 @@ get_bindings (tree fn, tree decl, tree explicit_args, bool check_rettype) gcc_assert (decl != DECL_TEMPLATE_RESULT (fn)); /* Never do unification on the 'this' parameter. */ - decl_arg_types = skip_artificial_parms_for (decl, + decl_arg_types = skip_artificial_parms_for (decl, TYPE_ARG_TYPES (decl_type)); nargs = list_length (decl_arg_types); @@ -23842,7 +23842,7 @@ do_decl_instantiation (tree decl, tree storage) else if (storage == ridpointers[(int) RID_EXTERN]) { if (!in_system_header_at (input_location) && (cxx_dialect == cxx98)) - pedwarn (input_location, OPT_Wpedantic, + pedwarn (input_location, OPT_Wpedantic, "ISO C++ 1998 forbids the use of % on explicit " "instantiations"); extern_p = 1; @@ -23928,12 +23928,12 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain) if (storage == ridpointers[(int) RID_EXTERN]) { if (cxx_dialect == cxx98) - pedwarn (input_location, OPT_Wpedantic, + pedwarn (input_location, OPT_Wpedantic, "ISO C++ 1998 forbids the use of % on " "explicit instantiations"); } else - pedwarn (input_location, OPT_Wpedantic, + pedwarn (input_location, OPT_Wpedantic, "ISO C++ forbids the use of %qE" " on explicit instantiations", storage); } @@ -24097,7 +24097,7 @@ regenerate_decl_from_template (tree decl, tree tmpl, tree args) { tree parm_type; tree attributes; - + if (DECL_NAME (decl_parm) != DECL_NAME (pattern_parm)) DECL_NAME (decl_parm) = DECL_NAME (pattern_parm); parm_type = tsubst (TREE_TYPE (pattern_parm), args, tf_error, @@ -24129,7 +24129,7 @@ regenerate_decl_from_template (tree decl, tree tmpl, tree args) { tree parm_type; tree attributes; - + if (DECL_NAME (decl_parm) != DECL_NAME (pattern_parm)) /* Rename the parameter to include the index. */ DECL_NAME (decl_parm) = @@ -24958,7 +24958,7 @@ tsubst_initializer_list (tree t, tree argvec) NULL_TREE); if (expanded_bases == error_mark_node) continue; - + /* We'll be building separate TREE_LISTs of arguments for each base. */ len = TREE_VEC_LENGTH (expanded_bases); @@ -24991,7 +24991,7 @@ tsubst_initializer_list (tree t, tree argvec) /* Expand the argument. */ SET_PACK_EXPANSION_PATTERN (expr, TREE_VALUE (arg)); - expanded_exprs + expanded_exprs = tsubst_pack_expansion (expr, argvec, tf_warning_or_error, NULL_TREE); @@ -25002,8 +25002,8 @@ tsubst_initializer_list (tree t, tree argvec) corresponding TREE_LIST in EXPANDED_ARGUMENTS. */ for (i = 0; i < len; i++) { - TREE_VEC_ELT (expanded_arguments, i) = - tree_cons (NULL_TREE, + TREE_VEC_ELT (expanded_arguments, i) = + tree_cons (NULL_TREE, TREE_VEC_ELT (expanded_exprs, i), TREE_VEC_ELT (expanded_arguments, i)); } @@ -25014,7 +25014,7 @@ tsubst_initializer_list (tree t, tree argvec) since we built them backwards. */ for (i = 0; i < len; i++) { - TREE_VEC_ELT (expanded_arguments, i) = + TREE_VEC_ELT (expanded_arguments, i) = nreverse (TREE_VEC_ELT (expanded_arguments, i)); } } @@ -25626,11 +25626,11 @@ value_dependent_expression_p (tree expression) { tree values = ARGUMENT_PACK_ARGS (expression); int i, len = TREE_VEC_LENGTH (values); - + for (i = 0; i < len; ++i) if (value_dependent_expression_p (TREE_VEC_ELT (values, i))) return true; - + return false; } @@ -26562,7 +26562,7 @@ resolve_typename_type (tree type, bool only_current_p) tf_warning_or_error); result = NULL_TREE; - + /* For a TYPENAME_TYPE like "typename X::template Y", we want to find a TEMPLATE_DECL. Otherwise, we want to find a TYPE_DECL. */ tree fullname = TYPENAME_TYPE_FULLNAME (type); @@ -26601,7 +26601,7 @@ resolve_typename_type (tree type, bool only_current_p) if (result == error_mark_node) result = NULL_TREE; } - + /* Leave the SCOPE. */ if (pushed_scope) pop_scope (pushed_scope); @@ -26609,7 +26609,7 @@ resolve_typename_type (tree type, bool only_current_p) /* If we failed to resolve it, return the original typename. */ if (!result) return type; - + /* If lookup found a typename type, resolve that too. */ if (TREE_CODE (result) == TYPENAME_TYPE && !TYPENAME_IS_RESOLVING_P (result)) { @@ -26619,7 +26619,7 @@ resolve_typename_type (tree type, bool only_current_p) result = resolve_typename_type (result, only_current_p); TYPENAME_IS_RESOLVING_P (result) = 0; } - + /* Qualify the resulting type. */ quals = cp_type_quals (type); if (quals) @@ -26826,7 +26826,7 @@ listify (tree arg) tree std_init_list = get_namespace_binding (std_node, init_list_identifier); if (!std_init_list || !DECL_CLASS_TEMPLATE_P (std_init_list)) - { + { gcc_rich_location richloc (input_location); maybe_add_include_fixit (&richloc, "", false); error_at (&richloc, diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 92c48753d42..4f71ac706e5 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -686,7 +686,7 @@ finish_expr_stmt (tree expr) expr = convert_to_void (expr, ICV_STATEMENT, tf_warning_or_error); } else if (!type_dependent_expression_p (expr)) - convert_to_void (build_non_dependent_expr (expr), ICV_STATEMENT, + convert_to_void (build_non_dependent_expr (expr), ICV_STATEMENT, tf_warning_or_error); if (check_for_bare_parameter_packs (expr)) @@ -906,7 +906,7 @@ finish_return_stmt (tree expr) { if (warn_sequence_point) verify_sequence_points (expr); - + if (DECL_DESTRUCTOR_P (current_function_decl) || (DECL_CONSTRUCTOR_P (current_function_decl) && targetm.cxx.cdtor_returns_this ())) @@ -1570,7 +1570,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands, { constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t))); bool constraint_parsed - = parse_input_constraint (&constraint, i, ninputs, noutputs, 0, + = parse_input_constraint (&constraint, i, ninputs, noutputs, 0, oconstraints, &allows_mem, &allows_reg); /* If the operand is going to end up in memory, don't call decay_conversion. */ @@ -2020,7 +2020,7 @@ check_accessibility_of_qualified_id (tree decl, its bases. */ qualifying_type = currently_open_derived_class (scope); - if (qualifying_type + if (qualifying_type /* It is possible for qualifying type to be a TEMPLATE_TYPE_PARM or similar in a default argument value. */ && CLASS_TYPE_P (qualifying_type) @@ -3004,7 +3004,7 @@ finish_template_template_parm (tree aggr, tree identifier) gcc_assert (DECL_TEMPLATE_PARMS (tmpl)); - check_default_tmpl_args (decl, DECL_TEMPLATE_PARMS (tmpl), + check_default_tmpl_args (decl, DECL_TEMPLATE_PARMS (tmpl), /*is_primary=*/true, /*is_partial=*/false, /*is_friend=*/0); @@ -3379,7 +3379,7 @@ baselink_for_fns (tree fns) tree scope; tree cl; - if (BASELINK_P (fns) + if (BASELINK_P (fns) || error_operand_p (fns)) return fns; @@ -3868,7 +3868,7 @@ finish_id_expression_1 (tree id_expression, if (DECL_P (decl) && DECL_NONLOCAL (decl) && DECL_CLASS_SCOPE_P (decl)) { - tree context = context_for_name_lookup (decl); + tree context = context_for_name_lookup (decl); if (context != current_class_type) { tree path = currently_open_derived_class (context); @@ -8032,7 +8032,7 @@ restore_omp_privatization_clauses (vec &save) save.release (); return; } - + omp_private_member_map = new hash_map ; while (!save.is_empty ()) { @@ -9046,7 +9046,7 @@ finish_omp_atomic (location_t loc, enum tree_code code, enum tree_code opcode, { if (opcode == NOP_EXPR) stmt = build2 (MODIFY_EXPR, void_type_node, orig_lhs, orig_rhs); - else + else stmt = build2 (opcode, void_type_node, orig_lhs, orig_rhs); if (orig_rhs1) stmt = build_min_nt_loc (EXPR_LOCATION (orig_rhs1), @@ -9317,8 +9317,8 @@ init_cp_semantics (void) CONDITION and the message text MESSAGE. LOCATION is the location of the static assertion in the source code. When MEMBER_P, this static assertion is a member of a class. */ -void -finish_static_assert (tree condition, tree message, location_t location, +void +finish_static_assert (tree condition, tree message, location_t location, bool member_p) { tsubst_flags_t complain = tf_warning_or_error; @@ -9344,7 +9344,7 @@ finish_static_assert (tree condition, tree message, location_t location, STATIC_ASSERT_SOURCE_LOCATION (assertion) = location; if (member_p) - maybe_add_class_template_decl_list (current_class_type, + maybe_add_class_template_decl_list (current_class_type, assertion, /*friend_p=*/0); else @@ -9362,12 +9362,12 @@ finish_static_assert (tree condition, tree message, location_t location, if (TREE_CODE (condition) == INTEGER_CST && !integer_zerop (condition)) /* Do nothing; the condition is satisfied. */ ; - else + else { location_t saved_loc = input_location; input_location = location; - if (TREE_CODE (condition) == INTEGER_CST + if (TREE_CODE (condition) == INTEGER_CST && integer_zerop (condition)) { int sz = TREE_INT_CST_LOW (TYPE_SIZE_UNIT @@ -9582,7 +9582,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p, return type; } -/* Called from trait_expr_value to evaluate either __has_nothrow_assign or +/* Called from trait_expr_value to evaluate either __has_nothrow_assign or __has_nothrow_copy, depending on assign_p. Returns true iff all the copy {ctor,assign} fns are nothrow. */ @@ -9643,7 +9643,7 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) case CPTK_HAS_NOTHROW_CONSTRUCTOR: type1 = strip_array_types (type1); - return (trait_expr_value (CPTK_HAS_TRIVIAL_CONSTRUCTOR, type1, type2) + return (trait_expr_value (CPTK_HAS_TRIVIAL_CONSTRUCTOR, type1, type2) || (CLASS_TYPE_P (type1) && (t = locate_ctor (type1)) && maybe_instantiate_noexcept (t)