* 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
+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.
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;
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))
{
*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
&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);
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))
/* 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;
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;
};
/* 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)))
/* 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;
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);
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;
{
case BIT_NOT_EXPR:
{
- tree type;
-
if (innermost_code != cdk_function)
{
error ("declaration of %qD as non-function", decl);
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));
/* 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;
perform_deferred_noexcept_checks ();
finish_repo ();
-
fini_constexpr ();
/* The entire file is now complete. If requested, dump everything
case sfk_move_assignment:
case sfk_inheriting_constructor:
{
- bool move_p;
if (kind == sfk_copy_assignment
|| kind == sfk_move_assignment)
{
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);
&& 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;
}