+2019-07-25 Martin Liska <mliska@suse.cz>
+
+ * calls.c (maybe_warn_alloc_args_overflow): Use new macros
+ (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
+ * coverage.c (coverage_begin_function): Likewise.
+ * fold-const.c (tree_expr_nonzero_warnv_p): Likewise.
+ * gimple.c (gimple_call_nonnull_result_p): Likewise.
+ * ipa-icf.c (sem_item::compare_referenced_symbol_properties): Likewise.
+ (sem_item::hash_referenced_symbol_properties): Likewise.
+ * lto-streamer-out.c (hash_tree): Likewise.
+ * predict.c (expr_expected_value_1): Likewise.
+ * tree-inline.c (expand_call_inline): Likewise.
+ * tree-streamer-in.c (unpack_ts_function_decl_value_fields): Likewise.
+ * tree-streamer-out.c (pack_ts_function_decl_value_fields): Likewise.
+ * tree-core.h (enum function_decl_type): New enum.
+ (struct tree_function_decl): Remove operator_new_flag and lambda_function.
+ * tree.h (FUNCTION_DECL_DECL_TYPE): New.
+ (set_function_decl_type): Likewise.
+ (DECL_IS_OPERATOR_NEW_P): New.
+ (DECL_SET_IS_OPERATOR_NEW): Likewise.
+ (DECL_LAMBDA_FUNCTION): Likewise.
+ (DECL_LAMBDA_FUNCTION_P): Likewise.
+ (DECL_IS_OPERATOR_NEW): Remove.
+ (DECL_SET_LAMBDA_FUNCTION): Likewise.
+
2019-07-25 Xiong Hu Luo <luoxhu@linux.ibm.com>
* ipa-profile.c (get_most_common_single_value): Use
+2019-07-25 Martin Liska <mliska@suse.cz>
+
+ * c-decl.c (merge_decls): Use new macros
+ (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
+
2019-07-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/83518
|= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
TREE_THIS_VOLATILE (newdecl) |= TREE_THIS_VOLATILE (olddecl);
DECL_IS_MALLOC (newdecl) |= DECL_IS_MALLOC (olddecl);
- DECL_IS_OPERATOR_NEW (newdecl) |= DECL_IS_OPERATOR_NEW (olddecl);
+ if (DECL_IS_OPERATOR_NEW_P (olddecl))
+ DECL_SET_IS_OPERATOR_NEW (newdecl, true);
TREE_READONLY (newdecl) |= TREE_READONLY (olddecl);
DECL_PURE_P (newdecl) |= DECL_PURE_P (olddecl);
DECL_IS_NOVOPS (newdecl) |= DECL_IS_NOVOPS (olddecl);
&& fn
&& !args[1]
&& lang_GNU_CXX ()
- && DECL_IS_OPERATOR_NEW (fn)
+ && DECL_IS_OPERATOR_NEW_P (fn)
&& integer_all_onesp (args[i]))
continue;
(DECL_ASSEMBLER_NAME (current_function_decl)));
gcov_write_unsigned (DECL_ARTIFICIAL (current_function_decl)
&& !DECL_FUNCTION_VERSIONED (current_function_decl)
- && !DECL_LAMBDA_FUNCTION (current_function_decl));
+ && !DECL_LAMBDA_FUNCTION_P (current_function_decl));
gcov_write_filename (xloc.file);
gcov_write_unsigned (xloc.line);
gcov_write_unsigned (xloc.column);
+2019-07-25 Martin Liska <mliska@suse.cz>
+
+ * decl.c (duplicate_decls): Use new macros
+ (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
+ (cxx_init_decl_processing): Likewise.
+ (grok_op_properties): Likewise.
+ * parser.c (cp_parser_lambda_declarator_opt): Likewise.
+
2019-07-24 Martin Sebor <msebor@redhat.com>
PR driver/80545
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
|= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
DECL_NO_LIMIT_STACK (newdecl) |= DECL_NO_LIMIT_STACK (olddecl);
- DECL_IS_OPERATOR_NEW (newdecl) |= DECL_IS_OPERATOR_NEW (olddecl);
+ if (DECL_IS_OPERATOR_NEW_P (olddecl))
+ DECL_SET_IS_OPERATOR_NEW (newdecl, true);
DECL_LOOPING_CONST_OR_PURE_P (newdecl)
|= DECL_LOOPING_CONST_OR_PURE_P (olddecl);
deltype = build_exception_variant (deltype, empty_except_spec);
tree opnew = push_cp_library_fn (NEW_EXPR, newtype, 0);
DECL_IS_MALLOC (opnew) = 1;
- DECL_IS_OPERATOR_NEW (opnew) = 1;
+ DECL_SET_IS_OPERATOR_NEW (opnew, true);
opnew = push_cp_library_fn (VEC_NEW_EXPR, newtype, 0);
DECL_IS_MALLOC (opnew) = 1;
- DECL_IS_OPERATOR_NEW (opnew) = 1;
+ DECL_SET_IS_OPERATOR_NEW (opnew, true);
push_cp_library_fn (DELETE_EXPR, deltype, ECF_NOTHROW);
push_cp_library_fn (VEC_DELETE_EXPR, deltype, ECF_NOTHROW);
if (flag_sized_deallocation)
newtype = build_exception_variant (newtype, new_eh_spec);
opnew = push_cp_library_fn (NEW_EXPR, newtype, 0);
DECL_IS_MALLOC (opnew) = 1;
- DECL_IS_OPERATOR_NEW (opnew) = 1;
+ DECL_SET_IS_OPERATOR_NEW (opnew, true);
opnew = push_cp_library_fn (VEC_NEW_EXPR, newtype, 0);
DECL_IS_MALLOC (opnew) = 1;
- DECL_IS_OPERATOR_NEW (opnew) = 1;
+ DECL_SET_IS_OPERATOR_NEW (opnew, true);
/* operator delete (void *, align_val_t); */
deltype = build_function_type_list (void_type_node, ptr_type_node,
coerce_delete_type (decl, loc);
else
{
- DECL_IS_OPERATOR_NEW (decl) = 1;
+ DECL_SET_IS_OPERATOR_NEW (decl, true);
TREE_TYPE (decl) = coerce_new_type (TREE_TYPE (decl), loc);
}
DECL_ARTIFICIAL (fco) = 1;
/* Give the object parameter a different name. */
DECL_NAME (DECL_ARGUMENTS (fco)) = closure_identifier;
- DECL_LAMBDA_FUNCTION (fco) = 1;
+ DECL_SET_LAMBDA_FUNCTION (fco, true);
}
if (template_param_list)
{
tree fndecl = get_callee_fndecl (t);
if (!fndecl) return false;
if (flag_delete_null_pointer_checks && !flag_check_new
- && DECL_IS_OPERATOR_NEW (fndecl)
+ && DECL_IS_OPERATOR_NEW_P (fndecl)
&& !TREE_NOTHROW (fndecl))
return true;
if (flag_delete_null_pointer_checks
if (!fndecl)
return false;
if (flag_delete_null_pointer_checks && !flag_check_new
- && DECL_IS_OPERATOR_NEW (fndecl)
+ && DECL_IS_OPERATOR_NEW_P (fndecl)
&& !TREE_NOTHROW (fndecl))
return true;
return return_false_with_msg ("inline attributes are different");
}
- if (DECL_IS_OPERATOR_NEW (n1->decl)
- != DECL_IS_OPERATOR_NEW (n2->decl))
+ if (DECL_IS_OPERATOR_NEW_P (n1->decl)
+ != DECL_IS_OPERATOR_NEW_P (n2->decl))
return return_false_with_msg ("operator new flags are different");
}
hstate.add_flag (DECL_DISREGARD_INLINE_LIMITS (ref->decl));
hstate.add_flag (DECL_DECLARED_INLINE_P (ref->decl));
}
- hstate.add_flag (DECL_IS_OPERATOR_NEW (ref->decl));
+ hstate.add_flag (DECL_IS_OPERATOR_NEW_P (ref->decl));
}
else if (is_a <varpool_node *> (ref))
{
hstate.add_int (DECL_BUILT_IN_CLASS (t));
hstate.add_flag (DECL_STATIC_CONSTRUCTOR (t));
hstate.add_flag (DECL_STATIC_DESTRUCTOR (t));
+ hstate.add_flag (FUNCTION_DECL_DECL_TYPE (t));
hstate.add_flag (DECL_UNINLINABLE (t));
hstate.add_flag (DECL_POSSIBLY_INLINED (t));
hstate.add_flag (DECL_IS_NOVOPS (t));
hstate.add_flag (DECL_IS_RETURNS_TWICE (t));
hstate.add_flag (DECL_IS_MALLOC (t));
- hstate.add_flag (DECL_IS_OPERATOR_NEW (t));
hstate.add_flag (DECL_DECLARED_INLINE_P (t));
hstate.add_flag (DECL_STATIC_CHAIN (t));
hstate.add_flag (DECL_NO_INLINE_WARNING_P (t));
+2019-07-25 Martin Liska <mliska@suse.cz>
+
+ * lto-common.c (compare_tree_sccs_1): Use new macros
+ (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
+
2019-07-22 Giuliano Belinassi <giuliano.belinassi@usp.br>
* lang.opt (flag_dump_callgraph): New flag.
compare_values (DECL_IS_NOVOPS);
compare_values (DECL_IS_RETURNS_TWICE);
compare_values (DECL_IS_MALLOC);
- compare_values (DECL_IS_OPERATOR_NEW);
+ compare_values (DECL_IS_OPERATOR_NEW_P);
compare_values (DECL_DECLARED_INLINE_P);
compare_values (DECL_STATIC_CHAIN);
compare_values (DECL_NO_INLINE_WARNING_P);
return NULL;
}
- if (DECL_IS_MALLOC (decl) || DECL_IS_OPERATOR_NEW (decl))
+ if (DECL_IS_MALLOC (decl) || DECL_IS_OPERATOR_NEW_P (decl))
{
if (predictor)
*predictor = PRED_MALLOC_NONNULL;
tree result;
};
+/* Classify a special function declaration type. */
+
+enum function_decl_type
+{
+ NONE,
+ OPERATOR_NEW,
+ LAMBDA_FUNCTION
+
+ /* 0 values left */
+};
+
/* FUNCTION_DECL inherits from DECL_NON_COMMON because of the use of the
arguments/result/saved_tree fields by front ends. It was either inherit
FUNCTION_DECL from non_common, or inherit non_common from FUNCTION_DECL,
unsigned novops_flag : 1;
unsigned returns_twice_flag : 1;
unsigned malloc_flag : 1;
- unsigned operator_new_flag : 1;
unsigned declared_inline_flag : 1;
unsigned no_inline_warning_flag : 1;
unsigned no_instrument_function_entry_exit : 1;
+
+ /* Align the bitfield to boundary of a byte. */
+ ENUM_BITFIELD(function_decl_type) decl_type: 2;
+
unsigned no_limit_stack : 1;
unsigned disregard_inline_limits : 1;
unsigned pure_flag : 1;
unsigned looping_const_or_pure_flag : 1;
unsigned has_debug_args_flag : 1;
unsigned versioned_function : 1;
- unsigned lambda_function: 1;
- /* No bits left. */
+
+ /* 0 bits left. */
};
struct GTY(()) tree_translation_unit_decl {
we may get confused if the compiler sees that the inlined new
function returns a pointer which was just deleted. See bug
33407. */
- if (DECL_IS_OPERATOR_NEW (fn))
+ if (DECL_IS_OPERATOR_NEW_P (fn))
{
return_slot = NULL;
modify_dest = NULL;
DECL_IS_NOVOPS (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_IS_RETURNS_TWICE (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_IS_MALLOC (expr) = (unsigned) bp_unpack_value (bp, 1);
- DECL_IS_OPERATOR_NEW (expr) = (unsigned) bp_unpack_value (bp, 1);
+ DECL_SET_IS_OPERATOR_NEW (expr, (unsigned) bp_unpack_value (bp, 1));
DECL_DECLARED_INLINE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_STATIC_CHAIN (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_NO_INLINE_WARNING_P (expr) = (unsigned) bp_unpack_value (bp, 1);
bp_pack_value (bp, DECL_IS_NOVOPS (expr), 1);
bp_pack_value (bp, DECL_IS_RETURNS_TWICE (expr), 1);
bp_pack_value (bp, DECL_IS_MALLOC (expr), 1);
- bp_pack_value (bp, DECL_IS_OPERATOR_NEW (expr), 1);
+ bp_pack_value (bp, DECL_IS_OPERATOR_NEW_P (expr), 1);
bp_pack_value (bp, DECL_DECLARED_INLINE_P (expr), 1);
bp_pack_value (bp, DECL_STATIC_CHAIN (expr), 1);
bp_pack_value (bp, DECL_NO_INLINE_WARNING_P (expr), 1);
#define DECL_IS_MALLOC(NODE) \
(FUNCTION_DECL_CHECK (NODE)->function_decl.malloc_flag)
+/* Macro for direct set and get of function_decl.decl_type. */
+#define FUNCTION_DECL_DECL_TYPE(NODE) \
+ (NODE->function_decl.decl_type)
+
+/* Set decl_type of a DECL. Set it to T when SET is true, or reset
+ it to NONE. */
+
+static inline void
+set_function_decl_type (tree decl, function_decl_type t, bool set)
+{
+ if (set)
+ {
+ gcc_assert (FUNCTION_DECL_DECL_TYPE (decl) == NONE
+ || FUNCTION_DECL_DECL_TYPE (decl) == t);
+ decl->function_decl.decl_type = t;
+ }
+ else if (FUNCTION_DECL_DECL_TYPE (decl) == t)
+ FUNCTION_DECL_DECL_TYPE (decl) = NONE;
+}
+
/* Nonzero in a FUNCTION_DECL means this function should be treated as
C++ operator new, meaning that it returns a pointer for which we
should not use type based aliasing. */
-#define DECL_IS_OPERATOR_NEW(NODE) \
- (FUNCTION_DECL_CHECK (NODE)->function_decl.operator_new_flag)
+#define DECL_IS_OPERATOR_NEW_P(NODE) \
+ (FUNCTION_DECL_CHECK (NODE)->function_decl.decl_type == OPERATOR_NEW)
+
+#define DECL_SET_IS_OPERATOR_NEW(NODE, VAL) \
+ set_function_decl_type (FUNCTION_DECL_CHECK (NODE), OPERATOR_NEW, VAL)
/* Nonzero in a FUNCTION_DECL means this function may return more
than once. */
(FUNCTION_DECL_CHECK (NODE)->decl_with_vis.cxx_destructor)
/* In FUNCTION_DECL, this is set if this function is a lambda function. */
-#define DECL_LAMBDA_FUNCTION(NODE) \
- (FUNCTION_DECL_CHECK (NODE)->function_decl.lambda_function)
+#define DECL_LAMBDA_FUNCTION_P(NODE) \
+ (FUNCTION_DECL_CHECK (NODE)->function_decl.decl_type == LAMBDA_FUNCTION)
+
+#define DECL_SET_LAMBDA_FUNCTION(NODE, VAL) \
+ set_function_decl_type (FUNCTION_DECL_CHECK (NODE), LAMBDA_FUNCTION, VAL)
/* In FUNCTION_DECL that represent an virtual method this is set when
the method is final. */