diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2024-08-20 14:40:06 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2024-08-20 15:12:26 +0300 |
commit | a374554ce62bc38de69206883753aa7a27373926 (patch) | |
tree | c3282fb17d2b960153a039bbf041d58e817138df | |
parent | f5f12e973b10c3b7f6966da0dc6b9273125dfe79 (diff) | |
download | ydb-a374554ce62bc38de69206883753aa7a27373926.tar.gz |
Update contrib/restricted/boost/graph to 1.86.0
29609809abb032ea449cf4b749abf84c9b9c4c1d
9 files changed, 106 insertions, 77 deletions
diff --git a/contrib/restricted/boost/graph/include/boost/graph/detail/adjacency_list.hpp b/contrib/restricted/boost/graph/include/boost/graph/detail/adjacency_list.hpp index 7fb2c49361..ed5a1d4837 100644 --- a/contrib/restricted/boost/graph/include/boost/graph/detail/adjacency_list.hpp +++ b/contrib/restricted/boost/graph/include/boost/graph/detail/adjacency_list.hpp @@ -2189,8 +2189,12 @@ public: } // Copy the edges by adding each edge and copying its // property object. +#ifdef BOOST_NO_CXX17_STRUCTURED_BINDINGS edge_iterator ei, ei_end; for (boost::tie(ei, ei_end) = edges(x); ei != ei_end; ++ei) +#else // Silences -Wmaybe-uninitialized in adj_list_edge_iterator::operator++(). + for (auto [ei, ei_end] = edges(x); ei != ei_end; ++ei) +#endif { edge_descriptor e; bool inserted; diff --git a/contrib/restricted/boost/graph/include/boost/graph/detail/read_graphviz_spirit.hpp b/contrib/restricted/boost/graph/include/boost/graph/detail/read_graphviz_spirit.hpp index b39ad7d631..1650077663 100644 --- a/contrib/restricted/boost/graph/include/boost/graph/detail/read_graphviz_spirit.hpp +++ b/contrib/restricted/boost/graph/include/boost/graph/detail/read_graphviz_spirit.hpp @@ -171,7 +171,7 @@ namespace detail = construct_< std::string >(arg1, arg2)]; a_list = list_p( - ID[(a_list.key = arg1), (a_list.value = "true")] >> !( + ID[((a_list.key = arg1), (a_list.value = "true"))] >> !( ch_p('=') >> ID[a_list.value = arg1])[phoenix::bind( &definition::call_prop_actor)( var(*this), a_list.key, a_list.value)], @@ -213,8 +213,8 @@ namespace detail // (directed/undirected) edgeop = ch_p('-') >> ch_p(boost::ref(edge_head)); - edgeRHS = +(edgeop[(data_stmt.sources = data_stmt.dests), - (data_stmt.dests = construct_< nodes_t >())] + edgeRHS = +(edgeop[((data_stmt.sources = data_stmt.dests), + (data_stmt.dests = construct_< nodes_t >()))] >> (subgraph[data_stmt.dests = arg1] | node_id[phoenix::bind(&definition::insert_node)( var(*this), data_stmt.dests, arg1)]) @@ -225,10 +225,10 @@ namespace detail // To avoid backtracking, edge, node, and subgraph // statements are processed as one nonterminal. data_stmt - = (subgraph[(data_stmt.dests + = (subgraph[((data_stmt.dests = arg1), // will get moved in rhs - (data_stmt.saw_node = false)] - | node_id[(phoenix::bind( + (data_stmt.saw_node = false))] + | node_id[((phoenix::bind( &definition::insert_node)( var(*this), data_stmt.dests, arg1)), (data_stmt.saw_node = true), @@ -236,7 +236,7 @@ namespace detail (std::cout << val("AcTive Node: ") << arg1 << "\n"), #endif // BOOST_GRAPH_DEBUG - (data_stmt.active_node = arg1)]) + (data_stmt.active_node = arg1))]) >> if_p(edgeRHS)[!attr_list(actor_t(phoenix::bind( &definition::edge_prop)( var(*this), arg1, arg2)))] @@ -252,11 +252,11 @@ namespace detail stmt_list = *(stmt >> !ch_p(';')); subgraph = !(as_lower_d[keyword_p("subgraph")] - >> (!ID[(subgraph.name = arg1), + >> (!ID[((subgraph.name = arg1), (subgraph.nodes = (var(subgraph_nodes))[arg1]), (subgraph.edges - = (var(subgraph_edges))[arg1])])) + = (var(subgraph_edges))[arg1]))])) >> ch_p('{')[++var(subgraph_depth)] >> stmt_list >> ch_p('}')[--var(subgraph_depth)] [(var(subgraph_nodes))[subgraph.name] @@ -265,19 +265,19 @@ namespace detail = subgraph.edges] | as_lower_d[keyword_p("subgraph")] - >> ID[(subgraph.nodes + >> ID[((subgraph.nodes = (var(subgraph_nodes))[arg1]), - (subgraph.edges = (var(subgraph_edges))[arg1])]; + (subgraph.edges = (var(subgraph_edges))[arg1]))]; the_grammar = (!as_lower_d[keyword_p("strict")]) >> (as_lower_d[keyword_p( - "graph")][(var(edge_head) = '-'), + "graph")][((var(edge_head) = '-'), (phoenix::bind(&definition::check_undirected)( - var(*this)))] + var(*this))))] | as_lower_d[keyword_p( - "digraph")][(var(edge_head) = '>'), + "digraph")][((var(edge_head) = '>'), (phoenix::bind(&definition::check_directed)( - var(*this)))]) + var(*this))))]) >> (!ID) >> ch_p('{') >> stmt_list >> ch_p('}'); } // definition() diff --git a/contrib/restricted/boost/graph/include/boost/graph/exception.hpp b/contrib/restricted/boost/graph/include/boost/graph/exception.hpp index 81323a3616..76f1fa3809 100644 --- a/contrib/restricted/boost/graph/include/boost/graph/exception.hpp +++ b/contrib/restricted/boost/graph/include/boost/graph/exception.hpp @@ -13,6 +13,8 @@ #include <stdexcept> #include <string> +#include <boost/config.hpp> + namespace boost { @@ -51,6 +53,53 @@ struct BOOST_SYMBOL_VISIBLE not_complete : public bad_graph not_complete() : bad_graph("The graph must be complete.") {} }; +struct BOOST_SYMBOL_VISIBLE graph_exception : public std::exception +{ + ~graph_exception() throw() BOOST_OVERRIDE {} + const char* what() const throw() BOOST_OVERRIDE = 0; +}; + +struct BOOST_SYMBOL_VISIBLE bad_parallel_edge : public graph_exception +{ + std::string from; + std::string to; + mutable std::string statement; + bad_parallel_edge(const std::string& i, const std::string& j) + : from(i), to(j) + { + } + + ~bad_parallel_edge() throw() BOOST_OVERRIDE {} + const char* what() const throw() BOOST_OVERRIDE + { + if (statement.empty()) + statement = std::string("Failed to add parallel edge: (") + from + + "," + to + ")\n"; + + return statement.c_str(); + } +}; + +struct BOOST_SYMBOL_VISIBLE directed_graph_error : public graph_exception +{ + ~directed_graph_error() throw() BOOST_OVERRIDE {} + const char* what() const throw() BOOST_OVERRIDE + { + return "read_graphviz: " + "Tried to read a directed graph into an undirected graph."; + } +}; + +struct BOOST_SYMBOL_VISIBLE undirected_graph_error : public graph_exception +{ + ~undirected_graph_error() throw() BOOST_OVERRIDE {} + const char* what() const throw() BOOST_OVERRIDE + { + return "read_graphviz: " + "Tried to read an undirected graph into a directed graph."; + } +}; + } // namespace boost #endif // BOOST_GRAPH_EXCEPTION_HPP diff --git a/contrib/restricted/boost/graph/include/boost/graph/graph_mutability_traits.hpp b/contrib/restricted/boost/graph/include/boost/graph/graph_mutability_traits.hpp index 333a026d2f..064f32ff39 100644 --- a/contrib/restricted/boost/graph/include/boost/graph/graph_mutability_traits.hpp +++ b/contrib/restricted/boost/graph/include/boost/graph/graph_mutability_traits.hpp @@ -11,6 +11,7 @@ #include <boost/mpl/if.hpp> #include <boost/mpl/and.hpp> #include <boost/mpl/bool.hpp> +#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_same.hpp> namespace boost diff --git a/contrib/restricted/boost/graph/include/boost/graph/graphml.hpp b/contrib/restricted/boost/graph/include/boost/graph/graphml.hpp index de7630ec3d..5ba100fcd3 100644 --- a/contrib/restricted/boost/graph/include/boost/graph/graphml.hpp +++ b/contrib/restricted/boost/graph/include/boost/graph/graphml.hpp @@ -16,12 +16,16 @@ #include <boost/lexical_cast.hpp> #include <boost/any.hpp> #include <boost/type_traits/is_convertible.hpp> +#include <boost/graph/adjacency_list.hpp> #include <boost/graph/dll_import_export.hpp> -#include <boost/graph/graphviz.hpp> // for exceptions +#include <boost/graph/exception.hpp> +#include <boost/graph/graph_traits.hpp> + #include <boost/mpl/bool.hpp> #include <boost/mpl/vector.hpp> #include <boost/mpl/find.hpp> #include <boost/mpl/for_each.hpp> +#include <boost/property_map/dynamic_property_map.hpp> #include <boost/property_tree/detail/xml_parser_utils.hpp> #include <boost/throw_exception.hpp> #include <exception> diff --git a/contrib/restricted/boost/graph/include/boost/graph/graphviz.hpp b/contrib/restricted/boost/graph/include/boost/graph/graphviz.hpp index 37f5e40c89..9b37564d8a 100644 --- a/contrib/restricted/boost/graph/include/boost/graph/graphviz.hpp +++ b/contrib/restricted/boost/graph/include/boost/graph/graphviz.hpp @@ -18,6 +18,7 @@ #include <string> #include <boost/property_map/property_map.hpp> #include <boost/tuple/tuple.hpp> +#include <boost/graph/exception.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/properties.hpp> #include <boost/graph/subgraph.hpp> @@ -649,53 +650,6 @@ void write_graphviz_dp(std::ostream& out, const Graph& g, ///////////////////////////////////////////////////////////////////////////// // Graph reader exceptions ///////////////////////////////////////////////////////////////////////////// -struct BOOST_SYMBOL_VISIBLE graph_exception : public std::exception -{ - ~graph_exception() BOOST_OVERRIDE {} - const char* what() const noexcept BOOST_OVERRIDE = 0; -}; - -struct BOOST_SYMBOL_VISIBLE bad_parallel_edge : public graph_exception -{ - std::string from; - std::string to; - mutable std::string statement; - bad_parallel_edge(const std::string& i, const std::string& j) - : from(i), to(j) - { - } - - ~bad_parallel_edge() BOOST_OVERRIDE {} - const char* what() const noexcept BOOST_OVERRIDE - { - if (statement.empty()) - statement = std::string("Failed to add parallel edge: (") + from - + "," + to + ")\n"; - - return statement.c_str(); - } -}; - -struct BOOST_SYMBOL_VISIBLE directed_graph_error : public graph_exception -{ - ~directed_graph_error() BOOST_OVERRIDE {} - const char* what() const noexcept BOOST_OVERRIDE - { - return "read_graphviz: " - "Tried to read a directed graph into an undirected graph."; - } -}; - -struct BOOST_SYMBOL_VISIBLE undirected_graph_error : public graph_exception -{ - ~undirected_graph_error() BOOST_OVERRIDE {} - const char* what() const noexcept BOOST_OVERRIDE - { - return "read_graphviz: " - "Tried to read an undirected graph into a directed graph."; - } -}; - struct BOOST_SYMBOL_VISIBLE bad_graphviz_syntax : public graph_exception { std::string errmsg; diff --git a/contrib/restricted/boost/graph/include/boost/pending/property.hpp b/contrib/restricted/boost/graph/include/boost/pending/property.hpp index 8e98e84eac..6b4ee07f6c 100644 --- a/contrib/restricted/boost/graph/include/boost/pending/property.hpp +++ b/contrib/restricted/boost/graph/include/boost/pending/property.hpp @@ -6,6 +6,7 @@ #ifndef BOOST_PROPERTY_HPP #define BOOST_PROPERTY_HPP +#include <boost/config.hpp> #include <boost/mpl/bool.hpp> #include <boost/mpl/if.hpp> #include <boost/mpl/has_xxx.hpp> @@ -30,7 +31,7 @@ template < class Tag, class T, class Base = no_property > struct property // copy constructor and assignment operator will be generated by compiler T m_value; - Base m_base; + BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS Base m_base; }; // Kinds of properties diff --git a/contrib/restricted/boost/graph/src/read_graphviz_new.cpp b/contrib/restricted/boost/graph/src/read_graphviz_new.cpp index ca68fc3c50..99fc81bc4e 100644 --- a/contrib/restricted/boost/graph/src/read_graphviz_new.cpp +++ b/contrib/restricted/boost/graph/src/read_graphviz_new.cpp @@ -53,6 +53,7 @@ namespace boost namespace read_graphviz_detail { + static const long max_subgraph_nesting_level = 255; struct token { enum token_type @@ -207,7 +208,7 @@ namespace read_graphviz_detail tokenizer(const std::string& str) : begin(str.begin()), end(str.end()) { - std::string end_of_token = "(?=(?:\\W))"; + // std::string end_of_token = "(?=(?:\\W))"; // SEHE: unused? std::string whitespace = "(?:\\s+)"; std::string slash_slash_comment = "(?://.*?$)"; std::string slash_star_comment = "(?:/\\*.*?\\*/)"; @@ -527,6 +528,7 @@ namespace read_graphviz_detail std::map< subgraph_name, subgraph_info > subgraphs; std::string current_subgraph_name; int sgcounter; // Counter for anonymous subgraphs + long sgnesting_level; std::set< std::pair< node_name, node_name > > existing_edges; // Used for checking in strict graphs @@ -538,7 +540,7 @@ namespace read_graphviz_detail subgraph_member_list& current_members() { return current().members; } parser(const std::string& gr, parser_result& result) - : the_tokenizer(gr), lookahead(), r(result), sgcounter(0) + : the_tokenizer(gr), lookahead(), r(result), sgcounter(0), sgnesting_level(0) { current_subgraph_name = "___root___"; current() = subgraph_info(); // Initialize root graph @@ -773,10 +775,18 @@ namespace read_graphviz_detail bool is_anonymous = true; if (first_token.type == token::kw_subgraph) { - if (peek().type == token::identifier) + switch (peek().type) { + case token::identifier: name = get().normalized_value; is_anonymous = false; + break; + case token::left_brace: + is_anonymous = true; + break; + default: + error("Subgraph reference needs a name"); + break; } } if (is_anonymous) @@ -790,25 +800,30 @@ namespace read_graphviz_detail = current(); // Initialize properties and defaults subgraphs[name].members.clear(); // Except member list } - if (first_token.type == token::kw_subgraph - && peek().type != token::left_brace) + if (!is_anonymous && peek().type != token::left_brace) { - if (is_anonymous) - error("Subgraph reference needs a name"); return name; } subgraph_name old_sg = current_subgraph_name; + if (++sgnesting_level > max_subgraph_nesting_level) + { + error("Exceeded maximum subgraph nesting level"); + } current_subgraph_name = name; - if (peek().type == token::left_brace) - get(); - else - error("Wanted left brace to start subgraph"); + if (first_token.type != token::left_brace) + { + if (peek().type == token::left_brace) + get(); + else + error("Wanted left brace to start subgraph"); + } parse_stmt_list(); if (peek().type == token::right_brace) get(); else error("Wanted right brace to end subgraph"); current_subgraph_name = old_sg; + sgnesting_level -= 1; return name; } @@ -882,6 +897,7 @@ namespace read_graphviz_detail "port location"); } } + break; default: break; } diff --git a/contrib/restricted/boost/graph/ya.make b/contrib/restricted/boost/graph/ya.make index 61493bef63..9304ef84b0 100644 --- a/contrib/restricted/boost/graph/ya.make +++ b/contrib/restricted/boost/graph/ya.make @@ -10,9 +10,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(1.85.0) +VERSION(1.86.0) -ORIGINAL_SOURCE(https://github.com/boostorg/graph/archive/boost-1.85.0.tar.gz) +ORIGINAL_SOURCE(https://github.com/boostorg/graph/archive/boost-1.86.0.tar.gz) PEERDIR( contrib/restricted/boost/algorithm |