+2015-04-16 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * call.c (build_op_delete_call, build_over_call): Check mark_used
+ return value.
+ * class.c (resolve_address_of_overloaded_function): Likewise.
+ * decl.c (cxx_maybe_build_cleanup): Likewise.
+ * pt.c (gen_elem_of_pack_expansion_instantiation, tsubst_baselink,
+ tsubst_qualified_id, tsubst_copy, tsubst_copy_and_build): Likewise.
+ * rtti.c (build_dynamic_cast_1): Likewise.
+ * semantics.c (process_outer_var_ref): Likewise.
+ * typeck.c (build_class_member_access_expr,
+ cp_build_function_call_vec, cp_build_addr_expr_1): Likewise.
+
2015-04-15 Jason Merrill <jason@redhat.com>
* constexpr.c (cxx_eval_store_expression): Ignore clobbers.
argarray[0] = addr;
for (i = 1; i < nargs; i++)
argarray[i] = CALL_EXPR_ARG (placement, i);
- mark_used (fn);
+ if (!mark_used (fn, complain) && !(complain & tf_error))
+ return error_mark_node;
return build_cxx_call (fn, nargs, argarray, complain);
}
else
the implementation elided its use. */
if (!trivial || DECL_DELETED_FN (fn))
{
- mark_used (fn);
+ if (!mark_used (fn, complain) && !(complain & tf_error))
+ return error_mark_node;
already_used = true;
}
/* Make =delete work with SFINAE. */
if (DECL_DELETED_FN (fn) && !(flags & tf_error))
return error_mark_node;
-
- mark_used (fn);
+ if (!mark_used (fn, flags) && !(flags & tf_error))
+ return error_mark_node;
}
/* We could not check access to member functions when this
ordinary FUNCTION_DECL. */
fn = lookup_name (id);
arg = build_address (decl);
- mark_used (decl);
+ if (!mark_used (decl, complain) && !(complain & tf_error))
+ return error_mark_node;
cleanup = cp_build_function_call_nary (fn, complain, arg, NULL_TREE);
if (cleanup == error_mark_node)
return error_mark_node;
SET_EXPR_LOCATION (cleanup, UNKNOWN_LOCATION);
if (cleanup
- && !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (TREE_TYPE (decl))))
- /* Treat objects with destructors as used; the destructor may do
- something substantive. */
- mark_used (decl);
+ && !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (TREE_TYPE (decl)))
+ /* Treat objects with destructors as used; the destructor may do
+ something substantive. */
+ && !mark_used (decl, complain) && !(complain & tf_error))
+ return error_mark_node;
return cleanup;
}
if (index == 0)
{
aps = make_argument_pack_select (arg_pack, index);
- mark_used (parm);
+ if (!mark_used (parm, complain) && !(complain & tf_error))
+ return error_mark_node;
register_local_specialization (aps, parm);
}
else
point.) */
if (BASELINK_P (baselink))
fns = BASELINK_FUNCTIONS (baselink);
- if (!template_id_p && !really_overloaded_fn (fns))
- mark_used (OVL_CURRENT (fns));
+ if (!template_id_p && !really_overloaded_fn (fns)
+ && !mark_used (OVL_CURRENT (fns), complain) && !(complain & tf_error))
+ return error_mark_node;
/* Add back the template arguments, if present. */
if (BASELINK_P (baselink) && template_id_p)
check_accessibility_of_qualified_id (expr, /*object_type=*/NULL_TREE,
scope);
/* Remember that there was a reference to this entity. */
- mark_used (expr);
+ if (!mark_used (expr, complain) && !(complain & tf_error))
+ return error_mark_node;
}
if (expr == error_mark_node || TREE_CODE (expr) == TREE_LIST)
if (TREE_CODE (r) == ARGUMENT_PACK_SELECT)
r = ARGUMENT_PACK_SELECT_ARG (r);
- mark_used (r);
+ if (!mark_used (r, complain) && !(complain & tf_error))
+ return error_mark_node;
return r;
case CONST_DECL:
}
else
r = t;
- mark_used (r);
+ if (!mark_used (r, complain) && !(complain & tf_error))
+ return error_mark_node;
return r;
case NAMESPACE_DECL:
tree op1 = tsubst_copy (TREE_OPERAND (t, 1), args, complain, in_decl);
r = build2 (code, type, op0, op1);
PTRMEM_OK_P (r) = PTRMEM_OK_P (t);
- mark_used (TREE_OPERAND (r, 1));
+ if (!mark_used (TREE_OPERAND (r, 1), complain)
+ && !(complain & tf_error))
+ return error_mark_node;
return r;
}
op1 = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0),
args, complain, in_decl);
/* Remember that there was a reference to this entity. */
- if (DECL_P (op1))
- mark_used (op1);
+ if (DECL_P (op1)
+ && !mark_used (op1, complain) && !(complain & tf_error))
+ RETURN (error_mark_node);
RETURN (build_x_arrow (input_location, op1, complain));
case NEW_EXPR:
}
/* Remember that there was a reference to this entity. */
- if (DECL_P (function))
- mark_used (function, complain);
+ if (DECL_P (function)
+ && !mark_used (function, complain) && !(complain & tf_error))
+ RETURN (error_mark_node);
/* Put back tf_decltype for the actual call. */
complain |= decltype_flag;
object = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0),
args, complain, in_decl);
/* Remember that there was a reference to this entity. */
- if (DECL_P (object))
- mark_used (object);
+ if (DECL_P (object)
+ && !mark_used (object, complain) && !(complain & tf_error))
+ RETURN (error_mark_node);
object_type = TREE_TYPE (object);
member = TREE_OPERAND (t, 1);
target_type = TYPE_MAIN_VARIANT (TREE_TYPE (type));
static_type = TYPE_MAIN_VARIANT (TREE_TYPE (exprtype));
td2 = get_tinfo_decl (target_type);
- mark_used (td2);
+ if (!mark_used (td2, complain) && !(complain & tf_error))
+ return error_mark_node;
td2 = cp_build_addr_expr (td2, complain);
td3 = get_tinfo_decl (static_type);
- mark_used (td3);
+ if (!mark_used (td3, complain) && !(complain & tf_error))
+ return error_mark_node;
td3 = cp_build_addr_expr (td3, complain);
/* Determine how T and V are related. */
tree initializer = convert_from_reference (decl);
/* Mark it as used now even if the use is ill-formed. */
- mark_used (decl);
+ if (!mark_used (decl, complain) && !(complain & tf_error))
+ return error_mark_node;
/* Core issue 696: "[At the July 2009 meeting] the CWG expressed
support for an approach in which a reference to a local
if (DECL_P (member))
{
member_scope = DECL_CLASS_CONTEXT (member);
- mark_used (member);
+ if (!mark_used (member, complain) && !(complain & tf_error))
+ return error_mark_node;
if (TREE_DEPRECATED (member))
warn_deprecated_use (member, NULL_TREE);
}
if (TREE_CODE (function) == FUNCTION_DECL)
{
- mark_used (function);
+ if (!mark_used (function, complain) && !(complain & tf_error))
+ return error_mark_node;
fndecl = function;
/* Convert anything with function type to a pointer-to-function. */
and the created OFFSET_REF. */
tree base = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg, 0)));
tree fn = get_first_fn (TREE_OPERAND (arg, 1));
- mark_used (fn);
+ if (!mark_used (fn, complain) && !(complain & tf_error))
+ return error_mark_node;
if (! flag_ms_extensions)
{
function. */
gcc_assert (TREE_CODE (fn) == FUNCTION_DECL
&& DECL_STATIC_FUNCTION_P (fn));
- mark_used (fn);
+ if (!mark_used (fn, complain) && !(complain & tf_error))
+ return error_mark_node;
val = build_address (fn);
if (TREE_SIDE_EFFECTS (TREE_OPERAND (arg, 0)))
/* Do not lose object's side effects. */