From: Nathan Sidwell Date: Thu, 29 Jun 2017 14:13:11 +0000 (+0000) Subject: Whitespace cleanups. X-Git-Tag: basepoints/gcc-9~6278 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e98889226cc487b39334ae069422c0ac4615f9ec;p=thirdparty%2Fgcc.git Whitespace cleanups. * call.c (name_as_c_string): Move CONST_CAST to return. (build_new_method_call_1): Remove unneeded bracing. * class.c (include_empty_classes): Unbreak line. * constraint.cc (tsubst_check_constraint): Add space. * cp-tree.h (lang_decl_ns): Add comment. (PTRMEM_CST_MEMBER): Break line. * decl.c (grokfndecl): Add blank lines. Unbreak some others. (grokdeclarator): Remove lines, move declaration to first use. * decl2.c (decl_needed_p): Fix indentation. (c_parse_final_cleanups): Remove blank line. * method.c (implicitly_declare_fn): Move declaration to first use. * search.c (current_scope): Add blank lines. From-SVN: r249786 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4b05c7efbaca..c29dd163f4f9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,19 @@ +2017-06-29 Nathan Sidwell + + Whitespace cleanups. + * call.c (name_as_c_string): Move CONST_CAST to return. + (build_new_method_call_1): Remove unneeded bracing. + * class.c (include_empty_classes): Unbreak line. + * constraint.cc (tsubst_check_constraint): Add space. + * cp-tree.h (lang_decl_ns): Add comment. + (PTRMEM_CST_MEMBER): Break line. + * decl.c (grokfndecl): Add blank lines. Unbreak some others. + (grokdeclarator): Remove lines, move declaration to first use. + * decl2.c (decl_needed_p): Fix indentation. + (c_parse_final_cleanups): Remove blank line. + * method.c (implicitly_declare_fn): Move declaration to first use. + * search.c (current_scope): Add blank lines. + 2017-06-28 Jason Merrill PR c++/72764 - ICE with invalid template typename. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index ff0a26b93350..b83ffa8213d8 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -8878,7 +8878,7 @@ build_special_member_call (tree instance, tree name, vec **args, static char * name_as_c_string (tree name, tree type, bool *free_p) { - char *pretty_name; + const char *pretty_name; /* Assume that we will not allocate memory. */ *free_p = false; @@ -8886,7 +8886,7 @@ name_as_c_string (tree name, tree type, bool *free_p) if (IDENTIFIER_CDTOR_P (name)) { pretty_name - = CONST_CAST (char *, identifier_to_locale (IDENTIFIER_POINTER (constructor_name (type)))); + = identifier_to_locale (IDENTIFIER_POINTER (constructor_name (type))); /* For a destructor, add the '~'. */ if (IDENTIFIER_DTOR_P (name)) { @@ -8905,9 +8905,9 @@ name_as_c_string (tree name, tree type, bool *free_p) *free_p = true; } else - pretty_name = CONST_CAST (char *, identifier_to_locale (IDENTIFIER_POINTER (name))); + pretty_name = identifier_to_locale (IDENTIFIER_POINTER (name)); - return pretty_name; + return CONST_CAST (char *, pretty_name); } /* Build a call to "INSTANCE.FN (ARGS)". If FN_P is non-NULL, it will @@ -9118,11 +9118,10 @@ build_new_method_call_1 (tree instance, tree fns, vec **args, &candidates, complain); } else - { - add_candidates (fns, first_mem_arg, user_args, optype, - explicit_targs, template_only, conversion_path, - access_binfo, flags, &candidates, complain); - } + add_candidates (fns, first_mem_arg, user_args, optype, + explicit_targs, template_only, conversion_path, + access_binfo, flags, &candidates, complain); + any_viable_p = false; candidates = splice_viable (candidates, false, &any_viable_p); diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 833eb94b4667..78cb5c2e81d1 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6295,8 +6295,7 @@ include_empty_classes (record_layout_info rli) because we are willing to overlay multiple bases at the same offset. However, now we need to make sure that RLI is big enough to reflect the entire class. */ - eoc = end_of_class (rli->t, - CLASSTYPE_AS_BASE (rli->t) != NULL_TREE); + eoc = end_of_class (rli->t, CLASSTYPE_AS_BASE (rli->t) != NULL_TREE); rli_size = rli_size_unit_so_far (rli); if (TREE_CODE (rli_size) == INTEGER_CST && tree_int_cst_lt (rli_size, eoc)) diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 6fd4bde22e57..64a8ea926d2a 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -1580,7 +1580,7 @@ tsubst_check_constraint (tree t, tree args, /* Substitute through by building an template-id expression and then substituting into that. */ - tree expr = build_nt(TEMPLATE_ID_EXPR, tmpl, targs); + tree expr = build_nt (TEMPLATE_ID_EXPR, tmpl, targs); ++processing_template_decl; tree result = tsubst_expr (expr, args, complain, in_decl, false); --processing_template_decl; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 946a91679924..6b175a314660 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2556,7 +2556,9 @@ struct GTY(()) lang_decl_ns { vec *usings; vec *inlinees; - /* Map from IDENTIFIER nodes to DECLS. */ + /* Map from IDENTIFIER nodes to DECLS. It'd be nice to have this + inline, but as the hash_map has a dtor, we can't then put this + struct into a union (until moving to c++11). */ hash_map *bindings; }; @@ -4312,7 +4314,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* For a pointer-to-member constant `X::Y' this is the _DECL for `Y'. */ -#define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member) +#define PTRMEM_CST_MEMBER(NODE) \ + (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member) /* The expression in question for a TYPEOF_TYPE. */ #define TYPEOF_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (TYPEOF_TYPE_CHECK (NODE))) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3d96a3ea0fd8..38c0348bc895 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8502,9 +8502,11 @@ grokfndecl (tree ctype, /* Allocate space to hold the vptr bit if needed. */ SET_DECL_ALIGN (decl, MINIMUM_METHOD_BOUNDARY); } + DECL_ARGUMENTS (decl) = parms; for (t = parms; t; t = DECL_CHAIN (t)) DECL_CONTEXT (t) = decl; + /* Propagate volatile out from type to decl. */ if (TYPE_VOLATILE (type)) TREE_THIS_VOLATILE (decl) = 1; @@ -8524,13 +8526,11 @@ grokfndecl (tree ctype, break; } - if (friendp - && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR) + if (friendp && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR) { if (funcdef_flag) - error - ("defining explicit specialization %qD in friend declaration", - orig_declarator); + error ("defining explicit specialization %qD in friend declaration", + orig_declarator); else { tree fns = TREE_OPERAND (orig_declarator, 0); @@ -9132,7 +9132,6 @@ build_ptrmemfunc_type (tree type) this method instead of type_hash_canon, because it only does a simple equality check on the list of field members. */ - t = TYPE_PTRMEMFUNC_TYPE (type); if (t) return t; @@ -10068,8 +10067,6 @@ grokdeclarator (const cp_declarator *declarator, { case BIT_NOT_EXPR: { - tree type; - if (innermost_code != cdk_function) { error ("declaration of %qD as non-function", decl); @@ -10082,7 +10079,7 @@ grokdeclarator (const cp_declarator *declarator, return error_mark_node; } - type = TREE_OPERAND (decl, 0); + tree type = TREE_OPERAND (decl, 0); if (TYPE_P (type)) type = constructor_name (type); name = identifier_to_locale (IDENTIFIER_POINTER (type)); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a4751460e065..08f122d4e91e 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1992,12 +1992,14 @@ decl_needed_p (tree decl) /* If this entity was used, let the back end see it; it will decide whether or not to emit it into the object file. */ if (TREE_USED (decl)) - return true; + return true; + /* Virtual functions might be needed for devirtualization. */ if (flag_devirtualize && TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl)) return true; + /* Otherwise, DECL does not need to be emitted -- yet. A subsequent reference to DECL might cause it to be emitted later. */ return false; @@ -4803,7 +4805,6 @@ c_parse_final_cleanups (void) perform_deferred_noexcept_checks (); finish_repo (); - fini_constexpr (); /* The entire file is now complete. If requested, dump everything diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 4cb52f23b332..ba65284a066f 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1982,7 +1982,6 @@ implicitly_declare_fn (special_function_kind kind, tree type, case sfk_move_assignment: case sfk_inheriting_constructor: { - bool move_p; if (kind == sfk_copy_assignment || kind == sfk_move_assignment) { @@ -2000,8 +1999,8 @@ implicitly_declare_fn (special_function_kind kind, tree type, rhs_parm_type = cp_build_qualified_type (type, TYPE_QUAL_CONST); else rhs_parm_type = type; - move_p = (kind == sfk_move_assignment - || kind == sfk_move_constructor); + bool move_p = (kind == sfk_move_assignment + || kind == sfk_move_constructor); rhs_parm_type = cp_build_reference_type (rhs_parm_type, move_p); parameter_types = tree_cons (NULL_TREE, rhs_parm_type, parameter_types); diff --git a/gcc/cp/search.c b/gcc/cp/search.c index d7895a05593b..af7a0f169a15 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -507,10 +507,13 @@ current_scope (void) && same_type_p (DECL_FRIEND_CONTEXT (current_function_decl), current_class_type)))) return current_function_decl; + if (current_class_type) return current_class_type; + if (current_function_decl) return current_function_decl; + return current_namespace; }