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
This commit is contained in:
Nathan Sidwell 2017-06-29 14:13:11 +00:00 committed by Nathan Sidwell
parent 0630a4ecda
commit e98889226c
9 changed files with 45 additions and 28 deletions

View File

@ -1,3 +1,19 @@
2017-06-29 Nathan Sidwell <nathan@acm.org>
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 <jason@redhat.com>
PR c++/72764 - ICE with invalid template typename.

View File

@ -8878,7 +8878,7 @@ build_special_member_call (tree instance, tree name, vec<tree, va_gc> **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<tree, va_gc> **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);

View File

@ -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))

View File

@ -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;

View File

@ -2556,7 +2556,9 @@ struct GTY(()) lang_decl_ns {
vec<tree, va_gc> *usings;
vec<tree, va_gc> *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<lang_identifier *, tree> *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)))

View File

@ -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));

View File

@ -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

View File

@ -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);

View File

@ -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;
}