Commit e9888922 by Nathan Sidwell Committed by 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.

From-SVN: r249786
parent 0630a4ec
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> 2017-06-28 Jason Merrill <jason@redhat.com>
PR c++/72764 - ICE with invalid template typename. PR c++/72764 - ICE with invalid template typename.
......
...@@ -8878,7 +8878,7 @@ build_special_member_call (tree instance, tree name, vec<tree, va_gc> **args, ...@@ -8878,7 +8878,7 @@ build_special_member_call (tree instance, tree name, vec<tree, va_gc> **args,
static char * static char *
name_as_c_string (tree name, tree type, bool *free_p) 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. */ /* Assume that we will not allocate memory. */
*free_p = false; *free_p = false;
...@@ -8886,7 +8886,7 @@ name_as_c_string (tree name, tree type, bool *free_p) ...@@ -8886,7 +8886,7 @@ name_as_c_string (tree name, tree type, bool *free_p)
if (IDENTIFIER_CDTOR_P (name)) if (IDENTIFIER_CDTOR_P (name))
{ {
pretty_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 '~'. */ /* For a destructor, add the '~'. */
if (IDENTIFIER_DTOR_P (name)) if (IDENTIFIER_DTOR_P (name))
{ {
...@@ -8905,9 +8905,9 @@ name_as_c_string (tree name, tree type, bool *free_p) ...@@ -8905,9 +8905,9 @@ name_as_c_string (tree name, tree type, bool *free_p)
*free_p = true; *free_p = true;
} }
else 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 /* 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, ...@@ -9118,11 +9118,10 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args,
&candidates, complain); &candidates, complain);
} }
else else
{
add_candidates (fns, first_mem_arg, user_args, optype, add_candidates (fns, first_mem_arg, user_args, optype,
explicit_targs, template_only, conversion_path, explicit_targs, template_only, conversion_path,
access_binfo, flags, &candidates, complain); access_binfo, flags, &candidates, complain);
}
any_viable_p = false; any_viable_p = false;
candidates = splice_viable (candidates, false, &any_viable_p); candidates = splice_viable (candidates, false, &any_viable_p);
......
...@@ -6295,8 +6295,7 @@ include_empty_classes (record_layout_info rli) ...@@ -6295,8 +6295,7 @@ include_empty_classes (record_layout_info rli)
because we are willing to overlay multiple bases at the same because we are willing to overlay multiple bases at the same
offset. However, now we need to make sure that RLI is big enough offset. However, now we need to make sure that RLI is big enough
to reflect the entire class. */ to reflect the entire class. */
eoc = end_of_class (rli->t, eoc = end_of_class (rli->t, CLASSTYPE_AS_BASE (rli->t) != NULL_TREE);
CLASSTYPE_AS_BASE (rli->t) != NULL_TREE);
rli_size = rli_size_unit_so_far (rli); rli_size = rli_size_unit_so_far (rli);
if (TREE_CODE (rli_size) == INTEGER_CST if (TREE_CODE (rli_size) == INTEGER_CST
&& tree_int_cst_lt (rli_size, eoc)) && tree_int_cst_lt (rli_size, eoc))
......
...@@ -1580,7 +1580,7 @@ tsubst_check_constraint (tree t, tree args, ...@@ -1580,7 +1580,7 @@ tsubst_check_constraint (tree t, tree args,
/* Substitute through by building an template-id expression /* Substitute through by building an template-id expression
and then substituting into that. */ 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; ++processing_template_decl;
tree result = tsubst_expr (expr, args, complain, in_decl, false); tree result = tsubst_expr (expr, args, complain, in_decl, false);
--processing_template_decl; --processing_template_decl;
......
...@@ -2556,7 +2556,9 @@ struct GTY(()) lang_decl_ns { ...@@ -2556,7 +2556,9 @@ struct GTY(()) lang_decl_ns {
vec<tree, va_gc> *usings; vec<tree, va_gc> *usings;
vec<tree, va_gc> *inlinees; 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; hash_map<lang_identifier *, tree> *bindings;
}; };
...@@ -4312,7 +4314,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) ...@@ -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 /* For a pointer-to-member constant `X::Y' this is the _DECL for
`Y'. */ `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. */ /* The expression in question for a TYPEOF_TYPE. */
#define TYPEOF_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (TYPEOF_TYPE_CHECK (NODE))) #define TYPEOF_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (TYPEOF_TYPE_CHECK (NODE)))
......
...@@ -8502,9 +8502,11 @@ grokfndecl (tree ctype, ...@@ -8502,9 +8502,11 @@ grokfndecl (tree ctype,
/* Allocate space to hold the vptr bit if needed. */ /* Allocate space to hold the vptr bit if needed. */
SET_DECL_ALIGN (decl, MINIMUM_METHOD_BOUNDARY); SET_DECL_ALIGN (decl, MINIMUM_METHOD_BOUNDARY);
} }
DECL_ARGUMENTS (decl) = parms; DECL_ARGUMENTS (decl) = parms;
for (t = parms; t; t = DECL_CHAIN (t)) for (t = parms; t; t = DECL_CHAIN (t))
DECL_CONTEXT (t) = decl; DECL_CONTEXT (t) = decl;
/* Propagate volatile out from type to decl. */ /* Propagate volatile out from type to decl. */
if (TYPE_VOLATILE (type)) if (TYPE_VOLATILE (type))
TREE_THIS_VOLATILE (decl) = 1; TREE_THIS_VOLATILE (decl) = 1;
...@@ -8524,12 +8526,10 @@ grokfndecl (tree ctype, ...@@ -8524,12 +8526,10 @@ grokfndecl (tree ctype,
break; break;
} }
if (friendp if (friendp && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR)
&& TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR)
{ {
if (funcdef_flag) if (funcdef_flag)
error error ("defining explicit specialization %qD in friend declaration",
("defining explicit specialization %qD in friend declaration",
orig_declarator); orig_declarator);
else else
{ {
...@@ -9132,7 +9132,6 @@ build_ptrmemfunc_type (tree type) ...@@ -9132,7 +9132,6 @@ build_ptrmemfunc_type (tree type)
this method instead of type_hash_canon, because it only does a this method instead of type_hash_canon, because it only does a
simple equality check on the list of field members. */ simple equality check on the list of field members. */
t = TYPE_PTRMEMFUNC_TYPE (type); t = TYPE_PTRMEMFUNC_TYPE (type);
if (t) if (t)
return t; return t;
...@@ -10068,8 +10067,6 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -10068,8 +10067,6 @@ grokdeclarator (const cp_declarator *declarator,
{ {
case BIT_NOT_EXPR: case BIT_NOT_EXPR:
{ {
tree type;
if (innermost_code != cdk_function) if (innermost_code != cdk_function)
{ {
error ("declaration of %qD as non-function", decl); error ("declaration of %qD as non-function", decl);
...@@ -10082,7 +10079,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -10082,7 +10079,7 @@ grokdeclarator (const cp_declarator *declarator,
return error_mark_node; return error_mark_node;
} }
type = TREE_OPERAND (decl, 0); tree type = TREE_OPERAND (decl, 0);
if (TYPE_P (type)) if (TYPE_P (type))
type = constructor_name (type); type = constructor_name (type);
name = identifier_to_locale (IDENTIFIER_POINTER (type)); name = identifier_to_locale (IDENTIFIER_POINTER (type));
......
...@@ -1993,11 +1993,13 @@ decl_needed_p (tree decl) ...@@ -1993,11 +1993,13 @@ decl_needed_p (tree decl)
whether or not to emit it into the object file. */ whether or not to emit it into the object file. */
if (TREE_USED (decl)) if (TREE_USED (decl))
return true; return true;
/* Virtual functions might be needed for devirtualization. */ /* Virtual functions might be needed for devirtualization. */
if (flag_devirtualize if (flag_devirtualize
&& TREE_CODE (decl) == FUNCTION_DECL && TREE_CODE (decl) == FUNCTION_DECL
&& DECL_VIRTUAL_P (decl)) && DECL_VIRTUAL_P (decl))
return true; return true;
/* Otherwise, DECL does not need to be emitted -- yet. A subsequent /* Otherwise, DECL does not need to be emitted -- yet. A subsequent
reference to DECL might cause it to be emitted later. */ reference to DECL might cause it to be emitted later. */
return false; return false;
...@@ -4803,7 +4805,6 @@ c_parse_final_cleanups (void) ...@@ -4803,7 +4805,6 @@ c_parse_final_cleanups (void)
perform_deferred_noexcept_checks (); perform_deferred_noexcept_checks ();
finish_repo (); finish_repo ();
fini_constexpr (); fini_constexpr ();
/* The entire file is now complete. If requested, dump everything /* The entire file is now complete. If requested, dump everything
......
...@@ -1982,7 +1982,6 @@ implicitly_declare_fn (special_function_kind kind, tree type, ...@@ -1982,7 +1982,6 @@ implicitly_declare_fn (special_function_kind kind, tree type,
case sfk_move_assignment: case sfk_move_assignment:
case sfk_inheriting_constructor: case sfk_inheriting_constructor:
{ {
bool move_p;
if (kind == sfk_copy_assignment if (kind == sfk_copy_assignment
|| kind == sfk_move_assignment) || kind == sfk_move_assignment)
{ {
...@@ -2000,7 +1999,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, ...@@ -2000,7 +1999,7 @@ implicitly_declare_fn (special_function_kind kind, tree type,
rhs_parm_type = cp_build_qualified_type (type, TYPE_QUAL_CONST); rhs_parm_type = cp_build_qualified_type (type, TYPE_QUAL_CONST);
else else
rhs_parm_type = type; rhs_parm_type = type;
move_p = (kind == sfk_move_assignment bool move_p = (kind == sfk_move_assignment
|| kind == sfk_move_constructor); || kind == sfk_move_constructor);
rhs_parm_type = cp_build_reference_type (rhs_parm_type, move_p); rhs_parm_type = cp_build_reference_type (rhs_parm_type, move_p);
......
...@@ -507,10 +507,13 @@ current_scope (void) ...@@ -507,10 +507,13 @@ current_scope (void)
&& same_type_p (DECL_FRIEND_CONTEXT (current_function_decl), && same_type_p (DECL_FRIEND_CONTEXT (current_function_decl),
current_class_type)))) current_class_type))))
return current_function_decl; return current_function_decl;
if (current_class_type) if (current_class_type)
return current_class_type; return current_class_type;
if (current_function_decl) if (current_function_decl)
return current_function_decl; return current_function_decl;
return current_namespace; return current_namespace;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment