From: David Malcolm Date: Mon, 28 Apr 2025 22:21:23 +0000 (-0400) Subject: Eliminate make-unique.h and ::make_unique X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cf5fb8f156b68b8a01e79a9471eeabebd499ea61;p=thirdparty%2Fgcc.git Eliminate make-unique.h and ::make_unique C++11 does not provide a std::make_unique so in r13-3627-g00d7c8ff16e683 I added a make-unique.h declaring a ::make_unique. As of r15-4719-ga9ec1bc06bd3cc we can use C++14, so make-unique.h is no longer needed: we can use simply use std::make_unique instead. This patch removes make-unique.h and updates every place using it to use std::make_unique. No functional change intended. gcc/analyzer/ChangeLog: * access-diagram.cc: Replace uses of ::make_unique with std::make_unique. * analyzer.cc: Likewise. * bounds-checking.cc: Likewise. * call-details.cc: Likewise. * call-info.cc: Likewise. * call-string.cc: Likewise. * checker-path.cc: Likewise. * common.h: Drop include of "make-unique.h". * constraint-manager.cc: Replace uses of ::make_unique with std::make_unique. * diagnostic-manager.cc: Likewise. * engine.cc: Likewise. * infinite-loop.cc: Likewise. * infinite-recursion.cc: Likewise. * kf-analyzer.cc: Likewise. * kf-lang-cp.cc: Likewise. * kf.cc: Likewise. * pending-diagnostic.cc: Likewise. * program-point.cc: Likewise; drop #include. * program-state.cc: Likewise. * ranges.cc: Likewise. * region-model.cc: Likewise. * region.cc: Likewise; drop #include. * sm-fd.cc: Likewise. * sm-file.cc: Likewise. * sm-malloc.cc: Likewise. * sm-pattern-test.cc: Likewise. * sm-sensitive.cc: Likewise. * sm-signal.cc: Likewise. * sm-taint.cc: Likewise. * sm.cc: Likewise. * store.cc: Likewise. * supergraph.cc: Likewise. * svalue.cc: Likewise; drop #include. * varargs.cc: Likewise. gcc/c-family/ChangeLog: * c-pretty-print.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. gcc/c/ChangeLog: * c-decl.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. * c-objc-common.cc: Likewise. * c-parser.cc: Likewise. gcc/cp/ChangeLog: * cxx-pretty-print.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. * error.cc: Likewise. * name-lookup.cc: Likewise. * parser.cc: Likewise. gcc/ChangeLog: * diagnostic-format-json.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. * diagnostic-format-sarif.cc: Likewise. * diagnostic-format-text.cc: Likewise. * diagnostic.cc: Likewise. * dumpfile.cc: Likewise. * gcc-attribute-urlifier.cc: Likewise. * gcc-urlifier.cc: Likewise. * json-parsing.cc: Likewise. * json.cc: Likewise. * lazy-diagnostic-path.cc: Likewise. * libgdiagnostics.cc: Likewise. * libsarifreplay.cc: Likewise. * lto-wrapper.cc: Likewise. * make-unique.h: Delete. * opts-diagnostic.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. * pretty-print.cc: Likewise. * text-art/style.cc: Likewise. * text-art/styled-string.cc: Likewise. * text-art/table.cc: Likewise. * text-art/tree-widget.cc: Likewise. * text-art/widget.cc: Likewise. * timevar.cc: Likewise. * toplev.cc: Likewise. * tree-diagnostic-client-data-hooks.cc: Likewise. gcc/jit/ChangeLog: * dummy-frontend.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. * gcc.dg/plugin/analyzer_gil_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_group_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc: Likewise. Signed-off-by: David Malcolm --- diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access-diagram.cc index a45268ac5b3..42833603b0f 100644 --- a/gcc/analyzer/access-diagram.cc +++ b/gcc/analyzer/access-diagram.cc @@ -365,11 +365,11 @@ bit_size_expr::maybe_get_formatted_str (text_art::style_manager &sm, if (!wi::fits_uhwi_p (concrete_num_bytes)) return nullptr; if (concrete_num_bytes == 1) - return ::make_unique + return std::make_unique (fmt_styled_string (sm, concrete_single_byte_fmt, concrete_num_bytes.to_uhwi ())); else - return ::make_unique + return std::make_unique (fmt_styled_string (sm, concrete_plural_bytes_fmt, concrete_num_bytes.to_uhwi ())); } @@ -379,7 +379,7 @@ bit_size_expr::maybe_get_formatted_str (text_art::style_manager &sm, pp_format_decoder (&pp) = default_tree_printer; if (!num_bytes->maybe_print_for_user (&pp, model)) return nullptr; - return ::make_unique + return std::make_unique (fmt_styled_string (sm, symbolic_bytes_fmt, pp_formatted_text (&pp))); } @@ -390,11 +390,11 @@ bit_size_expr::maybe_get_formatted_str (text_art::style_manager &sm, if (!wi::fits_uhwi_p (concrete_num_bits)) return nullptr; if (concrete_num_bits == 1) - return ::make_unique + return std::make_unique (fmt_styled_string (sm, concrete_single_bit_fmt, concrete_num_bits.to_uhwi ())); else - return ::make_unique + return std::make_unique (fmt_styled_string (sm, concrete_plural_bits_fmt, concrete_num_bits.to_uhwi ())); } @@ -404,7 +404,7 @@ bit_size_expr::maybe_get_formatted_str (text_art::style_manager &sm, pp_format_decoder (&pp) = default_tree_printer; if (!m_num_bits.maybe_print_for_user (&pp, model)) return nullptr; - return ::make_unique + return std::make_unique (fmt_styled_string (sm, symbolic_bits_fmt, pp_formatted_text (&pp))); } @@ -1965,11 +1965,11 @@ make_written_svalue_spatial_item (const access_operation &op, if (const initial_svalue *initial_sval = sval.dyn_cast_initial_svalue ()) if (const string_region *string_reg = initial_sval->get_region ()->dyn_cast_string_region ()) - return make_unique + return std::make_unique (sval, actual_bits, *string_reg, theme, svalue_spatial_item::kind::WRITTEN); - return make_unique (op, sval, actual_bits); + return std::make_unique (op, sval, actual_bits); } static std::unique_ptr @@ -1990,7 +1990,7 @@ make_existing_svalue_spatial_item (const svalue *sval, const initial_svalue *initial_sval = (const initial_svalue *)sval; if (const string_region *string_reg = initial_sval->get_region ()->dyn_cast_string_region ()) - return make_unique + return std::make_unique (*sval, bits, *string_reg, theme, svalue_spatial_item::kind::EXISTING); @@ -1998,7 +1998,7 @@ make_existing_svalue_spatial_item (const svalue *sval, } case SK_COMPOUND: - return make_unique + return std::make_unique (*((const compound_svalue *)sval), bits, svalue_spatial_item::kind::EXISTING, @@ -2106,7 +2106,7 @@ public: } m_col_widths - = make_unique (m_btm.get_num_columns ()); + = std::make_unique (m_btm.get_num_columns ()); /* Now create child widgets. */ @@ -2201,8 +2201,8 @@ private: std::unique_ptr find_boundaries () const { - std::unique_ptr result - = make_unique (*m_op.m_base_region, m_logger); + auto result + = std::make_unique (*m_op.m_base_region, m_logger); m_valid_region_spatial_item.add_boundaries (*result, m_logger); m_accessed_region_spatial_item.add_boundaries (*result, m_logger); @@ -2261,7 +2261,7 @@ private: void add_direction_widget () { - add_child (::make_unique (*this, m_btm)); + add_child (std::make_unique (*this, m_btm)); } void add_invalid_accesses_to_region_table (table &t_region) @@ -2666,11 +2666,12 @@ access_diagram::access_diagram (const access_operation &op, style_manager &sm, const theme &theme, logger *logger) -: wrapper_widget (make_unique (op, - region_creation_event_id, - sm, - theme, - logger)) +: wrapper_widget + (std::make_unique (op, + region_creation_event_id, + sm, + theme, + logger)) { } diff --git a/gcc/analyzer/analyzer.cc b/gcc/analyzer/analyzer.cc index 88e53c7b94a..c2814d2f198 100644 --- a/gcc/analyzer/analyzer.cc +++ b/gcc/analyzer/analyzer.cc @@ -219,11 +219,11 @@ std::unique_ptr tree_to_json (tree node) { if (!node) - return ::make_unique (json::JSON_NULL); + return std::make_unique (json::JSON_NULL); pretty_printer pp; dump_generic_node (&pp, node, 0, TDF_VOPS|TDF_MEMSYMS, false); - return ::make_unique (pp_formatted_text (&pp)); + return std::make_unique (pp_formatted_text (&pp)); } /* Generate a JSON value for EVENT_ID. @@ -238,10 +238,10 @@ diagnostic_event_id_to_json (const diagnostic_event_id_t &event_id) { pretty_printer pp; pp_printf (&pp, "%@", &event_id); - return ::make_unique (pp_formatted_text (&pp)); + return std::make_unique (pp_formatted_text (&pp)); } else - return ::make_unique (json::JSON_NULL); + return std::make_unique (json::JSON_NULL); } /* Generate a JSON value for OFFSET. @@ -253,7 +253,7 @@ bit_offset_to_json (const bit_offset_t &offset) { pretty_printer pp; pp_wide_int_large (&pp, offset, SIGNED); - return ::make_unique (pp_formatted_text (&pp)); + return std::make_unique (pp_formatted_text (&pp)); } /* Generate a JSON value for OFFSET. @@ -265,7 +265,7 @@ byte_offset_to_json (const byte_offset_t &offset) { pretty_printer pp; pp_wide_int_large (&pp, offset, SIGNED); - return ::make_unique (pp_formatted_text (&pp)); + return std::make_unique (pp_formatted_text (&pp)); } /* Workaround for lack of const-correctness of ssa_default_def. */ diff --git a/gcc/analyzer/bounds-checking.cc b/gcc/analyzer/bounds-checking.cc index df7fab28590..a3b134597c2 100644 --- a/gcc/analyzer/bounds-checking.cc +++ b/gcc/analyzer/bounds-checking.cc @@ -96,9 +96,9 @@ public: so we don't need an event for that. */ if (byte_capacity) emission_path.add_event - (make_unique (byte_capacity, - loc_info, - *this)); + (std::make_unique (byte_capacity, + loc_info, + *this)); } void maybe_add_sarif_properties (sarif_object &result_obj) @@ -289,9 +289,9 @@ public: { if (m_byte_bound && TREE_CODE (m_byte_bound) == INTEGER_CST) emission_path.add_event - (make_unique (m_byte_bound, - loc_info, - *this)); + (std::make_unique (m_byte_bound, + loc_info, + *this)); } void maybe_add_sarif_properties (sarif_object &result_obj) @@ -1420,22 +1420,24 @@ region_model::check_symbolic_bounds (const region *base_reg, break; case access_direction::read: gcc_assert (sval_hint == nullptr); - ctxt->warn (make_unique (*this, - sized_offset_reg, - diag_arg, - offset_tree, - num_bytes_tree, - capacity_tree)); + ctxt->warn + (std::make_unique (*this, + sized_offset_reg, + diag_arg, + offset_tree, + num_bytes_tree, + capacity_tree)); return false; break; case access_direction::write: - ctxt->warn (make_unique (*this, - sized_offset_reg, - diag_arg, - offset_tree, - num_bytes_tree, - capacity_tree, - sval_hint)); + ctxt->warn + (std::make_unique (*this, + sized_offset_reg, + diag_arg, + offset_tree, + num_bytes_tree, + capacity_tree, + sval_hint)); return false; break; } @@ -1528,16 +1530,18 @@ region_model::check_region_bounds (const region *reg, break; case access_direction::read: gcc_assert (sval_hint == nullptr); - ctxt->warn (make_unique (*this, reg, - diag_arg, - bits_outside)); + ctxt->warn + (std::make_unique (*this, reg, + diag_arg, + bits_outside)); oob_safe = false; break; case access_direction::write: - ctxt->warn (make_unique (*this, - reg, diag_arg, - bits_outside, - sval_hint)); + ctxt->warn + (std::make_unique (*this, + reg, diag_arg, + bits_outside, + sval_hint)); oob_safe = false; break; } @@ -1564,18 +1568,20 @@ region_model::check_region_bounds (const region *reg, break; case access_direction::read: gcc_assert (sval_hint == nullptr); - ctxt->warn (make_unique (*this, - reg, diag_arg, - bits_outside, - bit_bound)); + ctxt->warn + (std::make_unique (*this, + reg, diag_arg, + bits_outside, + bit_bound)); oob_safe = false; break; case access_direction::write: - ctxt->warn (make_unique (*this, - reg, diag_arg, - bits_outside, - bit_bound, - sval_hint)); + ctxt->warn + (std::make_unique (*this, + reg, diag_arg, + bits_outside, + bit_bound, + sval_hint)); oob_safe = false; break; } diff --git a/gcc/analyzer/call-details.cc b/gcc/analyzer/call-details.cc index 75e73413f3d..bca8658c2aa 100644 --- a/gcc/analyzer/call-details.cc +++ b/gcc/analyzer/call-details.cc @@ -593,10 +593,10 @@ call_details::complain_about_overlap (unsigned arg_idx_a, if (!byte_range_a.intersection (byte_range_b, *model).is_true ()) return; - ctxt->warn (make_unique (get_fndecl_for_call (), - byte_range_a, - byte_range_b, - num_bytes_read_sval)); + ctxt->warn (std::make_unique (get_fndecl_for_call (), + byte_range_a, + byte_range_b, + num_bytes_read_sval)); } } // namespace ana diff --git a/gcc/analyzer/call-info.cc b/gcc/analyzer/call-info.cc index 0a5ae57103c..0e48c1606cb 100644 --- a/gcc/analyzer/call-info.cc +++ b/gcc/analyzer/call-info.cc @@ -101,7 +101,7 @@ call_info::add_events_to_path (checker_path *emission_path, const int stack_depth = src_point.get_stack_depth (); emission_path->add_event - (make_unique (event_loc_info (get_call_stmt ().location, + (std::make_unique (event_loc_info (get_call_stmt ().location, caller_fndecl, stack_depth), this)); diff --git a/gcc/analyzer/call-string.cc b/gcc/analyzer/call-string.cc index 3a9829e22f3..afa8004860b 100644 --- a/gcc/analyzer/call-string.cc +++ b/gcc/analyzer/call-string.cc @@ -91,11 +91,11 @@ call_string::print (pretty_printer *pp) const std::unique_ptr call_string::to_json () const { - auto arr = ::make_unique (); + auto arr = std::make_unique (); for (const call_string::element_t &e : m_elements) { - auto e_obj = ::make_unique (); + auto e_obj = std::make_unique (); e_obj->set_integer ("src_snode_idx", e.m_callee->m_index); e_obj->set_integer ("dst_snode_idx", e.m_caller->m_index); e_obj->set_string ("funcname", function_name (e.m_caller->m_fun)); diff --git a/gcc/analyzer/checker-path.cc b/gcc/analyzer/checker-path.cc index e7a559fc942..9bde6f2f835 100644 --- a/gcc/analyzer/checker-path.cc +++ b/gcc/analyzer/checker-path.cc @@ -148,8 +148,8 @@ checker_path::add_region_creation_events (pending_diagnostic *pd, pd->add_region_creation_events (reg, capacity, loc_info, *this); if (debug) - add_event (make_unique (reg, capacity, - loc_info)); + add_event (std::make_unique (reg, capacity, + loc_info)); } void diff --git a/gcc/analyzer/common.h b/gcc/analyzer/common.h index 0dac29c2323..3d02b6242b1 100644 --- a/gcc/analyzer/common.h +++ b/gcc/analyzer/common.h @@ -25,7 +25,6 @@ along with GCC; see the file COPYING3. If not see #define INCLUDE_VECTOR #include "system.h" #include "coretypes.h" -#include "make-unique.h" #include "tree.h" #include "function.h" #include "basic-block.h" diff --git a/gcc/analyzer/constraint-manager.cc b/gcc/analyzer/constraint-manager.cc index f39f0545f19..a3e682c4938 100644 --- a/gcc/analyzer/constraint-manager.cc +++ b/gcc/analyzer/constraint-manager.cc @@ -436,7 +436,7 @@ bounded_range::dump (bool show_types) const std::unique_ptr bounded_range::to_json () const { - auto range_obj = ::make_unique (); + auto range_obj = std::make_unique (); set_json_attr (*range_obj, "lower", m_lower); set_json_attr (*range_obj, "upper", m_upper); return range_obj; @@ -705,7 +705,7 @@ bounded_ranges::dump (bool show_types) const std::unique_ptr bounded_ranges::to_json () const { - auto arr_obj = ::make_unique (); + auto arr_obj = std::make_unique (); for (unsigned i = 0; i < m_ranges.length (); ++i) arr_obj->append (m_ranges[i].to_json ()); @@ -1103,9 +1103,9 @@ equiv_class::print (pretty_printer *pp) const std::unique_ptr equiv_class::to_json () const { - auto ec_obj = ::make_unique (); + auto ec_obj = std::make_unique (); - auto sval_arr = ::make_unique (); + auto sval_arr = std::make_unique (); for (const svalue *sval : m_vars) sval_arr->append (sval->to_json ()); ec_obj->set ("svals", std::move (sval_arr)); @@ -1370,7 +1370,7 @@ constraint::print (pretty_printer *pp, const constraint_manager &cm) const std::unique_ptr constraint::to_json () const { - auto con_obj = ::make_unique (); + auto con_obj = std::make_unique (); con_obj->set_integer ("lhs", m_lhs.as_int ()); con_obj->set_string ("op", constraint_op_code (m_op)); @@ -1458,7 +1458,7 @@ bounded_ranges_constraint::print (pretty_printer *pp, std::unique_ptr bounded_ranges_constraint::to_json () const { - auto con_obj = ::make_unique (); + auto con_obj = std::make_unique (); con_obj->set_integer ("ec", m_ec_id.as_int ()); con_obj->set ("ranges", m_ranges->to_json ()); @@ -1771,11 +1771,11 @@ debug (const constraint_manager &cm) std::unique_ptr constraint_manager::to_json () const { - auto cm_obj = ::make_unique (); + auto cm_obj = std::make_unique (); /* Equivalence classes. */ { - auto ec_arr = ::make_unique (); + auto ec_arr = std::make_unique (); for (const equiv_class *ec : m_equiv_classes) ec_arr->append (ec->to_json ()); cm_obj->set ("ecs", std::move (ec_arr)); @@ -1783,7 +1783,7 @@ constraint_manager::to_json () const /* Constraints. */ { - auto con_arr = ::make_unique (); + auto con_arr = std::make_unique (); for (const constraint &c : m_constraints) con_arr->append (c.to_json ()); cm_obj->set ("constraints", std::move (con_arr)); @@ -1791,7 +1791,7 @@ constraint_manager::to_json () const /* m_bounded_ranges_constraints. */ { - auto con_arr = ::make_unique (); + auto con_arr = std::make_unique (); for (const auto &c : m_bounded_ranges_constraints) con_arr->append (c.to_json ()); cm_obj->set ("bounded_ranges_constraints", std::move (con_arr)); diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc index 09629d4e5b2..161ae62051a 100644 --- a/gcc/analyzer/diagnostic-manager.cc +++ b/gcc/analyzer/diagnostic-manager.cc @@ -191,7 +191,7 @@ epath_finder::get_best_epath (const exploded_node *enode, logger->log ("trying to find shortest path ignoring feasibility"); gcc_assert (m_sep); std::unique_ptr epath - = make_unique (m_sep->get_shortest_path (enode)); + = std::make_unique (m_sep->get_shortest_path (enode)); if (epath->feasible_p (logger, out_problem, m_eg.get_engine (), &m_eg)) { if (logger) @@ -730,7 +730,7 @@ saved_diagnostic::add_event (std::unique_ptr event) std::unique_ptr saved_diagnostic::to_json () const { - auto sd_obj = ::make_unique (); + auto sd_obj = std::make_unique (); if (m_sm) sd_obj->set_string ("sm", m_sm->get_name ()); @@ -1036,10 +1036,10 @@ saved_diagnostic::maybe_add_sarif_properties (sarif_object &result_obj) const props.set_integer (PROPERTY_PREFIX "idx", m_idx); if (m_duplicates.length () > 0) { - auto duplicates_arr = ::make_unique (); + auto duplicates_arr = std::make_unique (); for (auto iter : m_duplicates) { - auto sd_obj = ::make_unique (); + auto sd_obj = std::make_unique (); iter->maybe_add_sarif_properties (*sd_obj); duplicates_arr->append (std::move (sd_obj)); } @@ -1230,10 +1230,10 @@ diagnostic_manager::add_event (std::unique_ptr event) std::unique_ptr diagnostic_manager::to_json () const { - auto dm_obj = ::make_unique (); + auto dm_obj = std::make_unique (); { - auto sd_arr = ::make_unique (); + auto sd_arr = std::make_unique (); int i; saved_diagnostic *sd; FOR_EACH_VEC_ELT (m_saved_diagnostics, i, sd) @@ -1804,16 +1804,16 @@ public: int stack_depth = src_stack_depth; m_emission_path->add_event - (make_unique (supernode, - stmt, - stack_depth, - sm, - nullptr, - src_sm_val, - dst_sm_val, - nullptr, - dst_state, - src_node)); + (std::make_unique (supernode, + stmt, + stack_depth, + sm, + nullptr, + src_sm_val, + dst_sm_val, + nullptr, + dst_state, + src_node)); return false; } @@ -1849,16 +1849,16 @@ public: return false; m_emission_path->add_event - (make_unique (supernode, - stmt, - stack_depth, - sm, - sval, - src_sm_val, - dst_sm_val, - dst_origin_sval, - dst_state, - src_node)); + (std::make_unique (supernode, + stmt, + stack_depth, + sm, + sval, + src_sm_val, + dst_sm_val, + dst_origin_sval, + dst_state, + src_node)); return false; } @@ -1995,15 +1995,15 @@ struct null_assignment_sm_context : public sm_context int stack_depth = m_point->get_stack_depth (); m_emission_path->add_event - (make_unique (supernode, - m_stmt, - stack_depth, - m_sm, - var_new_sval, - from, to, - nullptr, - *m_new_state, - nullptr)); + (std::make_unique (supernode, + m_stmt, + stack_depth, + m_sm, + var_new_sval, + from, to, + nullptr, + *m_new_state, + nullptr)); } void set_next_state (const gimple *stmt, @@ -2021,15 +2021,15 @@ struct null_assignment_sm_context : public sm_context int stack_depth = m_point->get_stack_depth (); m_emission_path->add_event - (make_unique (supernode, - m_stmt, - stack_depth, - m_sm, - sval, - from, to, - nullptr, - *m_new_state, - nullptr)); + (std::make_unique (supernode, + m_stmt, + stack_depth, + m_sm, + sval, + from, to, + nullptr, + *m_new_state, + nullptr)); } void warn (const supernode *, const gimple *, @@ -2210,16 +2210,17 @@ diagnostic_manager::add_events_for_eedge (const path_builder &pb, const gcall *call = dyn_cast (stmt); if (call && is_setjmp_call_p (*call)) emission_path->add_event - (make_unique (event_loc_info (stmt->location, - dst_point.get_fndecl (), - dst_stack_depth), - dst_node, - *call)); + (std::make_unique + (event_loc_info (stmt->location, + dst_point.get_fndecl (), + dst_stack_depth), + dst_node, + *call)); else emission_path->add_event - (make_unique (stmt, - dst_point.get_fndecl (), - dst_stack_depth, dst_state)); + (std::make_unique (stmt, + dst_point.get_fndecl (), + dst_stack_depth, dst_state)); /* Create state change events for assignment to NULL. Iterate through the stmts in dst_enode, adding state change @@ -2312,11 +2313,11 @@ diagnostic_manager::add_events_for_eedge (const path_builder &pb, " at this edge: "); pb.get_feasibility_problem ()->dump_to_pp (&pp); emission_path->add_event - (make_unique - (event_loc_info (dst_point.get_location (), - dst_point.get_fndecl (), - dst_stack_depth), - pp_formatted_text (&pp))); + (std::make_unique + (event_loc_info (dst_point.get_location (), + dst_point.get_fndecl (), + dst_stack_depth), + pp_formatted_text (&pp))); } } @@ -2427,17 +2428,18 @@ diagnostic_manager::add_events_for_superedge (const path_builder &pb, case SUPEREDGE_CFG_EDGE: { emission_path->add_event - (make_unique - (eedge, - event_loc_info (last_stmt ? last_stmt->location : UNKNOWN_LOCATION, - src_point.get_fndecl (), - src_stack_depth))); + (std::make_unique + (eedge, + event_loc_info + (last_stmt ? last_stmt->location : UNKNOWN_LOCATION, + src_point.get_fndecl (), + src_stack_depth))); emission_path->add_event - (make_unique - (eedge, - event_loc_info (dst_point.get_supernode ()->get_start_location (), - dst_point.get_fndecl (), - dst_stack_depth))); + (std::make_unique + (eedge, + event_loc_info (dst_point.get_supernode ()->get_start_location (), + dst_point.get_fndecl (), + dst_stack_depth))); } break; @@ -2450,12 +2452,13 @@ diagnostic_manager::add_events_for_superedge (const path_builder &pb, /* TODO: add a subclass for this, or generate events for the summary. */ emission_path->add_event - (make_unique (event_loc_info (last_stmt - ? last_stmt->location - : UNKNOWN_LOCATION, - src_point.get_fndecl (), - src_stack_depth), - "call summary")); + (std::make_unique + (event_loc_info (last_stmt + ? last_stmt->location + : UNKNOWN_LOCATION, + src_point.get_fndecl (), + src_stack_depth), + "call summary")); } break; @@ -2466,10 +2469,11 @@ diagnostic_manager::add_events_for_superedge (const path_builder &pb, const gcall &call_stmt = return_edge->get_call_stmt (); emission_path->add_event - (make_unique (eedge, - event_loc_info (call_stmt.location, - dst_point.get_fndecl (), - dst_stack_depth))); + (std::make_unique + (eedge, + event_loc_info (call_stmt.location, + dst_point.get_fndecl (), + dst_stack_depth))); } break; } diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index c04bda1e645..1b819ffbbbb 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -572,17 +572,17 @@ get_state_map_by_name (const char *name, { const sm_state_map *old_smap = m_old_state->m_checker_states[sm_idx]; *out_sm_context - = make_unique (*m_eg, - sm_idx, - *sm, - m_enode_for_diag, - m_old_state, - m_new_state, - old_smap, - new_smap, - m_path_ctxt, - m_stmt_finder, - false); + = std::make_unique (*m_eg, + sm_idx, + *sm, + m_enode_for_diag, + m_old_state, + m_new_state, + old_smap, + new_smap, + m_path_ctxt, + m_stmt_finder, + false); } return true; } @@ -598,7 +598,7 @@ public: std::unique_ptr clone () const final override { - return make_unique (m_eg, m_var); + return std::make_unique (m_eg, m_var); } const gimple *find_stmt (const exploded_path &epath) @@ -1429,7 +1429,7 @@ exploded_node::dump (const extrinsic_state &ext_state) const std::unique_ptr exploded_node::to_json (const extrinsic_state &ext_state) const { - auto enode_obj = ::make_unique (); + auto enode_obj = std::make_unique (); enode_obj->set ("point", get_point ().to_json ()); enode_obj->set ("state", get_state ().to_json (ext_state)); @@ -1743,10 +1743,11 @@ exploded_node::replay_call_summary (exploded_graph &eg, call_summary_replay r (cd, called_fn, summary, ext_state); if (path_ctxt) - path_ctxt->bifurcate (make_unique (cd, - called_fn, - summary, - ext_state)); + path_ctxt->bifurcate + (std::make_unique (cd, + called_fn, + summary, + ext_state)); } @@ -1941,9 +1942,9 @@ exploded_node::on_longjmp (exploded_graph &eg, /* Verify that the setjmp's call_stack hasn't been popped. */ if (!valid_longjmp_stack_p (longjmp_point, setjmp_point)) { - ctxt->warn (make_unique (setjmp_call, - longjmp_call, - setjmp_point)); + ctxt->warn (std::make_unique (setjmp_call, + longjmp_call, + setjmp_point)); return; } @@ -1977,8 +1978,8 @@ exploded_node::on_longjmp (exploded_graph &eg, { exploded_edge *eedge = eg.add_edge (const_cast (this), next, NULL, true, - make_unique (tmp_setjmp_record, - longjmp_call)); + std::make_unique (tmp_setjmp_record, + longjmp_call)); /* For any diagnostics that were queued here (such as leaks) we want the checker_path to show the rewinding events after the "final event" @@ -2122,16 +2123,16 @@ dynamic_call_info_t::add_events_to_path (checker_path *emission_path, if (m_is_returning_call) emission_path->add_event - (make_unique (eedge, - event_loc_info (m_dynamic_call.location, - dest_point.get_fndecl (), - dest_stack_depth))); + (std::make_unique (eedge, + event_loc_info (m_dynamic_call.location, + dest_point.get_fndecl (), + dest_stack_depth))); else emission_path->add_event - (make_unique (eedge, - event_loc_info (m_dynamic_call.location, - src_point.get_fndecl (), - src_stack_depth))); + (std::make_unique (eedge, + event_loc_info (m_dynamic_call.location, + src_point.get_fndecl (), + src_stack_depth))); } /* class rewind_info_t : public custom_edge_info. */ @@ -2176,19 +2177,19 @@ rewind_info_t::add_events_to_path (checker_path *emission_path, const int dst_stack_depth = dst_point.get_stack_depth (); emission_path->add_event - (make_unique - (&eedge, - event_loc_info (get_longjmp_call ().location, - src_point.get_fndecl (), - src_stack_depth), - this)); + (std::make_unique + (&eedge, + event_loc_info (get_longjmp_call ().location, + src_point.get_fndecl (), + src_stack_depth), + this)); emission_path->add_event - (make_unique - (&eedge, - event_loc_info (get_setjmp_call ().location, - dst_point.get_fndecl (), - dst_stack_depth), - this)); + (std::make_unique + (&eedge, + event_loc_info (get_setjmp_call ().location, + dst_point.get_fndecl (), + dst_stack_depth), + this)); } /* class exploded_edge : public dedge. */ @@ -2281,7 +2282,7 @@ exploded_edge::dump_dot_label (pretty_printer *pp) const std::unique_ptr exploded_edge::to_json () const { - auto eedge_obj = ::make_unique (); + auto eedge_obj = std::make_unique (); eedge_obj->set_integer ("src_idx", m_src->m_index); eedge_obj->set_integer ("dst_idx", m_dest->m_index); if (m_sedge) @@ -2407,9 +2408,9 @@ strongly_connected_components::dump () const std::unique_ptr strongly_connected_components::to_json () const { - auto scc_arr = ::make_unique (); + auto scc_arr = std::make_unique (); for (int i = 0; i < m_sg.num_nodes (); i++) - scc_arr->append (::make_unique (get_scc_id (i))); + scc_arr->append (std::make_unique (get_scc_id (i))); return scc_arr; } @@ -2628,7 +2629,7 @@ worklist::key_t::cmp (const worklist::key_t &ka, const worklist::key_t &kb) std::unique_ptr worklist::to_json () const { - auto worklist_obj = ::make_unique (); + auto worklist_obj = std::make_unique (); worklist_obj->set ("scc", m_scc.to_json ()); @@ -2778,8 +2779,8 @@ public: const exploded_edge &) const final override { emission_path->add_event - (make_unique - (event_loc_info (DECL_SOURCE_LOCATION (m_fndecl), m_fndecl, 0))); + (std::make_unique + (event_loc_info (DECL_SOURCE_LOCATION (m_fndecl), m_fndecl, 0))); } private: @@ -2820,7 +2821,7 @@ exploded_graph::add_function_entry (const function &fun) if (lookup_attribute ("tainted_args", DECL_ATTRIBUTES (fun.decl))) { if (mark_params_as_tainted (&state, fun.decl, m_ext_state)) - edge_info = make_unique (fun.decl); + edge_info = std::make_unique (fun.decl); } if (!state.m_valid) @@ -3225,16 +3226,16 @@ public: /* Show the field in the struct declaration, e.g. "(1) field 'store' is marked with '__attribute__((tainted_args))'" */ emission_path->add_event - (make_unique (m_field)); + (std::make_unique (m_field)); /* Show the callback in the initializer e.g. "(2) function 'gadget_dev_desc_UDC_store' used as initializer for field 'store' marked with '__attribute__((tainted_args))'". */ emission_path->add_event - (make_unique - (event_loc_info (m_loc, m_fndecl, 0), - m_field)); + (std::make_unique + (event_loc_info (m_loc, m_fndecl, 0), + m_field)); } private: @@ -3291,7 +3292,7 @@ add_tainted_args_callback (exploded_graph *eg, tree field, tree fndecl, } eg->add_edge (eg->get_origin (), enode, NULL, false, - make_unique (field, fndecl, loc)); + std::make_unique (field, fndecl, loc)); } /* Callback for walk_tree for finding callbacks within initializers; @@ -3892,7 +3893,7 @@ exploded_graph::maybe_create_dynamic_call (const gcall &call, if (enode) add_edge (node,enode, NULL, false, /* No work is done by the call itself. */ - make_unique (call)); + std::make_unique (call)); return true; } } @@ -4362,7 +4363,8 @@ exploded_graph::process_node (exploded_node *node) const svalue *fn_ptr_sval = model->get_rvalue (fn_ptr, &ctxt); if (fn_ptr_sval->all_zeroes_p ()) - ctxt.warn (make_unique (call)); + ctxt.warn + (std::make_unique (call)); } /* An unknown function or a special function was called @@ -4429,7 +4431,7 @@ exploded_graph::process_node (exploded_node *node) node); if (enode) add_edge (node, enode, NULL, false, - make_unique (*call, true)); + std::make_unique (*call, true)); } } } @@ -4648,11 +4650,11 @@ exploded_graph::dump_states_for_supernode (FILE *out, std::unique_ptr exploded_graph::to_json () const { - auto egraph_obj = ::make_unique (); + auto egraph_obj = std::make_unique (); /* Nodes. */ { - auto nodes_arr = ::make_unique (); + auto nodes_arr = std::make_unique (); unsigned i; exploded_node *n; FOR_EACH_VEC_ELT (m_nodes, i, n) @@ -4662,7 +4664,7 @@ exploded_graph::to_json () const /* Edges. */ { - auto edges_arr = ::make_unique (); + auto edges_arr = std::make_unique (); unsigned i; exploded_edge *n; FOR_EACH_VEC_ELT (m_edges, i, n) @@ -4768,9 +4770,9 @@ exploded_path::feasible_p (logger *logger, const program_point &src_point = src_enode.get_point (); const gimple *last_stmt = src_point.get_supernode ()->get_last_stmt (); - *out = ::make_unique (edge_idx, *eedge, - last_stmt, - std::move (rc)); + *out = std::make_unique (edge_idx, *eedge, + last_stmt, + std::move (rc)); } return false; } @@ -6082,7 +6084,7 @@ dump_analyzer_json (const supergraph &sg, return; } - auto toplev_obj = ::make_unique (); + auto toplev_obj = std::make_unique (); toplev_obj->set ("sgraph", sg.to_json ()); toplev_obj->set ("egraph", eg.to_json ()); diff --git a/gcc/analyzer/infinite-loop.cc b/gcc/analyzer/infinite-loop.cc index 58927c700d8..ec0b07947bf 100644 --- a/gcc/analyzer/infinite-loop.cc +++ b/gcc/analyzer/infinite-loop.cc @@ -86,9 +86,9 @@ struct infinite_loop std::unique_ptr to_json () const { - auto loop_obj = ::make_unique (); + auto loop_obj = std::make_unique (); loop_obj->set_integer ("enode", m_enode.m_index); - auto edge_arr = ::make_unique (); + auto edge_arr = std::make_unique (); for (auto eedge : m_eedge_vec) edge_arr->append (eedge->to_json ()); loop_obj->set ("eedges", std::move (edge_arr)); @@ -215,7 +215,7 @@ public: checker_path *emission_path) final override { emission_path->add_event - (make_unique + (std::make_unique (event_loc_info (m_inf_loop->m_loc, enode->get_function ()->decl, enode->get_stack_depth ()), @@ -263,43 +263,46 @@ public: if (switch_cfg_sedge->implicitly_created_default_p ()) { emission_path->add_event - (make_unique (*eedge, - loc_info_from)); + (std::make_unique + (*eedge, + loc_info_from)); emission_path->add_event - (make_unique - (*eedge, - loc_info_to)); + (std::make_unique + (*eedge, + loc_info_to)); } } if (cfg_sedge->true_value_p ()) { emission_path->add_event - (make_unique (*eedge, - loc_info_from)); + (std::make_unique + (*eedge, + loc_info_from)); emission_path->add_event - (make_unique - (*eedge, - loc_info_to)); + (std::make_unique + (*eedge, + loc_info_to)); } else if (cfg_sedge->false_value_p ()) { emission_path->add_event - (make_unique (*eedge, - loc_info_from)); + (std::make_unique + (*eedge, + loc_info_from)); emission_path->add_event - (make_unique - (*eedge, - loc_info_to)); + (std::make_unique + (*eedge, + loc_info_to)); } else if (cfg_sedge->back_edge_p ()) { emission_path->add_event - (make_unique (*eedge, loc_info_from)); + (std::make_unique (*eedge, loc_info_from)); emission_path->add_event - (make_unique - (*eedge, - loc_info_to)); + (std::make_unique + (*eedge, + loc_info_to)); } } } @@ -393,7 +396,7 @@ starts_infinite_loop_p (const exploded_node &enode, feasible_node *curr_fnode = nullptr; if (flag_dump_analyzer_infinite_loop) - fg = ::make_unique (); + fg = std::make_unique (); location_t first_loc = UNKNOWN_LOCATION; const exploded_node *iter = &enode; @@ -438,10 +441,10 @@ starts_infinite_loop_p (const exploded_node &enode, fg->dump_dot (filename, nullptr, dump_args); free (filename); } - return ::make_unique (enode, - first_loc, - std::move (eedges), - logger); + return std::make_unique (enode, + first_loc, + std::move (eedges), + logger); } else { @@ -571,7 +574,7 @@ exploded_graph::detect_infinite_loops () pending_location ploc (enode, snode, inf_loop->m_loc); auto d - = ::make_unique (std::move (inf_loop)); + = std::make_unique (std::move (inf_loop)); get_diagnostic_manager ().add_diagnostic (ploc, std::move (d)); } } diff --git a/gcc/analyzer/infinite-recursion.cc b/gcc/analyzer/infinite-recursion.cc index 297b0496039..064111769b0 100644 --- a/gcc/analyzer/infinite-recursion.cc +++ b/gcc/analyzer/infinite-recursion.cc @@ -148,14 +148,15 @@ public: { gcc_assert (m_prev_entry_event == NULL); std::unique_ptr prev_entry_event - = make_unique (dst_point, - *this, false); + = std::make_unique (dst_point, + *this, false); m_prev_entry_event = prev_entry_event.get (); emission_path->add_event (std::move (prev_entry_event)); } else if (eedge.m_dest == m_new_entry_enode) emission_path->add_event - (make_unique (dst_point, *this, true)); + (std::make_unique + (dst_point, *this, true)); else pending_diagnostic::add_function_entry_event (eedge, emission_path); } @@ -171,7 +172,7 @@ public: { gcc_assert (m_new_entry_enode); emission_path->add_event - (make_unique + (std::make_unique (event_loc_info (m_new_entry_enode->get_supernode ()->get_start_location (), m_callee_fndecl, @@ -623,7 +624,7 @@ exploded_graph::detect_infinite_recursion (exploded_node *enode) nullptr); get_diagnostic_manager ().add_diagnostic (ploc, - make_unique (prev_entry_enode, - enode, - fndecl)); + std::make_unique (prev_entry_enode, + enode, + fndecl)); } diff --git a/gcc/analyzer/kf-analyzer.cc b/gcc/analyzer/kf-analyzer.cc index 669b49752eb..3e671e5edad 100644 --- a/gcc/analyzer/kf-analyzer.cc +++ b/gcc/analyzer/kf-analyzer.cc @@ -297,7 +297,7 @@ public: region_model_context *ctxt = cd.get_ctxt (); if (!ctxt) return; - ctxt->warn (make_unique ()); + ctxt->warn (std::make_unique ()); } }; @@ -374,22 +374,28 @@ public: void register_known_analyzer_functions (known_function_manager &kfm) { - kfm.add ("__analyzer_break", make_unique ()); - kfm.add ("__analyzer_describe", make_unique ()); + kfm.add ("__analyzer_break", + std::make_unique ()); + kfm.add ("__analyzer_describe", + std::make_unique ()); kfm.add ("__analyzer_dump_capacity", - make_unique ()); - kfm.add ("__analyzer_dump_escaped", make_unique ()); + std::make_unique ()); + kfm.add ("__analyzer_dump_escaped", + std::make_unique ()); kfm.add ("__analyzer_dump_exploded_nodes", - make_unique ()); + std::make_unique ()); kfm.add ("__analyzer_dump_named_constant", - make_unique ()); - kfm.add ("__analyzer_dump_path", make_unique ()); + std::make_unique ()); + kfm.add ("__analyzer_dump_path", + std::make_unique ()); kfm.add ("__analyzer_dump_region_model", - make_unique ()); - kfm.add ("__analyzer_eval", make_unique ()); + std::make_unique ()); + kfm.add ("__analyzer_eval", + std::make_unique ()); kfm.add ("__analyzer_get_unknown_ptr", - make_unique ()); - kfm.add ("__analyzer_get_strlen", make_kf_strlen ()); + std::make_unique ()); + kfm.add ("__analyzer_get_strlen", + make_kf_strlen ()); } } // namespace ana diff --git a/gcc/analyzer/kf-lang-cp.cc b/gcc/analyzer/kf-lang-cp.cc index 8325f158173..8e08dbc16dc 100644 --- a/gcc/analyzer/kf-lang-cp.cc +++ b/gcc/analyzer/kf-lang-cp.cc @@ -172,10 +172,10 @@ public: void register_known_functions_lang_cp (known_function_manager &kfm) { - kfm.add ("operator new", make_unique ()); - kfm.add ("operator new []", make_unique ()); - kfm.add ("operator delete", make_unique ()); - kfm.add ("operator delete []", make_unique ()); + kfm.add ("operator new", std::make_unique ()); + kfm.add ("operator new []", std::make_unique ()); + kfm.add ("operator delete", std::make_unique ()); + kfm.add ("operator delete []", std::make_unique ()); } } // namespace ana diff --git a/gcc/analyzer/kf.cc b/gcc/analyzer/kf.cc index e7f51ac4904..e9ad86514d6 100644 --- a/gcc/analyzer/kf.cc +++ b/gcc/analyzer/kf.cc @@ -871,7 +871,7 @@ public: break; case MEMSPACE_STACK: if (ctxt) - ctxt->warn (make_unique (fndecl, reg)); + ctxt->warn (std::make_unique (fndecl, reg)); break; } cd.set_any_lhs_with_defaults (); @@ -1119,9 +1119,9 @@ kf_realloc::impl_call_post (const call_details &cd) const if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd)); - cd.get_ctxt ()->bifurcate (make_unique (cd)); - cd.get_ctxt ()->bifurcate (make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); cd.get_ctxt ()->terminate_path (); } } @@ -1210,8 +1210,8 @@ kf_strchr::impl_call_post (const call_details &cd) const /* Body of kf_strchr::impl_call_post. */ if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd, false)); - cd.get_ctxt ()->bifurcate (make_unique (cd, true)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd, false)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd, true)); cd.get_ctxt ()->terminate_path (); } } @@ -1466,7 +1466,7 @@ public: std::unique_ptr make_kf_strlen () { - return make_unique (); + return std::make_unique (); } /* Handler for "strncpy" and "__builtin_strncpy". @@ -1640,11 +1640,13 @@ kf_strncpy::impl_call_post (const call_details &cd) const nullptr, nullptr); cd.get_ctxt ()->bifurcate - (make_unique (cd, num_bytes_with_terminator_sval, - false)); + (std::make_unique + (cd, num_bytes_with_terminator_sval, + false)); cd.get_ctxt ()->bifurcate - (make_unique (cd, num_bytes_with_terminator_sval, - true)); + (std::make_unique + (cd, num_bytes_with_terminator_sval, + true)); cd.get_ctxt ()->terminate_path (); } }; @@ -1767,8 +1769,8 @@ kf_strstr::impl_call_post (const call_details &cd) const /* Body of kf_strstr::impl_call_post. */ if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd, false)); - cd.get_ctxt ()->bifurcate (make_unique (cd, true)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd, false)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd, true)); cd.get_ctxt ()->terminate_path (); } } @@ -1914,7 +1916,7 @@ public: if (cd.get_arg_svalue (0)->all_zeroes_p ()) { if (ctxt) - ctxt->warn (::make_unique (cd)); + ctxt->warn (::std::make_unique (cd)); } /* Assume that "str" was actually non-null; terminate @@ -2032,13 +2034,13 @@ public: Typically the str is either null or non-null at a particular site, so hopefully this will generally just lead to two out-edges. */ cd.get_ctxt ()->bifurcate - (make_unique (cd, m_private_reg, false, false)); + (std::make_unique (cd, m_private_reg, false, false)); cd.get_ctxt ()->bifurcate - (make_unique (cd, m_private_reg, false, true)); + (std::make_unique (cd, m_private_reg, false, true)); cd.get_ctxt ()->bifurcate - (make_unique (cd, m_private_reg, true, false)); + (std::make_unique (cd, m_private_reg, true, false)); cd.get_ctxt ()->bifurcate - (make_unique (cd, m_private_reg, true, true)); + (std::make_unique (cd, m_private_reg, true, true)); cd.get_ctxt ()->terminate_path (); } } @@ -2064,127 +2066,127 @@ region_model::impl_deallocation_call (const call_details &cd) static void register_atomic_builtins (known_function_manager &kfm) { - kfm.add (BUILT_IN_ATOMIC_EXCHANGE, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_EXCHANGE_N, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_EXCHANGE_1, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_EXCHANGE_2, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_EXCHANGE_4, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_EXCHANGE_8, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_EXCHANGE_16, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_LOAD, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_LOAD_N, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_LOAD_1, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_LOAD_2, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_LOAD_4, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_LOAD_8, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_LOAD_16, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_STORE, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_STORE_N, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_STORE_1, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_STORE_2, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_STORE_4, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_STORE_8, make_unique ()); - kfm.add (BUILT_IN_ATOMIC_STORE_16, make_unique ()); + kfm.add (BUILT_IN_ATOMIC_EXCHANGE, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_EXCHANGE_N, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_EXCHANGE_1, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_EXCHANGE_2, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_EXCHANGE_4, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_EXCHANGE_8, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_EXCHANGE_16, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_LOAD, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_LOAD_N, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_LOAD_1, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_LOAD_2, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_LOAD_4, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_LOAD_8, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_LOAD_16, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_STORE, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_STORE_N, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_STORE_1, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_STORE_2, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_STORE_4, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_STORE_8, std::make_unique ()); + kfm.add (BUILT_IN_ATOMIC_STORE_16, std::make_unique ()); kfm.add (BUILT_IN_ATOMIC_ADD_FETCH_1, - make_unique (PLUS_EXPR)); + std::make_unique (PLUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_ADD_FETCH_2, - make_unique (PLUS_EXPR)); + std::make_unique (PLUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_ADD_FETCH_4, - make_unique (PLUS_EXPR)); + std::make_unique (PLUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_ADD_FETCH_8, - make_unique (PLUS_EXPR)); + std::make_unique (PLUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_ADD_FETCH_16, - make_unique (PLUS_EXPR)); + std::make_unique (PLUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_SUB_FETCH_1, - make_unique (MINUS_EXPR)); + std::make_unique (MINUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_SUB_FETCH_2, - make_unique (MINUS_EXPR)); + std::make_unique (MINUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_SUB_FETCH_4, - make_unique (MINUS_EXPR)); + std::make_unique (MINUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_SUB_FETCH_8, - make_unique (MINUS_EXPR)); + std::make_unique (MINUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_SUB_FETCH_16, - make_unique (MINUS_EXPR)); + std::make_unique (MINUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_AND_FETCH_1, - make_unique (BIT_AND_EXPR)); + std::make_unique (BIT_AND_EXPR)); kfm.add (BUILT_IN_ATOMIC_AND_FETCH_2, - make_unique (BIT_AND_EXPR)); + std::make_unique (BIT_AND_EXPR)); kfm.add (BUILT_IN_ATOMIC_AND_FETCH_4, - make_unique (BIT_AND_EXPR)); + std::make_unique (BIT_AND_EXPR)); kfm.add (BUILT_IN_ATOMIC_AND_FETCH_8, - make_unique (BIT_AND_EXPR)); + std::make_unique (BIT_AND_EXPR)); kfm.add (BUILT_IN_ATOMIC_AND_FETCH_16, - make_unique (BIT_AND_EXPR)); + std::make_unique (BIT_AND_EXPR)); kfm.add (BUILT_IN_ATOMIC_XOR_FETCH_1, - make_unique (BIT_XOR_EXPR)); + std::make_unique (BIT_XOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_XOR_FETCH_2, - make_unique (BIT_XOR_EXPR)); + std::make_unique (BIT_XOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_XOR_FETCH_4, - make_unique (BIT_XOR_EXPR)); + std::make_unique (BIT_XOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_XOR_FETCH_8, - make_unique (BIT_XOR_EXPR)); + std::make_unique (BIT_XOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_XOR_FETCH_16, - make_unique (BIT_XOR_EXPR)); + std::make_unique (BIT_XOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_OR_FETCH_1, - make_unique (BIT_IOR_EXPR)); + std::make_unique (BIT_IOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_OR_FETCH_2, - make_unique (BIT_IOR_EXPR)); + std::make_unique (BIT_IOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_OR_FETCH_4, - make_unique (BIT_IOR_EXPR)); + std::make_unique (BIT_IOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_OR_FETCH_8, - make_unique (BIT_IOR_EXPR)); + std::make_unique (BIT_IOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_OR_FETCH_16, - make_unique (BIT_IOR_EXPR)); + std::make_unique (BIT_IOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_ADD_1, - make_unique (PLUS_EXPR)); + std::make_unique (PLUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_ADD_2, - make_unique (PLUS_EXPR)); + std::make_unique (PLUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_ADD_4, - make_unique (PLUS_EXPR)); + std::make_unique (PLUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_ADD_8, - make_unique (PLUS_EXPR)); + std::make_unique (PLUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_ADD_16, - make_unique (PLUS_EXPR)); + std::make_unique (PLUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_SUB_1, - make_unique (MINUS_EXPR)); + std::make_unique (MINUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_SUB_2, - make_unique (MINUS_EXPR)); + std::make_unique (MINUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_SUB_4, - make_unique (MINUS_EXPR)); + std::make_unique (MINUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_SUB_8, - make_unique (MINUS_EXPR)); + std::make_unique (MINUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_SUB_16, - make_unique (MINUS_EXPR)); + std::make_unique (MINUS_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_AND_1, - make_unique (BIT_AND_EXPR)); + std::make_unique (BIT_AND_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_AND_2, - make_unique (BIT_AND_EXPR)); + std::make_unique (BIT_AND_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_AND_4, - make_unique (BIT_AND_EXPR)); + std::make_unique (BIT_AND_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_AND_8, - make_unique (BIT_AND_EXPR)); + std::make_unique (BIT_AND_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_AND_16, - make_unique (BIT_AND_EXPR)); + std::make_unique (BIT_AND_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_XOR_1, - make_unique (BIT_XOR_EXPR)); + std::make_unique (BIT_XOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_XOR_2, - make_unique (BIT_XOR_EXPR)); + std::make_unique (BIT_XOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_XOR_4, - make_unique (BIT_XOR_EXPR)); + std::make_unique (BIT_XOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_XOR_8, - make_unique (BIT_XOR_EXPR)); + std::make_unique (BIT_XOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_XOR_16, - make_unique (BIT_XOR_EXPR)); + std::make_unique (BIT_XOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_OR_1, - make_unique (BIT_IOR_EXPR)); + std::make_unique (BIT_IOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_OR_2, - make_unique (BIT_IOR_EXPR)); + std::make_unique (BIT_IOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_OR_4, - make_unique (BIT_IOR_EXPR)); + std::make_unique (BIT_IOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_OR_8, - make_unique (BIT_IOR_EXPR)); + std::make_unique (BIT_IOR_EXPR)); kfm.add (BUILT_IN_ATOMIC_FETCH_OR_16, - make_unique (BIT_IOR_EXPR)); + std::make_unique (BIT_IOR_EXPR)); } /* Handle calls to the various IFN_UBSAN_* with no return value. @@ -2214,14 +2216,14 @@ register_sanitizer_builtins (known_function_manager &kfm) /* Handle calls to the various IFN_UBSAN_* with no return value. For now, treat these as no-ops. */ kfm.add (IFN_UBSAN_NULL, - make_unique ()); + std::make_unique ()); kfm.add (IFN_UBSAN_BOUNDS, - make_unique ()); + std::make_unique ()); kfm.add (IFN_UBSAN_PTR, - make_unique ()); + std::make_unique ()); kfm.add (BUILT_IN_UBSAN_HANDLE_NONNULL_ARG, - make_unique ()); + std::make_unique ()); } /* Populate KFM with instances of known functions supported by the core of the @@ -2236,17 +2238,17 @@ register_known_functions (known_function_manager &kfm, /* Internal fns the analyzer has known_functions for. */ { - kfm.add (IFN_BUILTIN_EXPECT, make_unique ()); + kfm.add (IFN_BUILTIN_EXPECT, std::make_unique ()); } /* GCC built-ins that do not correspond to a function in the standard library. */ { - kfm.add (BUILT_IN_EXPECT, make_unique ()); - kfm.add (BUILT_IN_EXPECT_WITH_PROBABILITY, make_unique ()); - kfm.add (BUILT_IN_ALLOCA_WITH_ALIGN, make_unique ()); - kfm.add (BUILT_IN_STACK_RESTORE, make_unique ()); - kfm.add (BUILT_IN_STACK_SAVE, make_unique ()); + kfm.add (BUILT_IN_EXPECT, std::make_unique ()); + kfm.add (BUILT_IN_EXPECT_WITH_PROBABILITY, std::make_unique ()); + kfm.add (BUILT_IN_ALLOCA_WITH_ALIGN, std::make_unique ()); + kfm.add (BUILT_IN_STACK_RESTORE, std::make_unique ()); + kfm.add (BUILT_IN_STACK_SAVE, std::make_unique ()); register_atomic_builtins (kfm); register_sanitizer_builtins (kfm); @@ -2256,58 +2258,58 @@ register_known_functions (known_function_manager &kfm, /* Known builtins and C standard library functions the analyzer has known functions for. */ { - kfm.add ("alloca", make_unique ()); - kfm.add ("__builtin_alloca", make_unique ()); - kfm.add ("calloc", make_unique ()); - kfm.add ("__builtin_calloc", make_unique ()); - kfm.add ("free", make_unique ()); - kfm.add ("__builtin_free", make_unique ()); - kfm.add ("malloc", make_unique ()); - kfm.add ("__builtin_malloc", make_unique ()); + kfm.add ("alloca", std::make_unique ()); + kfm.add ("__builtin_alloca", std::make_unique ()); + kfm.add ("calloc", std::make_unique ()); + kfm.add ("__builtin_calloc", std::make_unique ()); + kfm.add ("free", std::make_unique ()); + kfm.add ("__builtin_free", std::make_unique ()); + kfm.add ("malloc", std::make_unique ()); + kfm.add ("__builtin_malloc", std::make_unique ()); kfm.add ("memcpy", - make_unique (kf_memcpy_memmove::KF_MEMCPY)); + std::make_unique (kf_memcpy_memmove::KF_MEMCPY)); kfm.add ("__builtin_memcpy", - make_unique (kf_memcpy_memmove::KF_MEMCPY)); - kfm.add ("__memcpy_chk", make_unique + std::make_unique (kf_memcpy_memmove::KF_MEMCPY)); + kfm.add ("__memcpy_chk", std::make_unique (kf_memcpy_memmove::KF_MEMCPY_CHK)); - kfm.add ("__builtin___memcpy_chk", make_unique + kfm.add ("__builtin___memcpy_chk", std::make_unique (kf_memcpy_memmove::KF_MEMCPY_CHK)); kfm.add ("memmove", - make_unique (kf_memcpy_memmove::KF_MEMMOVE)); + std::make_unique (kf_memcpy_memmove::KF_MEMMOVE)); kfm.add ("__builtin_memmove", - make_unique (kf_memcpy_memmove::KF_MEMMOVE)); - kfm.add ("__memmove_chk", make_unique + std::make_unique (kf_memcpy_memmove::KF_MEMMOVE)); + kfm.add ("__memmove_chk", std::make_unique (kf_memcpy_memmove::KF_MEMMOVE_CHK)); - kfm.add ("__builtin___memmove_chk", make_unique + kfm.add ("__builtin___memmove_chk", std::make_unique (kf_memcpy_memmove::KF_MEMMOVE_CHK)); - kfm.add ("memset", make_unique (false)); - kfm.add ("__builtin_memset", make_unique (false)); - kfm.add ("__memset_chk", make_unique (true)); - kfm.add ("__builtin___memset_chk", make_unique (true)); - kfm.add ("realloc", make_unique ()); - kfm.add ("__builtin_realloc", make_unique ()); - kfm.add ("sprintf", make_unique ()); - kfm.add ("__builtin_sprintf", make_unique ()); - kfm.add ("strchr", make_unique ()); - kfm.add ("__builtin_strchr", make_unique ()); - kfm.add ("strcpy", make_unique (2, false)); - kfm.add ("__builtin_strcpy", make_unique (2, false)); - kfm.add ("__strcpy_chk", make_unique (3, true)); - kfm.add ("__builtin___strcpy_chk", make_unique (3, true)); - kfm.add ("strcat", make_unique (2, false)); - kfm.add ("__builtin_strcat", make_unique (2, false)); - kfm.add ("__strcat_chk", make_unique (3, true)); - kfm.add ("__builtin___strcat_chk", make_unique (3, true)); - kfm.add ("strdup", make_unique ()); - kfm.add ("__builtin_strdup", make_unique ()); - kfm.add ("strncpy", make_unique ()); - kfm.add ("__builtin_strncpy", make_unique ()); - kfm.add ("strndup", make_unique ()); - kfm.add ("__builtin_strndup", make_unique ()); - kfm.add ("strlen", make_unique ()); - kfm.add ("__builtin_strlen", make_unique ()); - kfm.add ("strstr", make_unique ()); - kfm.add ("__builtin_strstr", make_unique ()); + kfm.add ("memset", std::make_unique (false)); + kfm.add ("__builtin_memset", std::make_unique (false)); + kfm.add ("__memset_chk", std::make_unique (true)); + kfm.add ("__builtin___memset_chk", std::make_unique (true)); + kfm.add ("realloc", std::make_unique ()); + kfm.add ("__builtin_realloc", std::make_unique ()); + kfm.add ("sprintf", std::make_unique ()); + kfm.add ("__builtin_sprintf", std::make_unique ()); + kfm.add ("strchr", std::make_unique ()); + kfm.add ("__builtin_strchr", std::make_unique ()); + kfm.add ("strcpy", std::make_unique (2, false)); + kfm.add ("__builtin_strcpy", std::make_unique (2, false)); + kfm.add ("__strcpy_chk", std::make_unique (3, true)); + kfm.add ("__builtin___strcpy_chk", std::make_unique (3, true)); + kfm.add ("strcat", std::make_unique (2, false)); + kfm.add ("__builtin_strcat", std::make_unique (2, false)); + kfm.add ("__strcat_chk", std::make_unique (3, true)); + kfm.add ("__builtin___strcat_chk", std::make_unique (3, true)); + kfm.add ("strdup", std::make_unique ()); + kfm.add ("__builtin_strdup", std::make_unique ()); + kfm.add ("strncpy", std::make_unique ()); + kfm.add ("__builtin_strncpy", std::make_unique ()); + kfm.add ("strndup", std::make_unique ()); + kfm.add ("__builtin_strndup", std::make_unique ()); + kfm.add ("strlen", std::make_unique ()); + kfm.add ("__builtin_strlen", std::make_unique ()); + kfm.add ("strstr", std::make_unique ()); + kfm.add ("__builtin_strstr", std::make_unique ()); register_atomic_builtins (kfm); register_varargs_builtins (kfm); @@ -2315,9 +2317,9 @@ register_known_functions (known_function_manager &kfm, /* Known POSIX functions, and some non-standard extensions. */ { - kfm.add ("fopen", make_unique ()); - kfm.add ("putenv", make_unique ()); - kfm.add ("strtok", make_unique (rmm)); + kfm.add ("fopen", std::make_unique ()); + kfm.add ("putenv", std::make_unique ()); + kfm.add ("strtok", std::make_unique (rmm)); register_known_fd_functions (kfm); register_known_file_functions (kfm); @@ -2325,13 +2327,13 @@ register_known_functions (known_function_manager &kfm, /* glibc functions. */ { - kfm.add ("__errno_location", make_unique ()); - kfm.add ("error", make_unique (3)); - kfm.add ("error_at_line", make_unique (5)); + kfm.add ("__errno_location", std::make_unique ()); + kfm.add ("error", std::make_unique (3)); + kfm.add ("error_at_line", std::make_unique (5)); /* Variants of "error" and "error_at_line" seen by the analyzer at -O0 (PR analyzer/115724). */ - kfm.add ("__error_alias", make_unique (3)); - kfm.add ("__error_at_line_alias", make_unique (5)); + kfm.add ("__error_alias", std::make_unique (3)); + kfm.add ("__error_at_line_alias", std::make_unique (5)); } /* Other implementations of C standard library. */ @@ -2345,9 +2347,9 @@ register_known_functions (known_function_manager &kfm, #define errno (*__error()) and similarly __errno for newlib. Add these as synonyms for "__errno_location". */ - kfm.add ("___errno", make_unique ()); - kfm.add ("__error", make_unique ()); - kfm.add ("__errno", make_unique ()); + kfm.add ("___errno", std::make_unique ()); + kfm.add ("__error", std::make_unique ()); + kfm.add ("__errno", std::make_unique ()); } /* Language-specific support functions. */ @@ -2357,22 +2359,22 @@ register_known_functions (known_function_manager &kfm, from etc for the C spellings of these headers (e.g. ), so we must match against these too. */ { - kfm.add_std_ns ("malloc", make_unique ()); - kfm.add_std_ns ("free", make_unique ()); - kfm.add_std_ns ("realloc", make_unique ()); - kfm.add_std_ns ("calloc", make_unique ()); + kfm.add_std_ns ("malloc", std::make_unique ()); + kfm.add_std_ns ("free", std::make_unique ()); + kfm.add_std_ns ("realloc", std::make_unique ()); + kfm.add_std_ns ("calloc", std::make_unique ()); kfm.add_std_ns ("memcpy", - make_unique (kf_memcpy_memmove::KF_MEMCPY)); + std::make_unique (kf_memcpy_memmove::KF_MEMCPY)); kfm.add_std_ns ("memmove", - make_unique (kf_memcpy_memmove::KF_MEMMOVE)); - kfm.add_std_ns ("memset", make_unique (false)); - kfm.add_std_ns ("strcat", make_unique (2, false)); - kfm.add_std_ns ("strcpy", make_unique (2, false)); - kfm.add_std_ns ("strlen", make_unique ()); - kfm.add_std_ns ("strncpy", make_unique ()); - kfm.add_std_ns ("strtok", make_unique (rmm)); + std::make_unique (kf_memcpy_memmove::KF_MEMMOVE)); + kfm.add_std_ns ("memset", std::make_unique (false)); + kfm.add_std_ns ("strcat", std::make_unique (2, false)); + kfm.add_std_ns ("strcpy", std::make_unique (2, false)); + kfm.add_std_ns ("strlen", std::make_unique ()); + kfm.add_std_ns ("strncpy", std::make_unique ()); + kfm.add_std_ns ("strtok", std::make_unique (rmm)); } } diff --git a/gcc/analyzer/pending-diagnostic.cc b/gcc/analyzer/pending-diagnostic.cc index 452453a7bd3..70dc8154d62 100644 --- a/gcc/analyzer/pending-diagnostic.cc +++ b/gcc/analyzer/pending-diagnostic.cc @@ -185,7 +185,7 @@ pending_diagnostic::add_function_entry_event (const exploded_edge &eedge, { const exploded_node *dst_node = eedge.m_dest; const program_point &dst_point = dst_node->get_point (); - emission_path->add_event (make_unique (dst_point)); + emission_path->add_event (std::make_unique (dst_point)); } /* Base implementation of pending_diagnostic::add_call_event. @@ -200,12 +200,12 @@ pending_diagnostic::add_call_event (const exploded_edge &eedge, const int src_stack_depth = src_point.get_stack_depth (); const gimple *last_stmt = src_point.get_supernode ()->get_last_stmt (); emission_path->add_event - (make_unique (eedge, - event_loc_info (last_stmt - ? last_stmt->location - : UNKNOWN_LOCATION, - src_point.get_fndecl (), - src_stack_depth))); + (std::make_unique (eedge, + event_loc_info (last_stmt + ? last_stmt->location + : UNKNOWN_LOCATION, + src_point.get_fndecl (), + src_stack_depth))); } /* Base implementation of pending_diagnostic::add_region_creation_events. @@ -218,12 +218,13 @@ pending_diagnostic::add_region_creation_events (const region *reg, checker_path &emission_path) { emission_path.add_event - (make_unique (reg->get_memory_space (), - loc_info)); + (std::make_unique + (reg->get_memory_space (), + loc_info)); if (capacity) emission_path.add_event - (make_unique (capacity, loc_info)); + (std::make_unique (capacity, loc_info)); } /* Base implementation of pending_diagnostic::add_final_event. @@ -237,7 +238,7 @@ pending_diagnostic::add_final_event (const state_machine *sm, checker_path *emission_path) { emission_path->add_event - (make_unique + (std::make_unique (loc_info, enode, sm, var, state)); diff --git a/gcc/analyzer/program-point.cc b/gcc/analyzer/program-point.cc index e72c2e27ec2..c95f8635e53 100644 --- a/gcc/analyzer/program-point.cc +++ b/gcc/analyzer/program-point.cc @@ -23,7 +23,6 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-event-id.h" #include "gcc-rich-location.h" #include "gimple-pretty-print.h" -#include "make-unique.h" #include "sbitmap.h" #include "selftest.h" #include "shortest-paths.h" @@ -303,7 +302,7 @@ program_point::dump () const std::unique_ptr program_point::to_json () const { - auto point_obj = ::make_unique (); + auto point_obj = std::make_unique (); point_obj->set_string ("kind", point_kind_to_string (get_kind ())); diff --git a/gcc/analyzer/program-state.cc b/gcc/analyzer/program-state.cc index 4d3fec0b960..dbca0369b9a 100644 --- a/gcc/analyzer/program-state.cc +++ b/gcc/analyzer/program-state.cc @@ -92,10 +92,10 @@ extrinsic_state::dump () const std::unique_ptr extrinsic_state::to_json () const { - auto ext_state_obj = ::make_unique (); + auto ext_state_obj = std::make_unique (); { - auto checkers_arr = ::make_unique (); + auto checkers_arr = std::make_unique (); for (auto &sm : m_checkers) checkers_arr->append (sm->to_json ()); ext_state_obj->set ("checkers", std::move (checkers_arr)); @@ -266,7 +266,7 @@ sm_state_map::dump (bool simple) const std::unique_ptr sm_state_map::to_json () const { - auto map_obj = ::make_unique (); + auto map_obj = std::make_unique (); if (m_global_state != m_sm.get_start_state ()) map_obj->set ("global", m_global_state->to_json ()); @@ -1175,7 +1175,7 @@ program_state::dump () const std::unique_ptr program_state::to_json (const extrinsic_state &ext_state) const { - auto state_obj = ::make_unique (); + auto state_obj = std::make_unique (); state_obj->set ("store", m_region_model->get_store ()->to_json ()); state_obj->set ("constraints", @@ -1186,7 +1186,7 @@ program_state::to_json (const extrinsic_state &ext_state) const /* Provide m_checker_states as an object, using names as keys. */ { - auto checkers_obj = ::make_unique (); + auto checkers_obj = std::make_unique (); int i; sm_state_map *smap; diff --git a/gcc/analyzer/ranges.cc b/gcc/analyzer/ranges.cc index 64e351f7aba..1a960fac7d9 100644 --- a/gcc/analyzer/ranges.cc +++ b/gcc/analyzer/ranges.cc @@ -136,7 +136,7 @@ symbolic_byte_range::dump (bool simple, region_model_manager &mgr) const std::unique_ptr symbolic_byte_range::to_json () const { - auto obj = ::make_unique (); + auto obj = std::make_unique (); obj->set ("start", m_start.to_json ()); obj->set ("size", m_size.to_json ()); return obj; diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index b65efadbe1a..ea0e6b0a518 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -217,7 +217,7 @@ region_to_value_map::dump (bool simple) const std::unique_ptr region_to_value_map::to_json () const { - auto map_obj = ::make_unique (); + auto map_obj = std::make_unique (); auto_vec regs; for (iterator iter = begin (); iter != end (); ++iter) @@ -497,7 +497,7 @@ region_model::debug () const std::unique_ptr region_model::to_json () const { - auto model_obj = ::make_unique (); + auto model_obj = std::make_unique (); model_obj->set ("store", m_store.to_json ()); model_obj->set ("constraints", m_constraints->to_json ()); if (m_current_frame) @@ -938,10 +938,10 @@ public: { if (reg == m_base_reg_a) emission_path.add_event - (make_unique (loc_info, true)); + (std::make_unique (loc_info, true)); else if (reg == m_base_reg_b) emission_path.add_event - (make_unique (loc_info, false)); + (std::make_unique (loc_info, false)); } bool @@ -991,11 +991,12 @@ check_for_invalid_ptrdiff (const gassign *assign, if (base_reg_b->get_kind () == RK_SYMBOLIC) return; - ctxt.warn (make_unique (assign, - sval_a, - sval_b, - base_reg_a, - base_reg_b)); + ctxt.warn + (std::make_unique (assign, + sval_a, + sval_b, + base_reg_a, + base_reg_b)); } /* If ASSIGN is a stmt that can be modelled via @@ -1174,13 +1175,13 @@ region_model::get_gassign_result (const gassign *assign, { if (tree_int_cst_sgn (rhs2_cst) < 0) ctxt->warn - (make_unique + (std::make_unique (assign, rhs2_cst)); else if (compare_tree_int (rhs2_cst, TYPE_PRECISION (TREE_TYPE (rhs1))) >= 0) ctxt->warn - (make_unique + (std::make_unique (assign, int (TYPE_PRECISION (TREE_TYPE (rhs1))), rhs2_cst)); @@ -1414,10 +1415,11 @@ region_model::check_for_poison (const svalue *sval, check_expr = expr; else check_expr = NULL; - if (ctxt->warn (make_unique (diag_arg, - pkind, - src_region, - check_expr))) + if (ctxt->warn + (std::make_unique (diag_arg, + pkind, + src_region, + check_expr))) { /* We only want to report use of a poisoned value at the first place it gets used; return an unknown value to avoid generating @@ -1680,7 +1682,7 @@ region_model::check_call_format_attr (const call_details &cd, }; call_arg_details arg_details (m_cd, m_fmt_param_idx); - add_note (make_unique (arg_details)); + add_note (std::make_unique (arg_details)); } private: const call_details &m_cd; @@ -2135,8 +2137,8 @@ region_model::check_function_attr_access (const gcall &call, } void add_annotations () final override { - add_note (make_unique - (m_callee_fndecl, m_access)); + add_note (std::make_unique + (m_callee_fndecl, m_access)); } private: tree m_callee_fndecl; @@ -3080,7 +3082,7 @@ region_model::deref_rvalue (const svalue *ptr_sval, tree ptr_tree, const poisoned_svalue *poisoned_sval = as_a (ptr_sval); enum poison_kind pkind = poisoned_sval->get_poison_kind (); - ctxt->warn (::make_unique + ctxt->warn (std::make_unique (ptr, pkind, nullptr, nullptr)); } } @@ -3251,16 +3253,18 @@ region_model::check_for_writable_region (const region* dest_reg, { const function_region *func_reg = as_a (base_reg); tree fndecl = func_reg->get_fndecl (); - ctxt->warn (make_unique - (func_reg, fndecl)); + ctxt->warn + (std::make_unique + (func_reg, fndecl)); } break; case RK_LABEL: { const label_region *label_reg = as_a (base_reg); tree label = label_reg->get_label (); - ctxt->warn (make_unique - (label_reg, label)); + ctxt->warn + (std::make_unique + (label_reg, label)); } break; case RK_DECL: @@ -3273,11 +3277,13 @@ region_model::check_for_writable_region (const region* dest_reg, "this" param is "T* const"). */ if (TREE_READONLY (decl) && is_global_var (decl)) - ctxt->warn (make_unique (dest_reg, decl)); + ctxt->warn + (std::make_unique (dest_reg, decl)); } break; case RK_STRING: - ctxt->warn (make_unique (dest_reg)); + ctxt->warn + (std::make_unique (dest_reg)); break; } } @@ -3479,7 +3485,8 @@ public: checker_path &emission_path) final override { emission_path.add_event - (make_unique (capacity, loc_info)); + (std::make_unique + (capacity, loc_info)); m_has_allocation_event = true; } @@ -3815,9 +3822,10 @@ region_model::check_region_size (const region *lhs_reg, const svalue *rhs_sval, if (TREE_CODE (cst_cap) == INTEGER_CST && !capacity_compatible_with_type (cst_cap, pointee_size_tree, is_struct)) - ctxt->warn (make_unique (lhs_reg, rhs_reg, - capacity, cst_cap, - ctxt->get_stmt ())); + ctxt->warn + (std::make_unique (lhs_reg, rhs_reg, + capacity, cst_cap, + ctxt->get_stmt ())); } break; default: @@ -3829,10 +3837,11 @@ region_model::check_region_size (const region *lhs_reg, const svalue *rhs_sval, m_constraints)) { tree expr = get_representative_tree (capacity); - ctxt->warn (make_unique (lhs_reg, - rhs_reg, - capacity, expr, - ctxt->get_stmt ())); + ctxt->warn + (std::make_unique (lhs_reg, + rhs_reg, + capacity, expr, + ctxt->get_stmt ())); } } break; @@ -4625,9 +4634,11 @@ region_model::check_for_null_terminated_string_arg (const call_details &cd, m_cd.get_model ()->get_current_function ()->decl, m_cd.get_model ()->get_stack_depth ()); - add_event (make_unique (loc_info, - arg_details)); - add_note (make_unique (arg_details)); + add_event + (std::make_unique (loc_info, + arg_details)); + add_note + (std::make_unique (arg_details)); } private: const call_details &m_cd; @@ -5373,7 +5384,7 @@ region_model::add_constraint (tree lhs, enum tree_code op, tree rhs, { bool sat = add_constraint (lhs, op, rhs, ctxt); if (!sat && out) - *out = make_unique (*this, lhs, op, rhs); + *out = std::make_unique (*this, lhs, op, rhs); return sat; } @@ -6144,7 +6155,7 @@ apply_constraints_for_gswitch (const switch_cfg_superedge &edge, && !ctxt->possibly_tainted_p (index_sval)) { if (out) - *out = make_unique (*this); + *out = std::make_unique (*this); return false; } @@ -6153,7 +6164,8 @@ apply_constraints_for_gswitch (const switch_cfg_superedge &edge, = ranges_mgr->get_or_create_ranges_for_switch (&edge, switch_stmt); bool sat = m_constraints->add_bounded_ranges (index_sval, all_cases_ranges); if (!sat && out) - *out = make_unique (*this, index, all_cases_ranges); + *out = std::make_unique + (*this, index, all_cases_ranges); if (sat && ctxt && !all_cases_ranges->empty_p ()) ctxt->on_bounded_ranges (*index_sval, *all_cases_ranges); return sat; @@ -6370,7 +6382,7 @@ public: {} std::unique_ptr clone () const override { - return ::make_unique (m_call_stmt, m_caller_frame); + return std::make_unique (m_call_stmt, m_caller_frame); } const gimple *find_stmt (const exploded_path &) override { @@ -6813,7 +6825,7 @@ region_model::check_dynamic_size_for_floats (const svalue *size_in_bytes, if (const svalue *float_sval = v.get_svalue_to_report ()) { tree diag_arg = get_representative_tree (float_sval); - ctxt->warn (make_unique (diag_arg)); + ctxt->warn (std::make_unique (diag_arg)); } } @@ -7159,8 +7171,7 @@ private: tree type = m_copied_sval->get_type (); if (type && TREE_CODE (type) == RECORD_TYPE) { - // (std::make_unique is C++14) - layout = std::unique_ptr (new record_layout (type)); + layout = std::make_unique (type); if (0) layout->dump (); @@ -7385,9 +7396,10 @@ region_model::maybe_complain_about_infoleak (const region *dst_reg, { /* Check for exposure. */ if (contains_uninit_p (copied_sval)) - ctxt->warn (make_unique (src_reg, - dst_reg, - copied_sval)); + ctxt->warn + (std::make_unique (src_reg, + dst_reg, + copied_sval)); } /* Set errno to a positive symbolic int, as if some error has occurred. */ diff --git a/gcc/analyzer/region.cc b/gcc/analyzer/region.cc index bfbcf2d85fb..4e56cd569d3 100644 --- a/gcc/analyzer/region.cc +++ b/gcc/analyzer/region.cc @@ -27,7 +27,6 @@ along with GCC; see the file COPYING3. If not see #include "digraph.h" #include "sbitmap.h" #include "fold-const.h" -#include "make-unique.h" #include "analyzer/analyzer-logging.h" #include "analyzer/supergraph.h" @@ -1019,7 +1018,7 @@ std::unique_ptr region::to_json () const { label_text desc = get_desc (true); - auto reg_js = ::make_unique (desc.get ()); + auto reg_js = std::make_unique (desc.get ()); return reg_js; } diff --git a/gcc/analyzer/sm-fd.cc b/gcc/analyzer/sm-fd.cc index dd9ae93ad60..cee8d2d7670 100644 --- a/gcc/analyzer/sm-fd.cc +++ b/gcc/analyzer/sm-fd.cc @@ -1438,7 +1438,7 @@ fd_state_machine::check_for_fd_attrs ( { sm_ctxt.warn (node, stmt, arg, - make_unique + std::make_unique (*this, diag_arg, fndecl, attr_name, arg_idx)); @@ -1450,7 +1450,7 @@ fd_state_machine::check_for_fd_attrs ( if (!is_constant_fd_p (state)) { sm_ctxt.warn (node, stmt, arg, - make_unique + std::make_unique (*this, diag_arg, fndecl, attr_name, arg_idx)); @@ -1466,13 +1466,13 @@ fd_state_machine::check_for_fd_attrs ( if (is_writeonly_fd_p (state)) { - sm_ctxt.warn ( - node, stmt, arg, - make_unique (*this, diag_arg, - DIRS_WRITE, - fndecl, - attr_name, - arg_idx)); + sm_ctxt.warn + (node, stmt, arg, + std::make_unique (*this, diag_arg, + DIRS_WRITE, + fndecl, + attr_name, + arg_idx)); } break; @@ -1480,13 +1480,13 @@ fd_state_machine::check_for_fd_attrs ( if (is_readonly_fd_p (state)) { - sm_ctxt.warn ( - node, stmt, arg, - make_unique (*this, diag_arg, - DIRS_READ, - fndecl, - attr_name, - arg_idx)); + sm_ctxt.warn + (node, stmt, arg, + std::make_unique (*this, diag_arg, + DIRS_READ, + fndecl, + attr_name, + arg_idx)); } break; @@ -1528,7 +1528,7 @@ fd_state_machine::on_open (sm_context &sm_ctxt, const supernode *node, else { sm_ctxt.warn (node, stmt, NULL_TREE, - make_unique (*this, NULL_TREE)); + std::make_unique (*this, NULL_TREE)); } } @@ -1541,7 +1541,7 @@ fd_state_machine::on_creat (sm_context &sm_ctxt, const supernode *node, sm_ctxt.on_transition (node, stmt, lhs, m_start, m_unchecked_write_only); else sm_ctxt.warn (node, stmt, NULL_TREE, - make_unique (*this, NULL_TREE)); + std::make_unique (*this, NULL_TREE)); } void @@ -1587,8 +1587,8 @@ fd_state_machine::check_for_dup (sm_context &sm_ctxt, const supernode *node, { sm_ctxt.warn ( node, stmt, arg_2, - make_unique (*this, diag_arg_2, - callee_fndecl)); + std::make_unique (*this, diag_arg_2, + callee_fndecl)); return; } /* dup2 returns value of its second argument on success.But, the @@ -1635,7 +1635,7 @@ fd_state_machine::on_close (sm_context &sm_ctxt, const supernode *node, if (is_closed_fd_p (state)) { sm_ctxt.warn (node, stmt, arg, - make_unique (*this, diag_arg)); + std::make_unique (*this, diag_arg)); sm_ctxt.set_next_state (stmt, arg, m_stop); } } @@ -1667,8 +1667,8 @@ fd_state_machine::check_for_open_fd ( if (is_closed_fd_p (state)) { sm_ctxt.warn (node, stmt, arg, - make_unique (*this, diag_arg, - callee_fndecl)); + std::make_unique (*this, diag_arg, + callee_fndecl)); } else @@ -1679,10 +1679,10 @@ fd_state_machine::check_for_open_fd ( /* Complain about fncall on socket in wrong phase. */ sm_ctxt.warn (node, stmt, arg, - make_unique (*this, diag_arg, - callee_fndecl, - state, - EXPECTED_PHASE_CAN_TRANSFER)); + std::make_unique (*this, diag_arg, + callee_fndecl, + state, + EXPECTED_PHASE_CAN_TRANSFER)); else if (!(is_valid_fd_p (state) || state == m_new_datagram_socket || state == m_bound_unknown_socket @@ -1693,8 +1693,8 @@ fd_state_machine::check_for_open_fd ( if (!is_constant_fd_p (state)) sm_ctxt.warn ( node, stmt, arg, - make_unique (*this, diag_arg, - callee_fndecl)); + std::make_unique (*this, diag_arg, + callee_fndecl)); } switch (callee_fndecl_dir) { @@ -1705,8 +1705,8 @@ fd_state_machine::check_for_open_fd ( { tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, stmt, arg, - make_unique ( - *this, diag_arg, DIRS_WRITE, callee_fndecl)); + std::make_unique + (*this, diag_arg, DIRS_WRITE, callee_fndecl)); } break; @@ -1716,8 +1716,8 @@ fd_state_machine::check_for_open_fd ( { tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, stmt, arg, - make_unique ( - *this, diag_arg, DIRS_READ, callee_fndecl)); + std::make_unique + (*this, diag_arg, DIRS_READ, callee_fndecl)); } break; } @@ -1792,7 +1792,7 @@ fd_state_machine::on_socket (const call_details &cd, } else sm_ctxt.warn (node, &call, NULL_TREE, - make_unique (*this, NULL_TREE)); + std::make_unique (*this, NULL_TREE)); } else { @@ -1829,8 +1829,8 @@ fd_state_machine::check_for_socket_fd (const call_details &cd, tree diag_arg = sm_ctxt.get_diagnostic_tree (fd_sval); sm_ctxt.warn (node, &call, fd_sval, - make_unique (*this, diag_arg, - cd.get_fndecl_for_call ())); + std::make_unique (*this, diag_arg, + cd.get_fndecl_for_call ())); if (complained) *complained = true; if (successful) @@ -1842,10 +1842,10 @@ fd_state_machine::check_for_socket_fd (const call_details &cd, tree diag_arg = sm_ctxt.get_diagnostic_tree (fd_sval); sm_ctxt.warn (node, &call, fd_sval, - make_unique (*this, diag_arg, - cd.get_fndecl_for_call (), - old_state, - EXPECTED_TYPE_SOCKET)); + std::make_unique (*this, diag_arg, + cd.get_fndecl_for_call (), + old_state, + EXPECTED_TYPE_SOCKET)); if (complained) *complained = true; if (successful) @@ -1856,8 +1856,8 @@ fd_state_machine::check_for_socket_fd (const call_details &cd, tree diag_arg = sm_ctxt.get_diagnostic_tree (fd_sval); sm_ctxt.warn (node, &call, fd_sval, - make_unique (*this, diag_arg, - cd.get_fndecl_for_call ())); + std::make_unique (*this, diag_arg, + cd.get_fndecl_for_call ())); if (complained) *complained = true; if (successful) @@ -1919,10 +1919,10 @@ fd_state_machine::check_for_new_socket_fd (const call_details &cd, tree diag_arg = sm_ctxt.get_diagnostic_tree (fd_sval); sm_ctxt.warn (node, &cd.get_call_stmt (), fd_sval, - make_unique (*this, diag_arg, - cd.get_fndecl_for_call (), - old_state, - expected_phase)); + std::make_unique (*this, diag_arg, + cd.get_fndecl_for_call (), + old_state, + expected_phase)); if (successful) return false; } @@ -2029,17 +2029,17 @@ fd_state_machine::on_listen (const call_details &cd, if (is_stream_socket_fd_p (old_state)) sm_ctxt.warn (node, &call, fd_sval, - make_unique (*this, diag_arg, - cd.get_fndecl_for_call (), - old_state, - EXPECTED_PHASE_CAN_LISTEN)); + std::make_unique (*this, diag_arg, + cd.get_fndecl_for_call (), + old_state, + EXPECTED_PHASE_CAN_LISTEN)); else sm_ctxt.warn (node, &call, fd_sval, - make_unique (*this, diag_arg, - cd.get_fndecl_for_call (), - old_state, - EXPECTED_TYPE_STREAM_SOCKET)); + std::make_unique (*this, diag_arg, + cd.get_fndecl_for_call (), + old_state, + EXPECTED_TYPE_STREAM_SOCKET)); if (successful) return false; } @@ -2150,17 +2150,17 @@ fd_state_machine::on_accept (const call_details &cd, if (is_stream_socket_fd_p (old_state)) sm_ctxt.warn (node, &call, fd_sval, - make_unique (*this, diag_arg, - cd.get_fndecl_for_call (), - old_state, - EXPECTED_PHASE_CAN_ACCEPT)); + std::make_unique (*this, diag_arg, + cd.get_fndecl_for_call (), + old_state, + EXPECTED_PHASE_CAN_ACCEPT)); else sm_ctxt.warn (node, &call, fd_sval, - make_unique (*this, diag_arg, - cd.get_fndecl_for_call (), - old_state, - EXPECTED_TYPE_STREAM_SOCKET)); + std::make_unique (*this, diag_arg, + cd.get_fndecl_for_call (), + old_state, + EXPECTED_TYPE_STREAM_SOCKET)); if (successful) return false; } @@ -2185,7 +2185,7 @@ fd_state_machine::on_accept (const call_details &cd, } else sm_ctxt.warn (node, &call, NULL_TREE, - make_unique (*this, NULL_TREE)); + std::make_unique (*this, NULL_TREE)); } else { @@ -2323,7 +2323,7 @@ fd_state_machine::can_purge_p (state_t s) const std::unique_ptr fd_state_machine::on_leak (tree var) const { - return make_unique (*this, var); + return std::make_unique (*this, var); } } // namespace @@ -2415,8 +2415,10 @@ public: { if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd, false)); - cd.get_ctxt ()->bifurcate (make_unique (cd, true)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, false)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, true)); cd.get_ctxt ()->terminate_path (); } } @@ -2467,8 +2469,10 @@ public: { if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd, false)); - cd.get_ctxt ()->bifurcate (make_unique (cd, true)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, false)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, true)); cd.get_ctxt ()->terminate_path (); } } @@ -2519,8 +2523,10 @@ class kf_listen : public known_function { if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd, false)); - cd.get_ctxt ()->bifurcate (make_unique (cd, true)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, false)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, true)); cd.get_ctxt ()->terminate_path (); } } @@ -2573,8 +2579,10 @@ class kf_accept : public known_function { if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd, false)); - cd.get_ctxt ()->bifurcate (make_unique (cd, true)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, false)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, true)); cd.get_ctxt ()->terminate_path (); } } @@ -2627,8 +2635,10 @@ public: { if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd, false)); - cd.get_ctxt ()->bifurcate (make_unique (cd, true)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, false)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, true)); cd.get_ctxt ()->terminate_path (); } } @@ -2705,8 +2715,10 @@ public: { if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd, false)); - cd.get_ctxt ()->bifurcate (make_unique (cd, true)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, false)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd, true)); cd.get_ctxt ()->terminate_path (); } } @@ -2788,8 +2800,10 @@ public: { if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd)); - cd.get_ctxt ()->bifurcate (make_unique (cd)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd)); + cd.get_ctxt ()->bifurcate + (std::make_unique (cd)); cd.get_ctxt ()->terminate_path (); } } @@ -2837,15 +2851,15 @@ public: void register_known_fd_functions (known_function_manager &kfm) { - kfm.add ("accept", make_unique ()); - kfm.add ("bind", make_unique ()); - kfm.add ("connect", make_unique ()); - kfm.add ("isatty", make_unique ()); - kfm.add ("listen", make_unique ()); - kfm.add ("pipe", make_unique (1)); - kfm.add ("pipe2", make_unique (2)); - kfm.add ("read", make_unique ()); - kfm.add ("socket", make_unique ()); + kfm.add ("accept", std::make_unique ()); + kfm.add ("bind", std::make_unique ()); + kfm.add ("connect", std::make_unique ()); + kfm.add ("isatty", std::make_unique ()); + kfm.add ("listen", std::make_unique ()); + kfm.add ("pipe", std::make_unique (1)); + kfm.add ("pipe2", std::make_unique (2)); + kfm.add ("read", std::make_unique ()); + kfm.add ("socket", std::make_unique ()); } } // namespace ana diff --git a/gcc/analyzer/sm-file.cc b/gcc/analyzer/sm-file.cc index 319ac01b218..d7dbe2fe7b6 100644 --- a/gcc/analyzer/sm-file.cc +++ b/gcc/analyzer/sm-file.cc @@ -423,7 +423,8 @@ fileptr_state_machine::on_stmt (sm_context &sm_ctxt, { tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, stmt, arg, - make_unique (*this, diag_arg)); + std::make_unique (*this, + diag_arg)); sm_ctxt.set_next_state (stmt, arg, m_stop); } return true; @@ -493,7 +494,7 @@ fileptr_state_machine::can_purge_p (state_t s) const std::unique_ptr fileptr_state_machine::on_leak (tree var) const { - return make_unique (*this, var); + return std::make_unique (*this, var); } } // anonymous namespace @@ -645,40 +646,40 @@ public: void register_known_file_functions (known_function_manager &kfm) { - kfm.add (BUILT_IN_FPRINTF, make_unique ()); - kfm.add (BUILT_IN_FPRINTF_UNLOCKED, make_unique ()); - kfm.add (BUILT_IN_FPUTC, make_unique ()); - kfm.add (BUILT_IN_FPUTC_UNLOCKED, make_unique ()); - kfm.add (BUILT_IN_FPUTS, make_unique ()); - kfm.add (BUILT_IN_FPUTS_UNLOCKED, make_unique ()); - kfm.add (BUILT_IN_FWRITE, make_unique ()); - kfm.add (BUILT_IN_FWRITE_UNLOCKED, make_unique ()); - kfm.add (BUILT_IN_PRINTF, make_unique ()); - kfm.add (BUILT_IN_PRINTF_UNLOCKED, make_unique ()); - kfm.add (BUILT_IN_PUTC, make_unique ()); - kfm.add (BUILT_IN_PUTCHAR, make_unique ()); - kfm.add (BUILT_IN_PUTCHAR_UNLOCKED, make_unique ()); - kfm.add (BUILT_IN_PUTC_UNLOCKED, make_unique ()); - kfm.add (BUILT_IN_PUTS, make_unique ()); - kfm.add (BUILT_IN_PUTS_UNLOCKED, make_unique ()); - kfm.add (BUILT_IN_VFPRINTF, make_unique ()); - kfm.add (BUILT_IN_VPRINTF, make_unique ()); - - kfm.add ("ferror", make_unique ()); - kfm.add ("fgets", make_unique ()); - kfm.add ("fgets_unlocked", make_unique ()); // non-standard - kfm.add ("fileno", make_unique ()); - kfm.add ("fread", make_unique ()); - kfm.add ("getc", make_unique ()); - kfm.add ("getchar", make_unique ()); + kfm.add (BUILT_IN_FPRINTF, std::make_unique ()); + kfm.add (BUILT_IN_FPRINTF_UNLOCKED, std::make_unique ()); + kfm.add (BUILT_IN_FPUTC, std::make_unique ()); + kfm.add (BUILT_IN_FPUTC_UNLOCKED, std::make_unique ()); + kfm.add (BUILT_IN_FPUTS, std::make_unique ()); + kfm.add (BUILT_IN_FPUTS_UNLOCKED, std::make_unique ()); + kfm.add (BUILT_IN_FWRITE, std::make_unique ()); + kfm.add (BUILT_IN_FWRITE_UNLOCKED, std::make_unique ()); + kfm.add (BUILT_IN_PRINTF, std::make_unique ()); + kfm.add (BUILT_IN_PRINTF_UNLOCKED, std::make_unique ()); + kfm.add (BUILT_IN_PUTC, std::make_unique ()); + kfm.add (BUILT_IN_PUTCHAR, std::make_unique ()); + kfm.add (BUILT_IN_PUTCHAR_UNLOCKED, std::make_unique ()); + kfm.add (BUILT_IN_PUTC_UNLOCKED, std::make_unique ()); + kfm.add (BUILT_IN_PUTS, std::make_unique ()); + kfm.add (BUILT_IN_PUTS_UNLOCKED, std::make_unique ()); + kfm.add (BUILT_IN_VFPRINTF, std::make_unique ()); + kfm.add (BUILT_IN_VPRINTF, std::make_unique ()); + + kfm.add ("ferror", std::make_unique ()); + kfm.add ("fgets", std::make_unique ()); + kfm.add ("fgets_unlocked", std::make_unique ()); // non-standard + kfm.add ("fileno", std::make_unique ()); + kfm.add ("fread", std::make_unique ()); + kfm.add ("getc", std::make_unique ()); + kfm.add ("getchar", std::make_unique ()); /* Some C++ implementations use the std:: copies of these functions from for , so we must match against these too. */ - kfm.add_std_ns ("ferror", make_unique ()); - kfm.add_std_ns ("fgets", make_unique ()); - kfm.add_std_ns ("fread", make_unique ()); - kfm.add_std_ns ("getc", make_unique ()); - kfm.add_std_ns ("getchar", make_unique ()); + kfm.add_std_ns ("ferror", std::make_unique ()); + kfm.add_std_ns ("fgets", std::make_unique ()); + kfm.add_std_ns ("fread", std::make_unique ()); + kfm.add_std_ns ("getc", std::make_unique ()); + kfm.add_std_ns ("getchar", std::make_unique ()); } #if CHECKING_P diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc index ad7974e2d3b..01862686d58 100644 --- a/gcc/analyzer/sm-malloc.cc +++ b/gcc/analyzer/sm-malloc.cc @@ -2018,9 +2018,10 @@ malloc_state_machine::handle_nonnull (sm_context &sm_ctxt, if (unchecked_p (state)) { tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); - sm_ctxt.warn (node, stmt, arg, - make_unique (*this, diag_arg, fndecl, - i)); + sm_ctxt.warn + (node, stmt, arg, + std::make_unique (*this, diag_arg, fndecl, + i)); const allocation_state *astate = as_a_allocation_state (state); sm_ctxt.set_next_state (stmt, arg, astate->get_nonnull ()); @@ -2029,7 +2030,7 @@ malloc_state_machine::handle_nonnull (sm_context &sm_ctxt, { tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, stmt, arg, - make_unique (*this, diag_arg, fndecl, i)); + std::make_unique (*this, diag_arg, fndecl, i)); sm_ctxt.set_next_state (stmt, arg, m_stop); } else if (state == m_start) @@ -2251,8 +2252,8 @@ malloc_state_machine::on_stmt (sm_context &sm_ctxt, { tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, stmt, arg, - make_unique (*this, - diag_arg)); + std::make_unique (*this, + diag_arg)); const allocation_state *astate = as_a_allocation_state (state); sm_ctxt.set_next_state (stmt, arg, astate->get_nonnull ()); } @@ -2260,7 +2261,7 @@ malloc_state_machine::on_stmt (sm_context &sm_ctxt, { tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, stmt, arg, - make_unique (*this, diag_arg)); + std::make_unique (*this, diag_arg)); sm_ctxt.set_next_state (stmt, arg, m_stop); } else if (freed_p (state)) @@ -2268,7 +2269,7 @@ malloc_state_machine::on_stmt (sm_context &sm_ctxt, tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); const allocation_state *astate = as_a_allocation_state (state); sm_ctxt.warn (node, stmt, arg, - make_unique + std::make_unique (*this, diag_arg, astate->m_deallocator)); sm_ctxt.set_next_state (stmt, arg, m_stop); } @@ -2330,7 +2331,7 @@ maybe_complain_about_deref_before_check (sm_context &sm_ctxt, if (diag_ptr) sm_ctxt.warn (node, stmt, ptr, - make_unique (*this, diag_ptr)); + std::make_unique (*this, diag_ptr)); sm_ctxt.set_next_state (stmt, ptr, m_stop); } @@ -2378,7 +2379,7 @@ malloc_state_machine::handle_free_of_non_heap (sm_context &sm_ctxt, freed_reg = old_model->deref_rvalue (ptr_sval, arg, NULL); } sm_ctxt.warn (node, &call, arg, - make_unique + std::make_unique (*this, diag_arg, freed_reg, d->m_name)); sm_ctxt.set_next_state (&call, arg, m_stop); } @@ -2408,7 +2409,7 @@ malloc_state_machine::on_deallocator_call (sm_context &sm_ctxt, /* Wrong allocator. */ tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, &call, arg, - make_unique + std::make_unique (*this, diag_arg, astate->m_deallocators, d)); @@ -2423,7 +2424,7 @@ malloc_state_machine::on_deallocator_call (sm_context &sm_ctxt, /* freed -> stop, with warning. */ tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, &call, arg, - make_unique (*this, diag_arg, d->m_name)); + std::make_unique (*this, diag_arg, d->m_name)); sm_ctxt.set_next_state (&call, arg, m_stop); } else if (state == m_non_heap) @@ -2462,7 +2463,7 @@ malloc_state_machine::on_realloc_call (sm_context &sm_ctxt, /* Wrong allocator. */ tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, &call, arg, - make_unique + std::make_unique (*this, diag_arg, astate->m_deallocators, d)); sm_ctxt.set_next_state (&call, arg, m_stop); @@ -2475,7 +2476,7 @@ malloc_state_machine::on_realloc_call (sm_context &sm_ctxt, /* freed -> stop, with warning. */ tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, &call, arg, - make_unique (*this, diag_arg, "free")); + std::make_unique (*this, diag_arg, "free")); sm_ctxt.set_next_state (&call, arg, m_stop); if (path_context *path_ctxt = sm_ctxt.get_path_context ()) path_ctxt->terminate_path (); @@ -2585,7 +2586,7 @@ malloc_state_machine::can_purge_p (state_t s) const std::unique_ptr malloc_state_machine::on_leak (tree var) const { - return make_unique (*this, var); + return std::make_unique (*this, var); } /* Implementation of state_machine::reset_when_passed_to_unknown_fn_p vfunc diff --git a/gcc/analyzer/sm-pattern-test.cc b/gcc/analyzer/sm-pattern-test.cc index f24e8df4743..f05ffe02451 100644 --- a/gcc/analyzer/sm-pattern-test.cc +++ b/gcc/analyzer/sm-pattern-test.cc @@ -132,7 +132,7 @@ pattern_test_state_machine::on_condition (sm_context &sm_ctxt, if (tree lhs_expr = sm_ctxt.get_diagnostic_tree (lhs)) { sm_ctxt.warn (node, stmt, lhs_expr, - make_unique (lhs_expr, op, rhs_cst)); + std::make_unique (lhs_expr, op, rhs_cst)); } } diff --git a/gcc/analyzer/sm-sensitive.cc b/gcc/analyzer/sm-sensitive.cc index 385573b178c..7bd5ef68103 100644 --- a/gcc/analyzer/sm-sensitive.cc +++ b/gcc/analyzer/sm-sensitive.cc @@ -187,8 +187,8 @@ sensitive_state_machine::warn_for_any_exposure (sm_context &sm_ctxt, { tree diag_arg = sm_ctxt.get_diagnostic_tree (arg); sm_ctxt.warn (node, stmt, arg, - make_unique (*this, - diag_arg)); + std::make_unique (*this, + diag_arg)); } } diff --git a/gcc/analyzer/sm-signal.cc b/gcc/analyzer/sm-signal.cc index 2521c7c29ea..bbd7d70a7bd 100644 --- a/gcc/analyzer/sm-signal.cc +++ b/gcc/analyzer/sm-signal.cc @@ -225,10 +225,10 @@ public: const final override { emission_path->add_event - (make_unique - (event_loc_info (UNKNOWN_LOCATION, NULL_TREE, 0), - "later on," - " when the signal is delivered to the process")); + (std::make_unique + (event_loc_info (UNKNOWN_LOCATION, NULL_TREE, 0), + "later on," + " when the signal is delivered to the process")); } }; @@ -271,7 +271,7 @@ public: if (dst_enode) eg->add_edge (src_enode, dst_enode, NULL, /*state_change (),*/ true, /* assume does work */ - make_unique ()); + std::make_unique ()); } const signal_state_machine &m_sm; @@ -352,7 +352,7 @@ signal_state_machine::on_stmt (sm_context &sm_ctxt, if (signal_unsafe_p (callee_fndecl)) if (sm_ctxt.get_global_state () == m_in_signal_handler) sm_ctxt.warn (node, stmt, NULL_TREE, - make_unique + std::make_unique (*this, *call, callee_fndecl)); } diff --git a/gcc/analyzer/sm-taint.cc b/gcc/analyzer/sm-taint.cc index 21ce68ed716..e782081ac2d 100644 --- a/gcc/analyzer/sm-taint.cc +++ b/gcc/analyzer/sm-taint.cc @@ -1113,8 +1113,8 @@ taint_state_machine::on_stmt (sm_context &sm_ctxt, && sm_ctxt.get_global_state () == m_tainted_control_flow) { sm_ctxt.warn (node, call, NULL_TREE, - make_unique (*this, NULL_TREE, - callee_fndecl)); + std::make_unique (*this, NULL_TREE, + callee_fndecl)); } } // TODO: ...etc; many other sources of untrusted data @@ -1464,7 +1464,7 @@ taint_state_machine::check_for_tainted_size_arg (sm_context &sm_ctxt, TREE_STRING_POINTER (access->to_external_string ()); tree diag_size = sm_ctxt.get_diagnostic_tree (size_arg); sm_ctxt.warn (node, &call, size_arg, - make_unique + std::make_unique (*this, diag_size, b, callee_fndecl, access->sizarg, @@ -1508,8 +1508,9 @@ taint_state_machine::check_for_tainted_divisor (sm_context &sm_ctxt, return; tree diag_divisor = sm_ctxt.get_diagnostic_tree (divisor_expr); - sm_ctxt.warn (node, assign, divisor_expr, - make_unique (*this, diag_divisor, b)); + sm_ctxt.warn + (node, assign, divisor_expr, + std::make_unique (*this, diag_divisor, b)); sm_ctxt.set_next_state (assign, divisor_sval, m_stop); } } @@ -1672,8 +1673,8 @@ region_model::check_region_for_taint (const region *reg, if (index_can_be_out_of_bounds_p (element_reg)) { tree arg = get_representative_tree (index); - ctxt->warn (make_unique (taint_sm, - arg, b)); + ctxt->warn (std::make_unique (taint_sm, + arg, b)); } else if (ctxt->get_logger ()) ctxt->get_logger ()->log ("rejecting tainted_array_index as" @@ -1699,8 +1700,8 @@ region_model::check_region_for_taint (const region *reg, if (taint_sm.get_taint (state, effective_type, &b)) { tree arg = get_representative_tree (offset); - ctxt->warn (make_unique (taint_sm, arg, b, - offset)); + ctxt->warn (std::make_unique (taint_sm, arg, b, + offset)); } } break; @@ -1717,7 +1718,7 @@ region_model::check_region_for_taint (const region *reg, if (taint_sm.get_taint (state, size_sval->get_type (), &b)) { tree arg = get_representative_tree (size_sval); - ctxt->warn (make_unique (taint_sm, arg, b)); + ctxt->warn (std::make_unique (taint_sm, arg, b)); } } break; @@ -1763,7 +1764,7 @@ region_model::check_dynamic_size_for_taint (enum memory_space mem_space, if (taint_sm.get_taint (state, size_in_bytes->get_type (), &b)) { tree arg = get_representative_tree (size_in_bytes); - ctxt->warn (make_unique + ctxt->warn (std::make_unique (taint_sm, arg, size_in_bytes, b, mem_space)); } } diff --git a/gcc/analyzer/sm.cc b/gcc/analyzer/sm.cc index 4328e3c7e2d..0abbdd69adf 100644 --- a/gcc/analyzer/sm.cc +++ b/gcc/analyzer/sm.cc @@ -72,7 +72,7 @@ state_machine::state::to_json () const pretty_printer pp; pp_format_decoder (&pp) = default_tree_printer; dump_to_pp (&pp); - return ::make_unique (pp_formatted_text (&pp)); + return std::make_unique (pp_formatted_text (&pp)); } /* class state_machine. */ @@ -143,11 +143,11 @@ state_machine::dump_to_pp (pretty_printer *pp) const std::unique_ptr state_machine::to_json () const { - auto sm_obj = ::make_unique (); + auto sm_obj = std::make_unique (); sm_obj->set_string ("name", m_name); { - auto states_arr = ::make_unique (); + auto states_arr = std::make_unique (); unsigned i; state *s; FOR_EACH_VEC_ELT (m_states, i, s) diff --git a/gcc/analyzer/store.cc b/gcc/analyzer/store.cc index 6716aaf2591..e6723c7ffc9 100644 --- a/gcc/analyzer/store.cc +++ b/gcc/analyzer/store.cc @@ -213,7 +213,7 @@ bit_range::dump () const std::unique_ptr bit_range::to_json () const { - auto obj = ::make_unique (); + auto obj = std::make_unique (); obj->set ("start_bit_offset", bit_offset_to_json (m_start_bit_offset)); obj->set ("size_in_bits", @@ -487,7 +487,7 @@ byte_range::dump () const std::unique_ptr byte_range::to_json () const { - auto obj = ::make_unique (); + auto obj = std::make_unique (); obj->set ("start_byte_offset", byte_offset_to_json (m_start_byte_offset)); obj->set ("size_in_bytes", @@ -752,7 +752,7 @@ binding_map::dump (bool simple) const std::unique_ptr binding_map::to_json () const { - auto map_obj = ::make_unique (); + auto map_obj = std::make_unique (); auto_vec binding_keys; for (map_t::iterator iter = m_map.begin (); @@ -1434,7 +1434,7 @@ binding_cluster::validate () const std::unique_ptr binding_cluster::to_json () const { - auto cluster_obj = ::make_unique (); + auto cluster_obj = std::make_unique (); cluster_obj->set_bool ("escaped", m_escaped); cluster_obj->set_bool ("touched", m_touched); @@ -2651,7 +2651,7 @@ store::validate () const std::unique_ptr store::to_json () const { - auto store_obj = ::make_unique (); + auto store_obj = std::make_unique (); /* Sort into some deterministic order. */ auto_vec base_regions; @@ -2674,7 +2674,7 @@ store::to_json () const { gcc_assert (parent_reg); - auto clusters_in_parent_reg_obj = ::make_unique (); + auto clusters_in_parent_reg_obj = std::make_unique (); const region *base_reg; unsigned j; diff --git a/gcc/analyzer/supergraph.cc b/gcc/analyzer/supergraph.cc index 67c676f17e9..f4823c620b7 100644 --- a/gcc/analyzer/supergraph.cc +++ b/gcc/analyzer/supergraph.cc @@ -444,11 +444,11 @@ supergraph::dump_dot (const char *path, const dump_args_t &dump_args) const std::unique_ptr supergraph::to_json () const { - auto sgraph_obj = ::make_unique (); + auto sgraph_obj = std::make_unique (); /* Nodes. */ { - auto nodes_arr = ::make_unique (); + auto nodes_arr = std::make_unique (); unsigned i; supernode *n; FOR_EACH_VEC_ELT (m_nodes, i, n) @@ -458,7 +458,7 @@ supergraph::to_json () const /* Edges. */ { - auto edges_arr = ::make_unique (); + auto edges_arr = std::make_unique (); unsigned i; superedge *n; FOR_EACH_VEC_ELT (m_edges, i, n) @@ -699,7 +699,7 @@ supernode::dump_dot_id (pretty_printer *pp) const std::unique_ptr supernode::to_json () const { - auto snode_obj = ::make_unique (); + auto snode_obj = std::make_unique (); snode_obj->set_integer ("idx", m_index); snode_obj->set_integer ("bb_idx", m_bb->index); @@ -716,7 +716,7 @@ supernode::to_json () const /* Phi nodes. */ { - auto phi_arr = ::make_unique (); + auto phi_arr = std::make_unique (); for (gphi_iterator gpi = const_cast (this)->start_phis (); !gsi_end_p (gpi); gsi_next (&gpi)) { @@ -731,7 +731,7 @@ supernode::to_json () const /* Statements. */ { - auto stmt_arr = ::make_unique (); + auto stmt_arr = std::make_unique (); int i; gimple *stmt; FOR_EACH_VEC_ELT (m_stmts, i, stmt) @@ -962,7 +962,7 @@ superedge::dump_dot (graphviz_out *gv, const dump_args_t &) const std::unique_ptr superedge::to_json () const { - auto sedge_obj = ::make_unique (); + auto sedge_obj = std::make_unique (); sedge_obj->set_string ("kind", edge_kind_to_string (m_kind)); sedge_obj->set_integer ("src_idx", m_src->m_index); sedge_obj->set_integer ("dst_idx", m_dest->m_index); diff --git a/gcc/analyzer/svalue.cc b/gcc/analyzer/svalue.cc index ed511152591..513d9cc4bb2 100644 --- a/gcc/analyzer/svalue.cc +++ b/gcc/analyzer/svalue.cc @@ -25,7 +25,6 @@ along with GCC; see the file COPYING3. If not see #include "fold-const.h" #include "diagnostic.h" #include "tree-diagnostic.h" -#include "make-unique.h" #include "text-art/dump.h" @@ -36,7 +35,6 @@ along with GCC; see the file COPYING3. If not see #include "analyzer/svalue.h" #include "analyzer/region-model.h" - #if ENABLE_ANALYZER namespace ana { @@ -92,7 +90,7 @@ std::unique_ptr svalue::to_json () const { label_text desc = get_desc (true); - auto sval_js = ::make_unique (desc.get ()); + auto sval_js = std::make_unique (desc.get ()); return sval_js; } diff --git a/gcc/analyzer/varargs.cc b/gcc/analyzer/varargs.cc index 55730a36141..6ea0d29d131 100644 --- a/gcc/analyzer/varargs.cc +++ b/gcc/analyzer/varargs.cc @@ -556,7 +556,7 @@ va_list_state_machine::check_for_ended_va_list (sm_context &sm_ctxt, { if (sm_ctxt.get_state (&call, arg) == m_ended) sm_ctxt.warn (node, &call, arg, - make_unique + std::make_unique (*this, arg, NULL_TREE, usage_fnname)); } @@ -635,7 +635,7 @@ va_list_state_machine::on_va_end (sm_context &sm_ctxt, std::unique_ptr va_list_state_machine::on_leak (tree var) const { - return make_unique (*this, nullptr, var); + return std::make_unique (*this, nullptr, var); } } // anonymous namespace @@ -814,7 +814,7 @@ public: = get_num_variadic_arguments (dst_node->get_function ()->decl, call_stmt); emission_path->add_event - (make_unique + (std::make_unique (eedge, event_loc_info (last_stmt ? last_stmt->location : UNKNOWN_LOCATION, src_point.get_fndecl (), @@ -1070,7 +1070,7 @@ kf_va_arg::impl_call_pre (const call_details &cd) const else { if (ctxt) - ctxt->warn (make_unique + ctxt->warn (std::make_unique (va_list_tree, arg_reg, lhs_type, @@ -1081,8 +1081,9 @@ kf_va_arg::impl_call_pre (const call_details &cd) const else { if (ctxt) - ctxt->warn (make_unique (va_list_tree, - arg_reg)); + ctxt->warn + (std::make_unique (va_list_tree, + arg_reg)); saw_problem = true; } } @@ -1131,10 +1132,10 @@ public: void register_varargs_builtins (known_function_manager &kfm) { - kfm.add (BUILT_IN_VA_START, make_unique ()); - kfm.add (BUILT_IN_VA_COPY, make_unique ()); - kfm.add (IFN_VA_ARG, make_unique ()); - kfm.add (BUILT_IN_VA_END, make_unique ()); + kfm.add (BUILT_IN_VA_START, std::make_unique ()); + kfm.add (BUILT_IN_VA_COPY, std::make_unique ()); + kfm.add (IFN_VA_ARG, std::make_unique ()); + kfm.add (BUILT_IN_VA_END, std::make_unique ()); } } // namespace ana diff --git a/gcc/c-family/c-pretty-print.cc b/gcc/c-family/c-pretty-print.cc index 1ce19f54988..fad6b5eb9b0 100644 --- a/gcc/c-family/c-pretty-print.cc +++ b/gcc/c-family/c-pretty-print.cc @@ -36,7 +36,6 @@ along with GCC; see the file COPYING3. If not see #include "function.h" #include "basic-block.h" #include "gimple.h" -#include "make-unique.h" /* The pretty-printer code is primarily designed to closely follow (GNU) C and C++ grammars. That is to be contrasted with spaghetti @@ -2994,7 +2993,7 @@ c_pretty_printer::c_pretty_printer (dump_flags_t dump_flags) std::unique_ptr c_pretty_printer::clone () const { - return ::make_unique (*this); + return std::make_unique (*this); } /* Print the tree T in full, on file FILE. */ diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index e7765f6d951..4e200f91107 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -62,7 +62,6 @@ along with GCC; see the file COPYING3. If not see #include "omp-offload.h" /* For offload_vars. */ #include "c-parser.h" #include "gcc-urlifier.h" -#include "make-unique.h" #include "tree-pretty-print.h" @@ -4550,9 +4549,9 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc) if (header_hint) return name_hint (nullptr, - ::make_unique (loc, - IDENTIFIER_POINTER (name), - header_hint)); + std::make_unique (loc, + IDENTIFIER_POINTER (name), + header_hint)); /* Next, look for exact matches for builtin defines that would have been defined if the user had passed a command-line option (e.g. -fopenmp @@ -4562,9 +4561,9 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc) if (option_id.m_idx > 0) return name_hint (nullptr, - ::make_unique (loc, - IDENTIFIER_POINTER (name), - option_id)); + std::make_unique (loc, + IDENTIFIER_POINTER (name), + option_id)); /* Only suggest names reserved for the implementation if NAME begins with an underscore. */ diff --git a/gcc/c/c-objc-common.cc b/gcc/c/c-objc-common.cc index 7e227d38ad9..2016eaebf17 100644 --- a/gcc/c/c-objc-common.cc +++ b/gcc/c/c-objc-common.cc @@ -32,7 +32,6 @@ along with GCC; see the file COPYING3. If not see #include "stringpool.h" #include "attribs.h" #include "dwarf2.h" -#include "make-unique.h" static bool c_tree_printer (pretty_printer *, text_info *, const char *, int, bool, bool, bool, bool *, pp_token_list &); @@ -412,7 +411,7 @@ has_c_linkage (const_tree decl ATTRIBUTE_UNUSED) void c_initialize_diagnostics (diagnostic_context *context) { - context->set_pretty_printer (::make_unique ()); + context->set_pretty_printer (std::make_unique ()); c_common_diagnostics_set_defaults (context); context->set_format_decoder (&c_tree_printer); } diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 2e7ba28f404..8a63dc54c79 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -77,7 +77,6 @@ along with GCC; see the file COPYING3. If not see #include "asan.h" #include "c-family/c-ubsan.h" #include "gcc-urlifier.h" -#include "make-unique.h" /* We need to walk over decls with incomplete struct/union/enum types after parsing the whole translation unit. @@ -1074,9 +1073,10 @@ c_parser_error_richloc (c_parser *parser, const char *gmsgid, = get_c_stdlib_header_for_string_macro_name (token_name); if (header_hint != NULL) h = name_hint (nullptr, - ::make_unique (token->location, - token_name, - header_hint)); + std::make_unique + (token->location, + token_name, + header_hint)); } c_parse_error (gmsgid, diff --git a/gcc/cp/cxx-pretty-print.cc b/gcc/cp/cxx-pretty-print.cc index cf301bd7cb3..5f24015d7de 100644 --- a/gcc/cp/cxx-pretty-print.cc +++ b/gcc/cp/cxx-pretty-print.cc @@ -24,7 +24,6 @@ along with GCC; see the file COPYING3. If not see #include "cp-tree.h" #include "cxx-pretty-print.h" #include "tree-pretty-print.h" -#include "make-unique.h" static void pp_cxx_unqualified_id (cxx_pretty_printer *, tree); static void pp_cxx_nested_name_specifier (cxx_pretty_printer *, tree); @@ -2954,5 +2953,5 @@ cxx_pretty_printer::cxx_pretty_printer () std::unique_ptr cxx_pretty_printer::clone () const { - return ::make_unique (*this); + return std::make_unique (*this); } diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 499eb1b15a8..75bf7dcef62 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -38,7 +38,6 @@ along with GCC; see the file COPYING3. If not see #include "cp-name-hint.h" #include "attribs.h" #include "pretty-print-format-impl.h" -#include "make-unique.h" #include "diagnostic-format-text.h" #define pp_separate_with_comma(PP) pp_cxx_separate_with (PP, ',') diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index 27b32f08dc3..9b317c44669 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -35,7 +35,6 @@ along with GCC; see the file COPYING3. If not see #include "c-family/known-headers.h" #include "c-family/c-spellcheck.h" #include "bitmap.h" -#include "make-unique.h" static cxx_binding *cxx_binding_make (tree value, tree type); static cp_binding_level *innermost_nonclass_level (void); @@ -7086,16 +7085,16 @@ namespace_hints::convert_candidates_to_name_hint () /* Clean up CANDIDATES. */ m_candidates.release (); return name_hint (expr_to_string (candidate), - ::make_unique (m_loc, - candidate)); + std::make_unique (m_loc, + candidate)); } else if (m_candidates.length () > 1) /* If we have more than one candidate, issue a name_hint without a single "suggestion", but with a deferred diagnostic that lists the various candidates. This takes ownership of m_candidates. */ return name_hint (NULL, - ::make_unique (m_loc, - m_candidates)); + std::make_unique (m_loc, + m_candidates)); /* Otherwise, m_candidates ought to be empty, so no cleanup is necessary. */ gcc_assert (m_candidates.length () == 0); @@ -7117,9 +7116,9 @@ namespace_hints::maybe_decorate_with_limit (name_hint hint) if (m_limited) return name_hint (hint.suggestion (), - ::make_unique (m_loc, m_limit, - m_name, - hint.take_deferred ())); + std::make_unique (m_loc, m_limit, + m_name, + hint.take_deferred ())); else return hint; } @@ -7198,9 +7197,9 @@ suggest_alternatives_for_1 (location_t location, tree name, if (option_id.m_idx > 0) return name_hint (nullptr, - ::make_unique (location, - IDENTIFIER_POINTER (name), - option_id)); + std::make_unique (location, + IDENTIFIER_POINTER (name), + option_id)); /* Otherwise, consider misspellings. */ if (!suggest_misspellings) @@ -7329,8 +7328,8 @@ maybe_suggest_missing_std_header (location_t location, tree name) return name_hint (); return name_hint (nullptr, - ::make_unique (location, name_str, - header_hint)); + std::make_unique (location, name_str, + header_hint)); } /* Attempt to generate a name_hint that suggests a missing header file @@ -7727,7 +7726,7 @@ class macro_use_before_def : public deferred_diagnostic if (!linemap_location_before_p (line_table, use_loc, def_loc)) return nullptr; - return ::make_unique (use_loc, macro); + return std::make_unique (use_loc, macro); } /* Ctor. LOC is the location of the usage. MACRO is the @@ -7798,9 +7797,9 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc) if (header_hint) return name_hint (nullptr, - ::make_unique (loc, - IDENTIFIER_POINTER (name), - header_hint)); + std::make_unique (loc, + IDENTIFIER_POINTER (name), + header_hint)); best_match bm (name); diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 6cdf262af1a..e165b2a0b1b 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -50,7 +50,6 @@ along with GCC; see the file COPYING3. If not see #include "contracts.h" #include "bitmap.h" #include "builtins.h" -#include "make-unique.h" /* The lexer. */ @@ -3437,9 +3436,9 @@ cp_parser_error_1 (cp_parser* parser, const char* gmsgid, if (header_hint != NULL) h = name_hint (nullptr, - ::make_unique (token->location, - token_name, - header_hint)); + std::make_unique (token->location, + token_name, + header_hint)); } /* Actually emit the error. */ diff --git a/gcc/diagnostic-format-json.cc b/gcc/diagnostic-format-json.cc index 883b0eaba1d..c28804e78fb 100644 --- a/gcc/diagnostic-format-json.cc +++ b/gcc/diagnostic-format-json.cc @@ -32,7 +32,6 @@ along with GCC; see the file COPYING3. If not see #include "json.h" #include "selftest.h" #include "logical-location.h" -#include "make-unique.h" class json_output_format; @@ -74,7 +73,7 @@ public: std::unique_ptr make_per_format_buffer () final override { - return ::make_unique (*this); + return std::make_unique (*this); } void set_buffer (diagnostic_per_format_buffer *base_buffer) final override { @@ -118,7 +117,7 @@ protected: bool formatted) : diagnostic_output_format (context), m_buffer (nullptr), - m_toplevel_array (::make_unique ()), + m_toplevel_array (std::make_unique ()), m_cur_group (nullptr), m_cur_children_array (nullptr), m_formatted (formatted) @@ -156,7 +155,7 @@ static std::unique_ptr json_from_expanded_location (diagnostic_context &context, location_t loc) { expanded_location exploc = expand_location (loc); - std::unique_ptr result = ::make_unique (); + std::unique_ptr result = std::make_unique (); if (exploc.file) result->set_string ("file", exploc.file); result->set_integer ("line", exploc.line); @@ -200,7 +199,7 @@ json_from_location_range (diagnostic_context &context, location_t start_loc = get_start (loc_range->m_loc); location_t finish_loc = get_finish (loc_range->m_loc); - std::unique_ptr result = ::make_unique (); + std::unique_ptr result = std::make_unique (); result->set ("caret", json_from_expanded_location (context, caret_loc)); if (start_loc != caret_loc @@ -227,7 +226,7 @@ json_from_location_range (diagnostic_context &context, static std::unique_ptr json_from_fixit_hint (diagnostic_context &context, const fixit_hint *hint) { - std::unique_ptr fixit_obj = ::make_unique (); + std::unique_ptr fixit_obj = std::make_unique (); location_t start_loc = hint->get_start_loc (); fixit_obj->set ("start", @@ -245,7 +244,7 @@ json_from_fixit_hint (diagnostic_context &context, const fixit_hint *hint) static std::unique_ptr json_from_metadata (const diagnostic_metadata *metadata) { - std::unique_ptr metadata_obj = ::make_unique (); + std::unique_ptr metadata_obj = std::make_unique (); if (metadata->get_cwe ()) metadata_obj->set_integer ("cwe", metadata->get_cwe ()); @@ -260,12 +259,12 @@ make_json_for_path (diagnostic_context &context, pretty_printer *ref_pp, const diagnostic_path *path) { - std::unique_ptr path_array = ::make_unique (); + std::unique_ptr path_array = std::make_unique (); for (unsigned i = 0; i < path->num_events (); i++) { const diagnostic_event &event = path->get_event (i); - std::unique_ptr event_obj = ::make_unique (); + std::unique_ptr event_obj = std::make_unique (); if (event.get_location ()) event_obj->set ("location", json_from_expanded_location (context, @@ -395,7 +394,7 @@ json_output_format::on_report_diagnostic (const diagnostic_info &diagnostic, add a "children" array and record the column origin. */ m_cur_group = diag_obj; std::unique_ptr children_array - = ::make_unique (); + = std::make_unique (); m_cur_children_array = children_array.get (); // borrowed diag_obj->set ("children", std::move (children_array)); diag_obj->set_integer ("column-origin", m_context.m_column_origin); @@ -409,7 +408,7 @@ json_output_format::on_report_diagnostic (const diagnostic_info &diagnostic, const rich_location *richloc = diagnostic.richloc; { - std::unique_ptr loc_array = ::make_unique (); + std::unique_ptr loc_array = std::make_unique (); for (unsigned int i = 0; i < richloc->get_num_locations (); i++) { const location_range *loc_range = richloc->get_range (i); @@ -422,7 +421,7 @@ json_output_format::on_report_diagnostic (const diagnostic_info &diagnostic, if (richloc->get_num_fixit_hints ()) { - std::unique_ptr fixit_array = ::make_unique (); + std::unique_ptr fixit_array = std::make_unique (); for (unsigned int i = 0; i < richloc->get_num_fixit_hints (); i++) { const fixit_hint *hint = richloc->get_fixit_hint (i); @@ -524,8 +523,8 @@ diagnostic_output_format_init_json_stderr (diagnostic_context &context, { diagnostic_output_format_init_json (context, - ::make_unique (context, - formatted)); + std::make_unique (context, + formatted)); } /* Populate CONTEXT in preparation for JSON output to a file named @@ -538,9 +537,9 @@ diagnostic_output_format_init_json_file (diagnostic_context &context, { diagnostic_output_format_init_json (context, - ::make_unique (context, - formatted, - base_file_name)); + std::make_unique (context, + formatted, + base_file_name)); } #if CHECKING_P diff --git a/gcc/diagnostic-format-sarif.cc b/gcc/diagnostic-format-sarif.cc index c490d0d1785..f322991ab2e 100644 --- a/gcc/diagnostic-format-sarif.cc +++ b/gcc/diagnostic-format-sarif.cc @@ -41,7 +41,6 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-format-text.h" #include "ordered-hash-map.h" #include "sbitmap.h" -#include "make-unique.h" #include "selftest.h" #include "selftest-diagnostic.h" #include "selftest-diagnostic-show-locus.h" @@ -158,7 +157,7 @@ make_date_time_string_for_current_time () "%02i:%02i:%02iZ"), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); - return ::make_unique (buf); + return std::make_unique (buf); } /* Subclass of sarif_object for SARIF "invocation" objects @@ -920,13 +919,13 @@ sarif_object::get_or_create_properties () sarif_invocation::sarif_invocation (sarif_builder &builder, const char * const *original_argv) -: m_notifications_arr (::make_unique ()), +: m_notifications_arr (std::make_unique ()), m_success (true) { // "arguments" property (SARIF v2.1.0 section 3.20.2) if (original_argv) { - auto arguments_arr = ::make_unique (); + auto arguments_arr = std::make_unique (); for (size_t i = 0; original_argv[i]; ++i) arguments_arr->append_string (original_argv[i]); set ("arguments", std::move (arguments_arr)); @@ -953,9 +952,9 @@ sarif_invocation::add_notification_for_ice (const diagnostic_info &diagnostic, m_success = false; auto notification - = ::make_unique (diagnostic, - builder, - std::move (backtrace)); + = std::make_unique (diagnostic, + builder, + std::move (backtrace)); /* Support for related locations within a notification was added in SARIF 2.2; see https://github.com/oasis-tcs/sarif-spec/issues/540 */ @@ -1070,7 +1069,7 @@ sarif_artifact::populate_roles () { if (bitmap_empty_p (m_roles)) return; - auto roles_arr (::make_unique ()); + auto roles_arr (std::make_unique ()); for (int i = 0; i < (int)diagnostic_artifact_role::NUM_ROLES; i++) if (bitmap_bit_p (m_roles, i)) { @@ -1247,7 +1246,7 @@ void sarif_result::on_diagram (const diagnostic_diagram &diagram, sarif_builder &builder) { - auto location_obj = ::make_unique (); + auto location_obj = std::make_unique (); auto message_obj = builder.make_message_object_for_diagram (diagram); location_obj->set ("message", std::move (message_obj)); @@ -1346,7 +1345,7 @@ sarif_location::lazily_add_relationship_object (sarif_location &target, /* No existing locationRelationship from THIS to TARGET; make one, record it, and add it to the "relationships" array. */ auto relationship_obj - = ::make_unique (target, loc_mgr); + = std::make_unique (target, loc_mgr); sarif_location_relationship *relationship = relationship_obj.get (); auto kv = std::pair (); + auto thread_flows_arr = std::make_unique (); m_thread_flows_arr = thread_flows_arr.get (); // borrowed set ("threadFlows", std::move (thread_flows_arr)); } @@ -1489,7 +1488,7 @@ sarif_code_flow::get_or_append_thread_flow (const diagnostic_thread &thread, unsigned next_thread_flow_idx = m_thread_flows_arr->size (); auto thread_flow_obj - = ::make_unique (*this, thread, next_thread_flow_idx); + = std::make_unique (*this, thread, next_thread_flow_idx); m_thread_id_map.put (thread_id, thread_flow_obj.get ()); // borrowed sarif_thread_flow *result = thread_flow_obj.get (); m_thread_flows_arr->append (std::move (thread_flow_obj)); @@ -1569,8 +1568,8 @@ sarif_builder::sarif_builder (diagnostic_context &context, m_line_maps (line_maps), m_token_printer (*this), m_invocation_obj - (::make_unique (*this, - context.get_original_argv ())), + (std::make_unique (*this, + context.get_original_argv ())), m_results_array (new json::array ()), m_cur_group_result (nullptr), m_seen_any_relative_paths (false), @@ -1687,7 +1686,7 @@ bt_callback (void *data, uintptr_t pc, const char *filename, int lineno, } } - auto frame_obj = ::make_unique (); + auto frame_obj = std::make_unique (); /* I tried using sarifStack and sarifStackFrame for this but it's not a good fit e.g. PC information. */ @@ -1713,7 +1712,7 @@ bt_callback (void *data, uintptr_t pc, const char *filename, int lineno, std::unique_ptr sarif_builder::make_stack_from_backtrace () { - auto frames_arr = ::make_unique (); + auto frames_arr = std::make_unique (); backtrace_state *state = nullptr; state = backtrace_create_state (nullptr, 0, nullptr, nullptr); @@ -1726,7 +1725,7 @@ sarif_builder::make_stack_from_backtrace () if (frames_arr->size () == 0) return nullptr; - auto stack = ::make_unique (); + auto stack = std::make_unique (); stack->set ("frames", std::move (frames_arr)); return stack; } @@ -1875,7 +1874,7 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic, diagnostic_t orig_diag_kind, unsigned idx_within_parent) { - auto result_obj = ::make_unique (idx_within_parent); + auto result_obj = std::make_unique (idx_within_parent); /* "ruleId" property (SARIF v2.1.0 section 3.27.5). */ /* Ideally we'd have an option_name for these. */ @@ -1916,7 +1915,7 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic, /* "taxa" property (SARIF v2.1.0 section 3.27.8). */ if (int cwe_id = diagnostic.metadata->get_cwe ()) { - auto taxa_arr = ::make_unique (); + auto taxa_arr = std::make_unique (); taxa_arr->append (make_reporting_descriptor_reference_object_for_cwe_id (cwe_id)); result_obj->set ("taxa", std::move (taxa_arr)); @@ -1947,7 +1946,7 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic, /* "codeFlows" property (SARIF v2.1.0 section 3.27.18). */ if (const diagnostic_path *path = diagnostic.richloc->get_path ()) { - auto code_flows_arr = ::make_unique (); + auto code_flows_arr = std::make_unique (); const unsigned code_flow_index = 0; code_flows_arr->append (make_code_flow_object (*result_obj.get (), @@ -1964,7 +1963,7 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic, const rich_location *richloc = diagnostic.richloc; if (richloc->get_num_fixit_hints ()) { - auto fix_arr = ::make_unique (); + auto fix_arr = std::make_unique (); fix_arr->append (make_fix_object (*richloc)); result_obj->set ("fixes", std::move (fix_arr)); } @@ -1981,7 +1980,7 @@ make_reporting_descriptor_object_for_warning (const diagnostic_info &diagnostic, diagnostic_t /*orig_diag_kind*/, const char *option_text) { - auto reporting_desc = ::make_unique (); + auto reporting_desc = std::make_unique (); /* "id" property (SARIF v2.1.0 section 3.49.3). */ reporting_desc->set_string ("id", option_text); @@ -2005,7 +2004,7 @@ make_reporting_descriptor_object_for_warning (const diagnostic_info &diagnostic, std::unique_ptr sarif_builder::make_reporting_descriptor_object_for_cwe_id (int cwe_id) const { - auto reporting_desc = ::make_unique (); + auto reporting_desc = std::make_unique (); /* "id" property (SARIF v2.1.0 section 3.49.3). */ { @@ -2032,7 +2031,7 @@ std::unique_ptr sarif_builder:: make_reporting_descriptor_reference_object_for_cwe_id (int cwe_id) { - auto desc_ref_obj = ::make_unique (); + auto desc_ref_obj = std::make_unique (); /* "id" property (SARIF v2.1.0 section 3.52.4). */ { @@ -2059,7 +2058,7 @@ std::unique_ptr sarif_builder:: make_tool_component_reference_object_for_cwe () const { - auto comp_ref_obj = ::make_unique (); + auto comp_ref_obj = std::make_unique (); /* "name" property (SARIF v2.1.0 section 3.54.3). */ comp_ref_obj->set_string ("name", "cwe"); @@ -2077,7 +2076,7 @@ sarif_builder::make_locations_arr (sarif_location_manager &loc_mgr, const diagnostic_info &diagnostic, enum diagnostic_artifact_role role) { - auto locations_arr = ::make_unique (); + auto locations_arr = std::make_unique (); const logical_location *logical_loc = nullptr; if (auto client_data_hooks = m_context.get_client_data_hooks ()) logical_loc = client_data_hooks->get_current_logical_location (); @@ -2101,7 +2100,7 @@ set_any_logical_locs_arr (sarif_location &location_obj, { if (!logical_loc) return; - auto location_locs_arr = ::make_unique (); + auto location_locs_arr = std::make_unique (); location_locs_arr->append (make_sarif_logical_location_object (*logical_loc)); location_obj.set ("logicalLocations", @@ -2161,7 +2160,7 @@ sarif_builder::make_location_object (sarif_location_manager &loc_mgr, } the_renderer (rich_loc, m_context.get_escape_format ()); - auto location_obj = ::make_unique (); + auto location_obj = std::make_unique (); /* Get primary loc from RICH_LOC. */ location_t loc = rich_loc.get_loc (); @@ -2199,7 +2198,7 @@ sarif_builder::make_location_object (sarif_location_manager &loc_mgr, if (region) { if (!annotations_arr) - annotations_arr = ::make_unique (); + annotations_arr = std::make_unique (); region->set ("message", make_message_object (text.get ())); annotations_arr->append (std::move (region)); @@ -2279,7 +2278,7 @@ sarif_builder::make_location_object (sarif_location_manager &loc_mgr, location_t loc, enum diagnostic_artifact_role role) { - auto location_obj = ::make_unique (); + auto location_obj = std::make_unique (); /* "physicalLocation" property (SARIF v2.1.0 section 3.28.3). */ if (auto phs_loc_obj @@ -2300,7 +2299,7 @@ sarif_builder::make_location_object (sarif_location_manager &loc_mgr, const diagnostic_event &event, enum diagnostic_artifact_role role) { - auto location_obj = ::make_unique (); + auto location_obj = std::make_unique (); /* "physicalLocation" property (SARIF v2.1.0 section 3.28.3). */ location_t loc = event.get_location (); @@ -2344,7 +2343,7 @@ maybe_make_physical_location_object (location_t loc, if (loc <= BUILTINS_LOCATION || LOCATION_FILE (loc) == nullptr) return nullptr; - auto phys_loc_obj = ::make_unique (); + auto phys_loc_obj = std::make_unique (); /* "artifactLocation" property (SARIF v2.1.0 section 3.29.3). */ phys_loc_obj->set @@ -2388,7 +2387,7 @@ sarif_builder::make_artifact_location_object (location_t loc) std::unique_ptr sarif_builder::make_artifact_location_object (const char *filename) { - auto artifact_loc_obj = ::make_unique (); + auto artifact_loc_obj = std::make_unique (); /* "uri" property (SARIF v2.1.0 section 3.4.3). */ artifact_loc_obj->set_string ("uri", filename); @@ -2434,7 +2433,7 @@ make_pwd_uri_str () std::unique_ptr sarif_builder::make_artifact_location_object_for_pwd () const { - auto artifact_loc_obj = ::make_unique (); + auto artifact_loc_obj = std::make_unique (); /* "uri" property (SARIF v2.1.0 section 3.4.3). */ if (char *pwd = make_pwd_uri_str ()) @@ -2494,7 +2493,7 @@ sarif_builder::maybe_make_region_object (location_t loc, if (exploc_start.line <= 0) return nullptr; - auto region_obj = ::make_unique (); + auto region_obj = std::make_unique (); /* "startLine" property (SARIF v2.1.0 section 3.30.5) */ region_obj->set_integer ("startLine", exploc_start.line); @@ -2571,7 +2570,7 @@ maybe_make_region_object_for_context (location_t loc, if (exploc_start.line <= 0) return nullptr; - auto region_obj = ::make_unique (); + auto region_obj = std::make_unique (); /* "startLine" property (SARIF v2.1.0 section 3.30.5) */ region_obj->set_integer ("startLine", exploc_start.line); @@ -2605,7 +2604,7 @@ sarif_builder::make_region_object_for_hint (const fixit_hint &hint) const expanded_location exploc_start = expand_location (start_loc); expanded_location exploc_next = expand_location (next_loc); - auto region_obj = ::make_unique (); + auto region_obj = std::make_unique (); /* "startLine" property (SARIF v2.1.0 section 3.30.5) */ region_obj->set_integer ("startLine", exploc_start.line); @@ -2665,7 +2664,7 @@ maybe_get_sarif_kind (enum logical_location_kind kind) std::unique_ptr make_sarif_logical_location_object (const logical_location &logical_loc) { - auto logical_loc_obj = ::make_unique (); + auto logical_loc_obj = std::make_unique (); /* "name" property (SARIF v2.1.0 section 3.33.4). */ if (const char *short_name = logical_loc.get_short_name ()) @@ -2726,7 +2725,7 @@ sarif_builder::make_code_flow_object (sarif_result &result, const diagnostic_path &path) { auto code_flow_obj - = ::make_unique (result, idx_within_parent); + = std::make_unique (result, idx_within_parent); /* First pass: Create threadFlows and threadFlowLocation objects within them, @@ -2811,7 +2810,7 @@ sarif_builder::maybe_make_kinds_array (diagnostic_event::meaning m) const && m.m_property == diagnostic_event::PROPERTY_unknown) return nullptr; - auto kinds_arr = ::make_unique (); + auto kinds_arr = std::make_unique (); if (const char *verb_str = diagnostic_event::meaning::maybe_get_verb_str (m.m_verb)) kinds_arr->append_string (verb_str); @@ -2861,7 +2860,7 @@ set_string_property_escaping_braces (json::object &obj, std::unique_ptr sarif_builder::make_message_object (const char *msg) const { - auto message_obj = ::make_unique (); + auto message_obj = std::make_unique (); /* "text" property (SARIF v2.1.0 section 3.11.8). */ set_string_property_escaping_braces (*message_obj, @@ -2877,7 +2876,7 @@ sarif_builder::make_message_object (const char *msg) const std::unique_ptr sarif_builder::make_message_object_for_diagram (const diagnostic_diagram &diagram) { - auto message_obj = ::make_unique (); + auto message_obj = std::make_unique (); /* "text" property (SARIF v2.1.0 section 3.11.8). */ set_string_property_escaping_braces (*message_obj, @@ -2908,7 +2907,7 @@ sarif_builder::make_message_object_for_diagram (const diagnostic_diagram &diagra std::unique_ptr sarif_builder::make_multiformat_message_string (const char *msg) const { - auto message_obj = ::make_unique (); + auto message_obj = std::make_unique (); /* "text" property (SARIF v2.1.0 section 3.12.3). */ set_string_property_escaping_braces (*message_obj, @@ -2960,7 +2959,7 @@ sarif_builder:: make_top_level_object (std::unique_ptr invocation_obj, std::unique_ptr results) { - auto log_obj = ::make_unique (); + auto log_obj = std::make_unique (); /* "$schema" property (SARIF v2.1.0 section 3.13.3) . */ log_obj->set_string ("$schema", sarif_version_to_url (get_version ())); @@ -2969,7 +2968,7 @@ make_top_level_object (std::unique_ptr invocation_obj, log_obj->set_string ("version", sarif_version_to_property (get_version ())); /* "runs" property (SARIF v2.1.0 section 3.13.4). */ - auto run_arr = ::make_unique (); + auto run_arr = std::make_unique (); auto run_obj = make_run_object (std::move (invocation_obj), std::move (results)); run_arr->append (std::move (run_obj)); @@ -2985,7 +2984,7 @@ sarif_builder:: make_run_object (std::unique_ptr invocation_obj, std::unique_ptr results) { - auto run_obj = ::make_unique (); + auto run_obj = std::make_unique (); /* "tool" property (SARIF v2.1.0 section 3.14.6). */ run_obj->set ("tool", make_tool_object ()); @@ -2996,7 +2995,7 @@ make_run_object (std::unique_ptr invocation_obj, /* "invocations" property (SARIF v2.1.0 section 3.14.11). */ { - auto invocations_arr = ::make_unique (); + auto invocations_arr = std::make_unique (); invocations_arr->append (std::move (invocation_obj)); run_obj->set ("invocations", std::move (invocations_arr)); } @@ -3004,7 +3003,7 @@ make_run_object (std::unique_ptr invocation_obj, /* "originalUriBaseIds (SARIF v2.1.0 section 3.14.14). */ if (m_seen_any_relative_paths) { - auto orig_uri_base_ids = ::make_unique (); + auto orig_uri_base_ids = std::make_unique (); orig_uri_base_ids->set (PWD_PROPERTY_NAME, make_artifact_location_object_for_pwd ()); run_obj->set ("originalUriBaseIds", @@ -3012,7 +3011,7 @@ make_run_object (std::unique_ptr invocation_obj, } /* "artifacts" property (SARIF v2.1.0 section 3.14.15). */ - auto artifacts_arr = ::make_unique (); + auto artifacts_arr = std::make_unique (); for (auto iter : m_filename_to_artifact_map) { sarif_artifact *artifact_obj = iter.second; @@ -3035,7 +3034,7 @@ make_run_object (std::unique_ptr invocation_obj, std::unique_ptr sarif_builder::make_tool_object () { - auto tool_obj = ::make_unique (); + auto tool_obj = std::make_unique (); /* "driver" property (SARIF v2.1.0 section 3.18.2). */ tool_obj->set ("driver", @@ -3054,7 +3053,7 @@ sarif_builder::make_tool_object () { /* Create a "toolComponent" object (SARIF v2.1.0 section 3.19) for the plugin. */ - auto plugin_obj = ::make_unique (); + auto plugin_obj = std::make_unique (); /* "name" property (SARIF v2.1.0 section 3.19.8). */ if (const char *short_name = p.get_short_name ()) @@ -3076,7 +3075,7 @@ sarif_builder::make_tool_object () vinfo->for_each_plugin (v); if (v.m_plugin_objs.size () > 0) { - auto extensions_arr = ::make_unique (); + auto extensions_arr = std::make_unique (); for (auto &iter : v.m_plugin_objs) extensions_arr->append (std::move (iter)); tool_obj->set ("extensions", @@ -3096,7 +3095,7 @@ sarif_builder::make_tool_object () std::unique_ptr sarif_builder::make_driver_tool_component_object () { - auto driver_obj = ::make_unique (); + auto driver_obj = std::make_unique (); if (auto client_data_hooks = m_context.get_client_data_hooks ()) if (const client_version_info *vinfo @@ -3145,7 +3144,7 @@ sarif_builder::maybe_make_taxonomies_array () const return nullptr; /* "taxonomies" property (SARIF v2.1.0 section 3.14.8). */ - auto taxonomies_arr = ::make_unique (); + auto taxonomies_arr = std::make_unique (); taxonomies_arr->append (std::move (cwe_obj)); return taxonomies_arr; } @@ -3162,7 +3161,7 @@ sarif_builder::maybe_make_cwe_taxonomy_object () const if (m_cwe_id_set.is_empty ()) return nullptr; - auto taxonomy_obj = ::make_unique (); + auto taxonomy_obj = std::make_unique (); /* "name" property (SARIF v2.1.0 section 3.19.8). */ taxonomy_obj->set_string ("name", "CWE"); @@ -3180,7 +3179,7 @@ sarif_builder::maybe_make_cwe_taxonomy_object () const " Common Weakness Enumeration")); /* "taxa" property (SARIF v2.1.0 3.section 3.19.25). */ - auto taxa_arr = ::make_unique (); + auto taxa_arr = std::make_unique (); for (auto cwe_id : m_cwe_id_set) taxa_arr->append (make_reporting_descriptor_object_for_cwe_id (cwe_id)); @@ -3254,10 +3253,10 @@ sarif_builder::maybe_make_artifact_content_object (const char *filename) const if (!cpp_valid_utf8_p(utf8_content.get_buffer (), utf8_content.length ())) return nullptr; - auto artifact_content_obj = ::make_unique (); + auto artifact_content_obj = std::make_unique (); artifact_content_obj->set ("text", - ::make_unique (utf8_content.get_buffer (), + std::make_unique (utf8_content.get_buffer (), utf8_content.length ())); return artifact_content_obj; } @@ -3312,7 +3311,7 @@ maybe_make_artifact_content_object (const char *filename, return nullptr; } - auto artifact_content_obj = ::make_unique (); + auto artifact_content_obj = std::make_unique (); artifact_content_obj->set_string ("text", text_utf8); free (text_utf8); @@ -3330,11 +3329,11 @@ maybe_make_artifact_content_object (const char *filename, std::unique_ptr sarif_builder::make_fix_object (const rich_location &richloc) { - auto fix_obj = ::make_unique (); + auto fix_obj = std::make_unique (); /* "artifactChanges" property (SARIF v2.1.0 section 3.55.3). */ /* We assume that all fix-it hints in RICHLOC affect the same file. */ - auto artifact_change_arr = ::make_unique (); + auto artifact_change_arr = std::make_unique (); artifact_change_arr->append (make_artifact_change_object (richloc)); fix_obj->set ("artifactChanges", @@ -3348,7 +3347,7 @@ sarif_builder::make_fix_object (const rich_location &richloc) std::unique_ptr sarif_builder::make_artifact_change_object (const rich_location &richloc) { - auto artifact_change_obj = ::make_unique (); + auto artifact_change_obj = std::make_unique (); /* "artifactLocation" property (SARIF v2.1.0 section 3.56.2). */ artifact_change_obj->set @@ -3356,7 +3355,7 @@ sarif_builder::make_artifact_change_object (const rich_location &richloc) make_artifact_location_object (richloc.get_loc ())); /* "replacements" property (SARIF v2.1.0 section 3.56.3). */ - auto replacement_arr = ::make_unique (); + auto replacement_arr = std::make_unique (); for (unsigned int i = 0; i < richloc.get_num_fixit_hints (); i++) { const fixit_hint *hint = richloc.get_fixit_hint (i); @@ -3374,7 +3373,7 @@ sarif_builder::make_artifact_change_object (const rich_location &richloc) std::unique_ptr sarif_builder::make_replacement_object (const fixit_hint &hint) const { - auto replacement_obj = ::make_unique (); + auto replacement_obj = std::make_unique (); /* "deletedRegion" property (SARIF v2.1.0 section 3.57.3). */ replacement_obj->set ("deletedRegion", @@ -3393,7 +3392,7 @@ sarif_builder::make_replacement_object (const fixit_hint &hint) const std::unique_ptr sarif_builder::make_artifact_content_object (const char *text) const { - auto content_obj = ::make_unique (); + auto content_obj = std::make_unique (); /* "text" property (SARIF v2.1.0 section 3.3.2). */ content_obj->set_string ("text", text); @@ -3472,7 +3471,7 @@ public: std::unique_ptr make_per_format_buffer () final override { - return ::make_unique (m_builder); + return std::make_unique (m_builder); } void set_buffer (diagnostic_per_format_buffer *base_buffer) final override { @@ -3750,12 +3749,12 @@ diagnostic_output_format_init_sarif_stderr (diagnostic_context &context, const sarif_generation_options sarif_gen_opts; diagnostic_output_format_init_sarif (context, - ::make_unique (context, - line_maps, - main_input_filename_, - formatted, - sarif_gen_opts, - stderr)); + std::make_unique (context, + line_maps, + main_input_filename_, + formatted, + sarif_gen_opts, + stderr)); } /* Attempt to open BASE_FILE_NAME.sarif for writing. @@ -3813,12 +3812,12 @@ diagnostic_output_format_init_sarif_file (diagnostic_context &context, const sarif_generation_options sarif_gen_opts; diagnostic_output_format_init_sarif (context, - ::make_unique (context, - line_maps, - main_input_filename_, - formatted, - sarif_gen_opts, - std::move (output_file))); + std::make_unique (context, + line_maps, + main_input_filename_, + formatted, + sarif_gen_opts, + std::move (output_file))); } /* Populate CONTEXT in preparation for SARIF output to STREAM. */ @@ -3834,12 +3833,12 @@ diagnostic_output_format_init_sarif_stream (diagnostic_context &context, const sarif_generation_options sarif_gen_opts; diagnostic_output_format_init_sarif (context, - ::make_unique (context, - line_maps, - main_input_filename_, - formatted, - sarif_gen_opts, - stream)); + std::make_unique (context, + line_maps, + main_input_filename_, + formatted, + sarif_gen_opts, + stream)); } std::unique_ptr @@ -3850,12 +3849,13 @@ make_sarif_sink (diagnostic_context &context, const sarif_generation_options &sarif_gen_opts, diagnostic_output_file output_file) { - auto sink = ::make_unique (context, - &line_maps, - main_input_filename_, - formatted, - sarif_gen_opts, - std::move (output_file)); + auto sink + = std::make_unique (context, + &line_maps, + main_input_filename_, + formatted, + sarif_gen_opts, + std::move (output_file)); sink->update_printer (); return sink; } @@ -3881,11 +3881,11 @@ public: test_sarif_diagnostic_context (const char *main_input_filename, const sarif_generation_options &sarif_gen_opts) { - auto format = ::make_unique (*this, - line_table, - main_input_filename, - true, - sarif_gen_opts); + auto format = std::make_unique (*this, + line_table, + main_input_filename, + true, + sarif_gen_opts); m_format = format.get (); // borrowed diagnostic_output_format_init_sarif (*this, std::move (format)); } @@ -4377,7 +4377,7 @@ test_message_with_embedded_link (const sarif_generation_options &sarif_gen_opts) }; test_sarif_diagnostic_context dc ("test.c", sarif_gen_opts); - dc.push_owned_urlifier (::make_unique ()); + dc.push_owned_urlifier (std::make_unique ()); rich_location richloc (line_table, UNKNOWN_LOCATION); dc.report (DK_ERROR, richloc, nullptr, 0, "foo %<-foption%> % bar"); diff --git a/gcc/diagnostic-format-text.cc b/gcc/diagnostic-format-text.cc index 9273973baaf..5df3894a012 100644 --- a/gcc/diagnostic-format-text.cc +++ b/gcc/diagnostic-format-text.cc @@ -34,7 +34,6 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-format-text.h" #include "diagnostic-buffer.h" #include "text-art/theme.h" -#include "make-unique.h" /* Disable warnings about quoting issues in the pp_xxx calls below that (intentionally) don't follow GCC diagnostic conventions. */ @@ -193,7 +192,7 @@ diagnostic_text_output_format::set_buffer (diagnostic_per_format_buffer *base) std::unique_ptr diagnostic_text_output_format::make_per_format_buffer () { - return ::make_unique (*this); + return std::make_unique (*this); } /* Implementation of diagnostic_output_format::on_report_diagnostic vfunc diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index 91f02ad1927..429c4b1b116 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -49,7 +49,6 @@ along with GCC; see the file COPYING3. If not see #include "pretty-print-urlifier.h" #include "logical-location.h" #include "diagnostic-buffer.h" -#include "make-unique.h" #ifdef HAVE_TERMIOS_H # include @@ -223,7 +222,7 @@ diagnostic_context::initialize (int n_opts) { /* Allocate a basic pretty-printer. Clients will replace this a much more elaborated pretty-printer if they wish. */ - m_reference_printer = ::make_unique ().release (); + m_reference_printer = std::make_unique ().release (); m_file_cache = new file_cache (); m_diagnostic_counters.clear (); diff --git a/gcc/dumpfile.cc b/gcc/dumpfile.cc index 65bd5c549b9..ebee8e5121f 100644 --- a/gcc/dumpfile.cc +++ b/gcc/dumpfile.cc @@ -40,7 +40,6 @@ along with GCC; see the file COPYING3. If not see #include "optinfo-emit-json.h" #include "stringpool.h" /* for get_identifier. */ #include "spellcheck.h" -#include "make-unique.h" #include "pretty-print-format-impl.h" /* If non-NULL, return one past-the-end of the matching SUBPART of @@ -638,9 +637,9 @@ make_item_for_dump_gimple_stmt (gimple *stmt, int spc, dump_flags_t dump_flags) pp_newline (&pp); std::unique_ptr item - = make_unique (OPTINFO_ITEM_KIND_GIMPLE, - gimple_location (stmt), - xstrdup (pp_formatted_text (&pp))); + = std::make_unique (OPTINFO_ITEM_KIND_GIMPLE, + gimple_location (stmt), + xstrdup (pp_formatted_text (&pp))); return item; } @@ -686,9 +685,9 @@ make_item_for_dump_gimple_expr (gimple *stmt, int spc, dump_flags_t dump_flags) pp_gimple_stmt_1 (&pp, stmt, spc, dump_flags); std::unique_ptr item - = make_unique (OPTINFO_ITEM_KIND_GIMPLE, - gimple_location (stmt), - xstrdup (pp_formatted_text (&pp))); + = std::make_unique (OPTINFO_ITEM_KIND_GIMPLE, + gimple_location (stmt), + xstrdup (pp_formatted_text (&pp))); return item; } @@ -740,8 +739,8 @@ make_item_for_dump_generic_expr (tree node, dump_flags_t dump_flags) loc = EXPR_LOCATION (node); std::unique_ptr item - = make_unique (OPTINFO_ITEM_KIND_TREE, loc, - xstrdup (pp_formatted_text (&pp))); + = std::make_unique (OPTINFO_ITEM_KIND_TREE, loc, + xstrdup (pp_formatted_text (&pp))); return item; } @@ -785,8 +784,8 @@ make_item_for_dump_symtab_node (symtab_node *node) { location_t loc = DECL_SOURCE_LOCATION (node->decl); std::unique_ptr item - = make_unique (OPTINFO_ITEM_KIND_SYMTAB_NODE, loc, - xstrdup (node->dump_name ())); + = std::make_unique (OPTINFO_ITEM_KIND_SYMTAB_NODE, loc, + xstrdup (node->dump_name ())); return item; } @@ -847,7 +846,7 @@ dump_pretty_printer::stash_item (pp_token_list &formatted_tok_list, gcc_assert (item.get ()); auto custom_data - = ::make_unique (std::move (item)); + = std::make_unique (std::move (item)); formatted_tok_list.push_back (std::move (custom_data)); } @@ -1013,8 +1012,8 @@ emit_any_pending_textual_chunks () char *formatted_text = xstrdup (pp_formatted_text (pp)); std::unique_ptr item - = make_unique (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION, - formatted_text); + = std::make_unique (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION, + formatted_text); pp->emit_item (std::move (item), m_optinfo); /* Clear the pending text by unwinding formatted_text back to the start @@ -1085,8 +1084,8 @@ make_item_for_dump_dec (const poly_int &value) } auto item - = make_unique (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION, - xstrdup (pp_formatted_text (&pp))); + = std::make_unique (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION, + xstrdup (pp_formatted_text (&pp))); return item; } @@ -1164,8 +1163,8 @@ dump_context::begin_scope (const char *name, pp_printf (&pp, "%s %s %s", "===", name, "==="); pp_newline (&pp); std::unique_ptr item - = make_unique (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION, - xstrdup (pp_formatted_text (&pp))); + = std::make_unique (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION, + xstrdup (pp_formatted_text (&pp))); emit_item (*item.get (), MSG_NOTE); if (optinfo_enabled_p ()) diff --git a/gcc/gcc-attribute-urlifier.cc b/gcc/gcc-attribute-urlifier.cc index d066624c33b..fd3d6293461 100644 --- a/gcc/gcc-attribute-urlifier.cc +++ b/gcc/gcc-attribute-urlifier.cc @@ -29,7 +29,6 @@ along with GCC; see the file COPYING3. If not see #include "options.h" #include "diagnostic.h" #include "selftest.h" -#include "make-unique.h" #include "target.h" /* class attribute_urlifier : public urlifier. */ diff --git a/gcc/gcc-urlifier.cc b/gcc/gcc-urlifier.cc index a4094582f41..677720b3821 100644 --- a/gcc/gcc-urlifier.cc +++ b/gcc/gcc-urlifier.cc @@ -28,7 +28,6 @@ along with GCC; see the file COPYING3. If not see #include "options.h" #include "diagnostic.h" #include "selftest.h" -#include "make-unique.h" char * make_doc_url (const char *doc_url_suffix) @@ -215,7 +214,7 @@ gcc_urlifier::get_url_suffix_for_option (const char *p, size_t sz) const std::unique_ptr make_gcc_urlifier (unsigned int lang_mask) { - return ::make_unique (lang_mask); + return std::make_unique (lang_mask); } /* class auto_override_urlifier. */ diff --git a/gcc/jit/dummy-frontend.cc b/gcc/jit/dummy-frontend.cc index 88784ec9e92..bf31a9db83c 100644 --- a/gcc/jit/dummy-frontend.cc +++ b/gcc/jit/dummy-frontend.cc @@ -33,7 +33,6 @@ along with GCC; see the file COPYING3. If not see #include "cgraph.h" #include "target.h" #include "diagnostic-format-text.h" -#include "make-unique.h" #include "print-tree.h" #include @@ -1085,8 +1084,9 @@ jit_langhook_init (void) diagnostic_text_starter (global_dc) = jit_begin_diagnostic; diagnostic_text_finalizer (global_dc) = jit_end_diagnostic; auto sink - = ::make_unique (*global_dc, - *gcc::jit::active_playback_ctxt); + = std::make_unique + (*global_dc, + *gcc::jit::active_playback_ctxt); global_dc->set_output_format (std::move (sink)); build_common_tree_nodes (flag_signed_char); diff --git a/gcc/json-parsing.cc b/gcc/json-parsing.cc index 0b9715cb5d8..fc78500b247 100644 --- a/gcc/json-parsing.cc +++ b/gcc/json-parsing.cc @@ -24,7 +24,6 @@ along with GCC; see the file COPYING3. If not see #include "json-parsing.h" #include "pretty-print.h" #include "math.h" -#include "make-unique.h" #include "selftest.h" using namespace json; @@ -1037,7 +1036,7 @@ lexer::make_error (const char *msg) location_map::range r; r.m_start = p; r.m_end = p; - return ::make_unique (r, xstrdup (msg)); + return std::make_unique (r, xstrdup (msg)); } /* parser's ctor. */ @@ -1092,7 +1091,7 @@ parser::parse_value (int depth) case TOK_STRING: { - auto val = ::make_unique (tok->u.string); + auto val = std::make_unique (tok->u.string); m_lexer.consume (); maybe_record_range (val.get (), tok->range); return parser_result_t (std::move (val)); @@ -1103,7 +1102,7 @@ parser::parse_value (int depth) case TOK_FLOAT_NUMBER: { - auto val = ::make_unique (tok->u.float_number); + auto val = std::make_unique (tok->u.float_number); m_lexer.consume (); maybe_record_range (val.get (), tok->range); return parser_result_t (std::move (val)); @@ -1111,7 +1110,7 @@ parser::parse_value (int depth) case TOK_INTEGER_NUMBER: { - auto val = ::make_unique (tok->u.integer_number); + auto val = std::make_unique (tok->u.integer_number); m_lexer.consume (); maybe_record_range (val.get (), tok->range); return parser_result_t (std::move (val)); @@ -1119,7 +1118,7 @@ parser::parse_value (int depth) case TOK_TRUE: { - auto val = ::make_unique (JSON_TRUE); + auto val = std::make_unique (JSON_TRUE); m_lexer.consume (); maybe_record_range (val.get (), tok->range); return parser_result_t (std::move (val)); @@ -1127,7 +1126,7 @@ parser::parse_value (int depth) case TOK_FALSE: { - auto val = ::make_unique (JSON_FALSE); + auto val = std::make_unique (JSON_FALSE); m_lexer.consume (); maybe_record_range (val.get (), tok->range); return parser_result_t (std::move (val)); @@ -1135,7 +1134,7 @@ parser::parse_value (int depth) case TOK_NULL: { - auto val = ::make_unique (JSON_NULL); + auto val = std::make_unique (JSON_NULL); m_lexer.consume (); maybe_record_range (val.get (), tok->range); return parser_result_t (std::move (val)); @@ -1160,7 +1159,7 @@ parser::parse_object (int depth) require (TOK_OPEN_CURLY); - auto obj = ::make_unique (); + auto obj = std::make_unique (); const token *tok = m_lexer.peek (); if (tok->id == TOK_CLOSE_CURLY) @@ -1223,7 +1222,7 @@ parser::parse_array (int depth) if (auto err = require (TOK_OPEN_SQUARE)) return parser_result_t (std::move (err)); - auto arr = ::make_unique (); + auto arr = std::make_unique (); const token *tok = m_lexer.peek (); if (tok->id == TOK_CLOSE_SQUARE) @@ -1340,7 +1339,7 @@ parser::error_at (const location_map::range &r, const char *fmt, ...) char *formatted_msg = xvasprintf (fmt, ap); va_end (ap); - return ::make_unique (r, formatted_msg); + return std::make_unique (r, formatted_msg); } /* Record that JV has range R within the input file. */ diff --git a/gcc/json.cc b/gcc/json.cc index 4cf962fe340..e66a7ae6f74 100644 --- a/gcc/json.cc +++ b/gcc/json.cc @@ -24,7 +24,6 @@ along with GCC; see the file COPYING3. If not see #include "json.h" #include "pretty-print.h" #include "math.h" -#include "make-unique.h" #include "selftest.h" using namespace json; @@ -510,7 +509,7 @@ test_formatting () { object obj; object *child = new object; - std::unique_ptr grandchild = ::make_unique (); + std::unique_ptr grandchild = std::make_unique (); obj.set_string ("str", "bar"); obj.set ("child", child); @@ -518,7 +517,7 @@ test_formatting () array *arr = new array; for (int i = 0; i < 3; i++) - arr->append (::make_unique (i)); + arr->append (std::make_unique (i)); grandchild->set ("arr", arr); grandchild->set_integer ("int", 1066); diff --git a/gcc/lazy-diagnostic-path.cc b/gcc/lazy-diagnostic-path.cc index ba620972382..1474f70390b 100644 --- a/gcc/lazy-diagnostic-path.cc +++ b/gcc/lazy-diagnostic-path.cc @@ -28,7 +28,6 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "diagnostic.h" #include "lazy-diagnostic-path.h" -#include "make-unique.h" #include "selftest.h" #include "selftest-diagnostic.h" #include "simple-diagnostic-path.h" @@ -100,7 +99,7 @@ public: tree fntype_void_void = build_function_type_array (void_type_node, 0, NULL); tree fndecl_foo = build_fn_decl ("foo", fntype_void_void); - auto path = ::make_unique (&m_pp); + auto path = std::make_unique (&m_pp); path->add_event (UNKNOWN_LOCATION, fndecl_foo, 0, "first %qs", "free"); path->add_event (UNKNOWN_LOCATION, fndecl_foo, 0, "double %qs", "free"); return path; @@ -167,7 +166,7 @@ test_emission (pretty_printer *event_pp) is skipped. */ { test_diagnostic_context dc; - dc.set_option_manager (::make_unique (), 0); + dc.set_option_manager (std::make_unique (), 0); test_rich_location rich_loc (*event_pp); ASSERT_FALSE (rich_loc.m_path.generated_p ()); diff --git a/gcc/libgdiagnostics.cc b/gcc/libgdiagnostics.cc index 9f70669f938..49524cc922d 100644 --- a/gcc/libgdiagnostics.cc +++ b/gcc/libgdiagnostics.cc @@ -33,7 +33,6 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-format-text.h" #include "logical-location.h" #include "edit-context.h" -#include "make-unique.h" #include "libgdiagnostics.h" class owned_nullable_string @@ -398,11 +397,11 @@ public: m_dc.m_client_aux_data = this; m_dc.set_client_data_hooks - (::make_unique (*this)); + (std::make_unique (*this)); diagnostic_text_starter (&m_dc) = diagnostic_text_sink::text_starter; - m_edit_context = ::make_unique (m_dc.get_file_cache ()); + m_edit_context = std::make_unique (m_dc.get_file_cache ()); } ~diagnostic_manager () @@ -503,11 +502,11 @@ public: return (*iter).second.get (); std::unique_ptr logical_loc - = ::make_unique (kind, - parent, - short_name, - fully_qualified_name, - decorated_name); + = std::make_unique (kind, + parent, + short_name, + fully_qualified_name, + decorated_name); const diagnostic_logical_location *result = logical_loc.get (); m_logical_locs.insert (logical_locs_map_t::value_type (std::move (key), @@ -785,11 +784,12 @@ struct diagnostic_execution_path : public diagnostic_path const char *gmsgid, va_list *args) { - m_events.push_back (::make_unique (physical_loc, - logical_loc, - stack_depth, - gmsgid, - args)); + m_events.push_back + (std::make_unique (physical_loc, + logical_loc, + stack_depth, + gmsgid, + args)); return m_events.size () - 1; } @@ -860,7 +860,7 @@ public: void add_rule (const char *title, const char *url) { - std::unique_ptr rule = ::make_unique (title, url); + std::unique_ptr rule = std::make_unique (title, url); m_metadata.add_rule (*rule.get ()); m_rules.push_back (std::move (rule)); } @@ -882,7 +882,7 @@ public: const char *text) { std::unique_ptr label - = ::make_unique (text); + = std::make_unique (text); m_rich_loc.add_range (as_location_t (loc), SHOW_RANGE_WITHOUT_CARET, label.get ()); @@ -902,7 +902,7 @@ public: diagnostic_execution_path * add_execution_path () { - m_path = ::make_unique (); + m_path = std::make_unique (); m_rich_loc.set_path (m_path.get ()); return m_path.get (); } @@ -946,7 +946,7 @@ diagnostic_t_from_diagnostic_level (enum diagnostic_level level) void diagnostic_file::set_buffered_content (const char *buf, size_t sz) { - m_content = ::make_unique (buf, sz); + m_content = std::make_unique (buf, sz); // Populate file_cache: file_cache &fc = m_mgr.get_dc ().get_file_cache (); @@ -1004,8 +1004,8 @@ diagnostic_text_sink::diagnostic_text_sink (diagnostic_manager &mgr, m_source_printing (mgr.get_dc ().m_source_printing) { auto inner_sink - = ::make_unique (mgr.get_dc (), - &m_source_printing); + = std::make_unique (mgr.get_dc (), + &m_source_printing); inner_sink->get_printer ()->set_output_stream (dst_stream); m_inner_sink = inner_sink.get (); set_colorize (colorize); @@ -1287,10 +1287,10 @@ diagnostic_manager_add_sarif_sink (diagnostic_manager *diag_mgr, break; } - diag_mgr->add_sink (make_unique (*diag_mgr, - dst_stream, - main_input_file, - sarif_gen_opts)); + diag_mgr->add_sink (std::make_unique (*diag_mgr, + dst_stream, + main_input_file, + sarif_gen_opts)); } /* Public entrypoint. */ diff --git a/gcc/libsarifreplay.cc b/gcc/libsarifreplay.cc index ce42bdace3c..f5f1f2041b4 100644 --- a/gcc/libsarifreplay.cc +++ b/gcc/libsarifreplay.cc @@ -25,7 +25,6 @@ along with GCC; see the file COPYING3. If not see #define INCLUDE_STRING #include "system.h" #include "coretypes.h" -#include "make-unique.h" #include "libgdiagnostics++.h" #include "json-parsing.h" #include "intl.h" @@ -51,7 +50,7 @@ read_file (const char *path, libgdiagnostics::manager &mgr) } /* Read content, allocating a buffer for it. */ - auto result = ::make_unique> (); + auto result = std::make_unique> (); char buf[4096]; size_t iter_sz_in; @@ -1350,7 +1349,7 @@ maybe_consume_embedded_link (const char *&iter_src) } iter_src = iter; - return ::make_unique (std::move (result)); + return std::make_unique (std::move (result)); } /* Lookup the plain text string within a result.message (§3.27.11), diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc index a980b208783..27405e8092e 100644 --- a/gcc/lto-wrapper.cc +++ b/gcc/lto-wrapper.cc @@ -55,7 +55,6 @@ along with GCC; see the file COPYING3. If not see #include "opts-diagnostic.h" #include "opt-suggestions.h" #include "opts-jobserver.h" -#include "make-unique.h" #include "lto-ltrans-cache.h" /* Environment variable, used for passing the names of offload targets from GCC diff --git a/gcc/make-unique.h b/gcc/make-unique.h deleted file mode 100644 index 6f5aeeea0e6..00000000000 --- a/gcc/make-unique.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Minimal implementation of make_unique for C++11 compatibility. - Copyright (C) 2022-2025 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ - -#ifndef GCC_MAKE_UNIQUE -#define GCC_MAKE_UNIQUE - -#include - -/* Minimal implementation of make_unique for C++11 compatibility - (std::make_unique is C++14). */ - -template -inline typename std::enable_if::value, std::unique_ptr>::type -make_unique(Args&&... args) -{ - return std::unique_ptr (new T (std::forward (args)...)); -} - -#endif /* ! GCC_MAKE_UNIQUE */ diff --git a/gcc/opts-diagnostic.cc b/gcc/opts-diagnostic.cc index 4267db5a435..b51c8a8b422 100644 --- a/gcc/opts-diagnostic.cc +++ b/gcc/opts-diagnostic.cc @@ -39,7 +39,6 @@ along with GCC; see the file COPYING3. If not see #include "pretty-print-markup.h" #include "opts.h" #include "options.h" -#include "make-unique.h" /* A namespace for handling the DSL of the arguments of -fdiagnostics-add-output= and -fdiagnostics-set-output=. */ @@ -308,7 +307,7 @@ parse (const context &ctxt, const char *unparsed_arg) } else result.m_scheme_name = unparsed_arg; - return ::make_unique (std::move (result)); + return std::make_unique (std::move (result)); } /* class output_factory::scheme_handler. */ @@ -317,8 +316,8 @@ parse (const context &ctxt, const char *unparsed_arg) output_factory::output_factory () { - m_scheme_handlers.push_back (::make_unique ()); - m_scheme_handlers.push_back (::make_unique ()); + m_scheme_handlers.push_back (std::make_unique ()); + m_scheme_handlers.push_back (std::make_unique ()); } const output_factory::scheme_handler * @@ -405,7 +404,7 @@ text_scheme_handler::make_sink (const context &ctxt, return nullptr; } - auto sink = ::make_unique (ctxt.m_dc); + auto sink = std::make_unique (ctxt.m_dc); sink->set_show_nesting (show_nesting); sink->set_show_locations_in_nesting (show_locations_in_nesting); sink->set_show_nesting_levels (show_levels); diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc index abd6c0b528f..1f38702b611 100644 --- a/gcc/pretty-print.cc +++ b/gcc/pretty-print.cc @@ -30,7 +30,6 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-color.h" #include "diagnostic-event-id.h" #include "diagnostic-highlight-colors.h" -#include "make-unique.h" #include "selftest.h" #if HAVE_ICONV @@ -2521,7 +2520,7 @@ pretty_printer::~pretty_printer () std::unique_ptr pretty_printer::clone () const { - return ::make_unique (*this); + return std::make_unique (*this); } /* Append a string delimited by START and END to the output area of @@ -3542,7 +3541,7 @@ test_custom_tokens_1 () void add_to_phase_2 (pp_markup::context &ctxt) final override { - auto val_ptr = make_unique (*this); + auto val_ptr = std::make_unique (*this); ctxt.m_formatted_token_list->push_back (std::move (val_ptr)); } @@ -3622,7 +3621,7 @@ test_custom_tokens_2 () void add_to_phase_2 (pp_markup::context &ctxt) final override { - auto val_ptr = make_unique (*this); + auto val_ptr = std::make_unique (*this); ctxt.m_formatted_token_list->push_back (std::move (val_ptr)); } diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc index a20d0c15a0e..0f1f8640d65 100644 --- a/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc +++ b/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc @@ -46,7 +46,6 @@ #include "analyzer/call-details.h" #include "analyzer/call-info.h" #include "analyzer/exploded-graph.h" -#include "make-unique.h" int plugin_is_GPL_compatible; @@ -207,7 +206,7 @@ public: std::unique_ptr clone () const final override { - return make_unique (m_eg, m_var); + return std::make_unique (m_eg, m_var); } const gimple * @@ -451,8 +450,9 @@ check_refcnt (const region_model *model, const auto &eg = ctxt->get_eg (); refcnt_stmt_finder finder (*eg, reg_tree); - auto pd = make_unique (curr_region, ob_refcnt_sval, - actual_refcnt_sval, reg_tree); + auto pd = std::make_unique (curr_region, ob_refcnt_sval, + actual_refcnt_sval, + reg_tree); if (pd && eg) ctxt->warn (std::move (pd), &finder); } @@ -943,9 +943,9 @@ kf_PyList_Append::impl_call_post (const call_details &cd) const /* Body of kf_PyList_Append::impl_call_post. */ if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd)); - cd.get_ctxt ()->bifurcate (make_unique (cd)); - cd.get_ctxt ()->bifurcate (make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); cd.get_ctxt ()->terminate_path (); } } @@ -1078,8 +1078,8 @@ kf_PyList_New::impl_call_post (const call_details &cd) const if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd)); - cd.get_ctxt ()->bifurcate (make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); cd.get_ctxt ()->terminate_path (); } } @@ -1147,8 +1147,8 @@ kf_PyLong_FromLong::impl_call_post (const call_details &cd) const if (cd.get_ctxt ()) { - cd.get_ctxt ()->bifurcate (make_unique (cd)); - cd.get_ctxt ()->bifurcate (make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); cd.get_ctxt ()->terminate_path (); } } @@ -1290,14 +1290,14 @@ cpython_analyzer_init_cb (void *gcc_data, void * /*user_data */) } iface->register_known_function ("PyList_Append", - make_unique ()); - iface->register_known_function ("PyList_New", make_unique ()); + std::make_unique ()); + iface->register_known_function ("PyList_New", std::make_unique ()); iface->register_known_function ("PyLong_FromLong", - make_unique ()); + std::make_unique ()); iface->register_known_function ( "__analyzer_cpython_dump_refcounts", - make_unique ()); + std::make_unique ()); } } // namespace ana diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.cc index b410f8bd2e5..3cac3f8f923 100644 --- a/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.cc +++ b/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.cc @@ -10,7 +10,6 @@ #include "config.h" #include "system.h" #include "coretypes.h" -#include "make-unique.h" #include "diagnostic.h" #include "tree.h" #include "gimple.h" @@ -325,9 +324,9 @@ gil_state_machine::check_for_pyobject_in_call (sm_context &sm_ctxt, if (type_based_on_pyobject_p (type)) { sm_ctxt.warn (node, &call, NULL_TREE, - make_unique (*this, call, - callee_fndecl, - i)); + std::make_unique (*this, call, + callee_fndecl, + i)); sm_ctxt.set_global_state (m_stop); } } @@ -354,7 +353,7 @@ gil_state_machine::on_stmt (sm_context &sm_ctxt, if (global_state == m_released_gil) { sm_ctxt.warn (node, stmt, NULL_TREE, - make_unique (*this, call)); + std::make_unique (*this, call)); sm_ctxt.set_global_state (m_stop); } else @@ -410,7 +409,7 @@ gil_state_machine::check_for_pyobject_usage_without_gil (sm_context &sm_ctxt, if (type_based_on_pyobject_p (type)) { sm_ctxt.warn (node, stmt, NULL_TREE, - make_unique (*this, op)); + std::make_unique (*this, op)); sm_ctxt.set_global_state (m_stop); } } @@ -426,7 +425,7 @@ gil_analyzer_init_cb (void *gcc_data, void */*user_data*/) if (0) inform (input_location, "got here: gil_analyzer_init_cb"); iface->register_state_machine - (make_unique (iface->get_logger ())); + (std::make_unique (iface->get_logger ())); } } // namespace ana diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc index f2aac5faab8..771ff75c911 100644 --- a/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc +++ b/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc @@ -44,7 +44,6 @@ #include "analyzer/region-model.h" #include "analyzer/call-details.h" #include "analyzer/call-info.h" -#include "make-unique.h" int plugin_is_GPL_compatible; @@ -106,7 +105,7 @@ class copy_across_boundary_fn : public known_function if (ctxt) { /* Bifurcate state, creating a "failure" out-edge. */ - ctxt->bifurcate (make_unique (cd)); + ctxt->bifurcate (std::make_unique (cd)); /* The "unbifurcated" state is the "success" case. */ copy_success success (cd, @@ -238,11 +237,13 @@ kernel_analyzer_init_cb (void *gcc_data, void */*user_data*/) inform (input_location, "got here: kernel_analyzer_init_cb"); iface->register_known_function ("copy_from_user", - make_unique ()); - iface->register_known_function ("copy_to_user", - make_unique ()); - iface->register_known_function ("__check_object_size", - make_unique ()); + std::make_unique ()); + iface->register_known_function + ("copy_to_user", + std::make_unique ()); + iface->register_known_function + ("__check_object_size", + std::make_unique ()); } } // namespace ana diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc index 21e7b366531..c7087f0dfd9 100644 --- a/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc +++ b/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc @@ -44,7 +44,6 @@ #include "analyzer/region-model.h" #include "analyzer/call-details.h" #include "analyzer/call-info.h" -#include "make-unique.h" int plugin_is_GPL_compatible; @@ -168,7 +167,7 @@ public: if (cd.get_ctxt ()) { /* Bifurcate state, creating a "failure" out-edge. */ - cd.get_ctxt ()->bifurcate (make_unique (cd)); + cd.get_ctxt ()->bifurcate (std::make_unique (cd)); /* The "unbifurcated" state is the "success" case. */ copy_success success (cd, @@ -189,11 +188,12 @@ known_fn_analyzer_init_cb (void *gcc_data, void */*user_data*/) LOG_SCOPE (iface->get_logger ()); if (0) inform (input_location, "got here: known_fn_analyzer_init_cb"); - iface->register_known_function ("returns_42", - make_unique ()); + iface->register_known_function + ("returns_42", + std::make_unique ()); iface->register_known_function ("attempt_to_copy", - make_unique ()); + std::make_unique ()); } } // namespace ana diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc index 7e6d7e1de25..5ec341847d9 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc @@ -29,7 +29,6 @@ #include "diagnostic.h" #include "diagnostic-format-text.h" #include "context.h" -#include "make-unique.h" int plugin_is_GPL_compatible; @@ -230,7 +229,8 @@ plugin_init (struct plugin_name_args *plugin_info, diagnostic_text_starter (global_dc) = test_diagnostic_text_starter; diagnostic_start_span (global_dc) = test_diagnostic_start_span_fn; - global_dc->set_output_format (::make_unique (*global_dc)); + global_dc->set_output_format + (::std::make_unique (*global_dc)); pass_info.pass = new pass_test_groups (g); pass_info.reference_pass_name = "*warn_function_noreturn"; diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc index 2ce267c3207..24c6f8ce557 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc @@ -39,7 +39,6 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-buffer.h" #include "ordered-hash-map.h" #include "sbitmap.h" -#include "make-unique.h" #include "selftest.h" #include "selftest-diagnostic.h" #include "selftest-diagnostic-show-locus.h" @@ -179,7 +178,7 @@ void node_with_children::add_text (label_text str) { gcc_assert (str.get ()); - add_child (::make_unique (std::move (str))); + add_child (std::make_unique (std::move (str))); } @@ -338,7 +337,7 @@ private: static std::unique_ptr make_div (label_text class_) { - auto div = ::make_unique ("div", false); + auto div = std::make_unique ("div", false); div->set_attr ("class", std::move (class_)); return div; } @@ -346,7 +345,7 @@ make_div (label_text class_) static std::unique_ptr make_span (label_text class_) { - auto span = ::make_unique ("span", true); + auto span = std::make_unique ("span", true); span->set_attr ("class", std::move (class_)); return span; } @@ -410,24 +409,24 @@ xhtml_builder::xhtml_builder (diagnostic_context &context, { gcc_assert (m_line_maps); - m_document = ::make_unique (); + m_document = std::make_unique (); { - auto html_element = ::make_unique ("html", false); + auto html_element = std::make_unique ("html", false); html_element->set_attr ("xmlns", label_text::borrow ("http://www.w3.org/1999/xhtml")); { { - auto head_element = ::make_unique ("head", false); + auto head_element = std::make_unique ("head", false); { - auto title_element = ::make_unique ("title", true); + auto title_element = std::make_unique ("title", true); label_text title (label_text::borrow ("Title goes here")); // TODO title_element->add_text (std::move (title)); head_element->add_child (std::move (title_element)); } html_element->add_child (std::move (head_element)); - auto body_element = ::make_unique ("body", false); + auto body_element = std::make_unique ("body", false); { auto diagnostics_element = make_div (label_text::borrow ("gcc-diagnostic-list")); @@ -531,7 +530,7 @@ xhtml_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, case pp_token::kind::begin_url: { pp_token_begin_url *sub = as_a (iter); - auto anchor = ::make_unique ("a", true); + auto anchor = std::make_unique ("a", true); anchor->set_attr ("href", std::move (sub->m_value)); push_element (std::move (anchor)); } @@ -585,7 +584,7 @@ xhtml_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, auto cwe_span = make_span (label_text::borrow ("gcc-cwe-metadata")); cwe_span->add_text (label_text::borrow ("[")); { - auto anchor = ::make_unique ("a", true); + auto anchor = std::make_unique ("a", true); anchor->set_attr ("href", label_text::take (get_cwe_url (cwe))); pretty_printer pp; pp_printf (&pp, "CWE-%i", cwe); @@ -614,7 +613,7 @@ xhtml_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, { if (option_url.get ()) { - auto anchor = ::make_unique ("a", true); + auto anchor = std::make_unique ("a", true); anchor->set_attr ("href", std::move (option_url)); anchor->add_text (std::move (option_text)); option_span->add_child (std::move (anchor)); @@ -627,7 +626,7 @@ xhtml_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, } { - auto pre = ::make_unique ("pre", true); + auto pre = std::make_unique ("pre", true); pre->set_attr ("class", label_text::borrow ("gcc-annotated-source")); // TODO: ideally we'd like to capture elements within the following: diagnostic_show_locus (&m_context, m_context.m_source_printing, @@ -698,7 +697,7 @@ public: std::unique_ptr make_per_format_buffer () final override { - return ::make_unique (m_builder); + return std::make_unique (m_builder); } void set_buffer (diagnostic_per_format_buffer *base_buffer) final override { @@ -844,9 +843,9 @@ diagnostic_output_format_init_xhtml_stderr (diagnostic_context &context, const line_maps *line_maps) { gcc_assert (line_maps); - auto format = ::make_unique (context, - line_maps, - stderr); + auto format = std::make_unique (context, + line_maps, + stderr); diagnostic_output_format_init_xhtml (context, std::move (format)); } @@ -859,9 +858,9 @@ diagnostic_output_format_init_xhtml_file (diagnostic_context &context, const char *base_file_name) { gcc_assert (line_maps); - auto format = ::make_unique (context, - line_maps, - base_file_name); + auto format = std::make_unique (context, + line_maps, + base_file_name); diagnostic_output_format_init_xhtml (context, std::move (format)); } @@ -878,8 +877,8 @@ class test_xhtml_diagnostic_context : public test_diagnostic_context public: test_xhtml_diagnostic_context () { - auto format = ::make_unique (*this, - line_table); + auto format = std::make_unique (*this, + line_table); m_format = format.get (); // borrowed diagnostic_output_format_init_xhtml (*this, std::move (format)); } @@ -974,9 +973,9 @@ plugin_init (struct plugin_name_args *plugin_info, return 1; global_dc->set_output_format - (::make_unique (*global_dc, - line_table, - stderr)); + (std::make_unique (*global_dc, + line_table, + stderr)); #if CHECKING_P selftest::xhtml_format_selftests (); diff --git a/gcc/text-art/style.cc b/gcc/text-art/style.cc index 17934059472..ffc75b6d1b0 100644 --- a/gcc/text-art/style.cc +++ b/gcc/text-art/style.cc @@ -23,7 +23,6 @@ along with GCC; see the file COPYING3. If not see #define INCLUDE_VECTOR #include "system.h" #include "coretypes.h" -#include "make-unique.h" #include "pretty-print.h" #include "intl.h" #include "selftest.h" diff --git a/gcc/text-art/styled-string.cc b/gcc/text-art/styled-string.cc index e13278b40d8..3b7145f9efb 100644 --- a/gcc/text-art/styled-string.cc +++ b/gcc/text-art/styled-string.cc @@ -22,7 +22,6 @@ along with GCC; see the file COPYING3. If not see #define INCLUDE_VECTOR #include "system.h" #include "coretypes.h" -#include "make-unique.h" #include "pretty-print.h" #include "intl.h" #include "diagnostic.h" diff --git a/gcc/text-art/table.cc b/gcc/text-art/table.cc index 4b73bff44f5..d3ddae0056c 100644 --- a/gcc/text-art/table.cc +++ b/gcc/text-art/table.cc @@ -22,7 +22,6 @@ along with GCC; see the file COPYING3. If not see #define INCLUDE_VECTOR #include "system.h" #include "coretypes.h" -#include "make-unique.h" #include "pretty-print.h" #include "diagnostic.h" #include "selftest.h" diff --git a/gcc/text-art/tree-widget.cc b/gcc/text-art/tree-widget.cc index 597374fdd41..33c918d0023 100644 --- a/gcc/text-art/tree-widget.cc +++ b/gcc/text-art/tree-widget.cc @@ -24,7 +24,6 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "pretty-print.h" #include "selftest.h" -#include "make-unique.h" #include "text-art/selftests.h" #include "text-art/tree-widget.h" #include "text-art/dump-widget-info.h" @@ -38,8 +37,8 @@ static const int margin_width = 3; std::unique_ptr tree_widget::make (styled_string str, const theme &theme, style::id_t style_id) { - return ::make_unique - (::make_unique (std::move (str)), + return std::make_unique + (std::make_unique (std::move (str)), theme, style_id); } diff --git a/gcc/text-art/widget.cc b/gcc/text-art/widget.cc index d980b5370c9..3c68018c3b5 100644 --- a/gcc/text-art/widget.cc +++ b/gcc/text-art/widget.cc @@ -24,7 +24,6 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "pretty-print.h" #include "selftest.h" -#include "make-unique.h" #include "text-art/selftests.h" #include "text-art/widget.h" @@ -191,7 +190,7 @@ static void test_wrapper_widget () { style_manager sm; - wrapper_widget w (::make_unique (canvas::size_t (3, 3), 'B')); + wrapper_widget w (std::make_unique (canvas::size_t (3, 3), 'B')); canvas c (w.to_canvas (sm)); ASSERT_CANVAS_STREQ (c, false, @@ -207,7 +206,7 @@ test_vbox_1 () vbox_widget w; for (int i = 0; i < 5; i++) w.add_child - (::make_unique + (std::make_unique (styled_string::from_fmt (sm, nullptr, "this is line %i", i))); canvas c (w.to_canvas (sm)); @@ -225,9 +224,9 @@ test_vbox_2 () { style_manager sm; vbox_widget w; - w.add_child (::make_unique (canvas::size_t (1, 3), 'A')); - w.add_child (::make_unique (canvas::size_t (4, 1), 'B')); - w.add_child (::make_unique (canvas::size_t (1, 2), 'C')); + w.add_child (std::make_unique (canvas::size_t (1, 3), 'A')); + w.add_child (std::make_unique (canvas::size_t (4, 1), 'B')); + w.add_child (std::make_unique (canvas::size_t (1, 2), 'C')); canvas c (w.to_canvas (sm)); ASSERT_CANVAS_STREQ (c, false, diff --git a/gcc/timevar.cc b/gcc/timevar.cc index 2e11be9172e..16ae5c82129 100644 --- a/gcc/timevar.cc +++ b/gcc/timevar.cc @@ -24,7 +24,6 @@ along with GCC; see the file COPYING3. If not see #include "timevar.h" #include "options.h" #include "json.h" -#include "make-unique.h" /* Non-NULL if timevars should be used. In GCC, this happens with the -ftime-report flag. */ @@ -139,7 +138,7 @@ timer::named_items::print (FILE *fp, const timevar_time_def *total) std::unique_ptr timer::named_items::make_json () const { - auto arr = ::make_unique (); + auto arr = std::make_unique (); for (const char *item_name : m_names) { hash_map_t &mut_map = const_cast (m_hash_map); @@ -703,7 +702,7 @@ timer::print (FILE *fp) std::unique_ptr make_json_for_timevar_time_def (const timevar_time_def &ttd) { - auto obj = ::make_unique (); + auto obj = std::make_unique (); obj->set_float ("wall", nanosec_to_floating_sec (ttd.wall)); obj->set_integer ("ggc_mem", ttd.ggc_mem); return obj; @@ -717,7 +716,7 @@ make_json_for_timevar_time_def (const timevar_time_def &ttd) std::unique_ptr timer::timevar_def::make_json () const { - auto timevar_obj = ::make_unique (); + auto timevar_obj = std::make_unique (); timevar_obj->set_string ("name", name); timevar_obj->set ("elapsed", make_json_for_timevar_time_def (elapsed)); @@ -732,14 +731,14 @@ timer::timevar_def::make_json () const } if (any_children_with_time) { - auto children_arr = ::make_unique (); + auto children_arr = std::make_unique (); for (auto i : *children) { /* Don't emit timing variables if we're going to get a row of zeroes. */ if (all_zero (i.second)) continue; - auto child_obj = ::make_unique (); + auto child_obj = std::make_unique (); child_obj->set_string ("name", i.first->name); child_obj->set ("elapsed", make_json_for_timevar_time_def (i.second)); @@ -759,7 +758,7 @@ std::unique_ptr timer::make_json () const { #if defined (HAVE_WALL_TIME) - auto report_obj = ::make_unique (); + auto report_obj = std::make_unique (); json::array *json_arr = new json::array (); report_obj->set ("timevars", json_arr); @@ -803,7 +802,7 @@ timer::make_json () const get_time (&total_now); timevar_diff (&total_elapsed, m_timevars[TV_TOTAL].start_time, total_now); - auto total_obj = ::make_unique (); + auto total_obj = std::make_unique (); total_obj->set_string ("name", "TOTAL"); total_obj->set ("elapsed", make_json_for_timevar_time_def (total_elapsed)); json_arr->append (std::move (total_obj)); diff --git a/gcc/toplev.cc b/gcc/toplev.cc index 6d8b8852fb8..7e457b5168b 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -94,7 +94,6 @@ along with GCC; see the file COPYING3. If not see #include "dbgcnt.h" #include "gcc-urlifier.h" #include "unique-argv.h" -#include "make-unique.h" #include "selftest.h" @@ -1095,9 +1094,9 @@ general_init (const char *argv0, bool init_signals, unique_argv original_argv) global_dc->m_internal_error = internal_error_function; const unsigned lang_mask = lang_hooks.option_lang_mask (); global_dc->set_option_manager - (::make_unique (*global_dc, - lang_mask, - &global_options), + (std::make_unique (*global_dc, + lang_mask, + &global_options), lang_mask); global_dc->push_owned_urlifier (make_gcc_urlifier (lang_mask)); diff --git a/gcc/tree-diagnostic-client-data-hooks.cc b/gcc/tree-diagnostic-client-data-hooks.cc index 80717c19757..11701f5025b 100644 --- a/gcc/tree-diagnostic-client-data-hooks.cc +++ b/gcc/tree-diagnostic-client-data-hooks.cc @@ -31,7 +31,6 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "plugin.h" #include "timevar.h" -#include "make-unique.h" /* Concrete class for supplying a diagnostic_context with information about a specific plugin within the client, when the client is the @@ -169,5 +168,5 @@ private: std::unique_ptr make_compiler_data_hooks () { - return ::make_unique (); + return std::make_unique (); }