Many instances of new warnings

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Many instances of new warnings

#1 Post by Oberlus »

Compiling current master (7b43176) I'm getting hundreds of the following two warnings:

Code: Select all

warning: ‘__visibility__’ attribute ignored [-Wattributes]
warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
I use

Code: Select all

gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
in Ubuntu 18.04.

I don't know if this is relevant. I'm reporting just in case.

User avatar
em3
Vacuum Dragon
Posts: 630
Joined: Sun Sep 25, 2011 2:51 pm

Re: Many instances of new warnings

#2 Post by em3 »

At least the second one seems severe. As if someone was passing a string literal to a function accepting pointers to non-const characters.
https://github.com/mmoderau
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Many instances of new warnings

#3 Post by Geoff the Medio »

em3 wrote: Fri Jan 22, 2021 2:37 pm...passing a string literal to a function accepting pointers to non-const characters.
Not really...

Code: Select all

static constexpr char* bool_regex = "(?i:true|false)";
should be

Code: Select all

static constexpr const char* bool_regex = "(?i:true|false)";
because while constexpr implies the pointer itself is const, that doesn't imply that the pointed-to chars are const, which is the source of the warning.

User avatar
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Re: Many instances of new warnings

#4 Post by Oberlus »

This one (another unused variable warning, that seemingly doesn't understand the [[maybe_unused]] tag) is epic:

Code: Select all

In file included from /home/lucas/Projects/FreeOrion/freeorion/universe/../util/../universe/Universe.h:16:0,
                 from /home/lucas/Projects/FreeOrion/freeorion/universe/../util/AppInterface.h:5,
                 from /home/lucas/Projects/FreeOrion/freeorion/universe/Fleet.h:5,
                 from /home/lucas/Projects/FreeOrion/freeorion/universe/Pathfinder.cpp:14:
/home/lucas/Projects/FreeOrion/freeorion/universe/../util/../universe/ObjectMap.h: In instantiation of ‘std::vector<std::shared_ptr<const _Tp> > ObjectMap::find(const UniverseObjectVisitor&) const [with T = UniverseObject]’:
/home/lucas/Projects/FreeOrion/freeorion/universe/Pathfinder.cpp:650:51:   required from ‘bool {anonymous}::GraphImpl::SystemPredicateFilter::operator()(const EdgeDescriptor&) const [with EdgeDescriptor = boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>]’
/usr/local/include/boost/graph/filtered_graph.hpp:76:31:   required from ‘bool boost::detail::out_edge_predicate<EdgePredicate, VertexPredicate, Graph>::operator()(const Edge&) const [with Edge = boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>; EdgePredicate = {anonymous}::GraphImpl::SystemPredicateFilter; VertexPredicate = boost::keep_all; Graph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>]’
/usr/local/include/boost/iterator/filter_iterator.hpp:101:49:   required from ‘void boost::iterators::filter_iterator<Predicate, Iterator>::satisfy_predicate() [with Predicate = boost::detail::out_edge_predicate<{anonymous}::GraphImpl::SystemPredicateFilter, boost::keep_all, boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter> >; Iterator = boost::detail::out_edge_iter<__gnu_cxx::__normal_iterator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >*, std::vector<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >, std::allocator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> > > > >, long unsigned int, boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>, long int>]’
/usr/local/include/boost/iterator/filter_iterator.hpp:60:28:   required from ‘boost::iterators::filter_iterator<Predicate, Iterator>::filter_iterator(Predicate, Iterator, Iterator) [with Predicate = boost::detail::out_edge_predicate<{anonymous}::GraphImpl::SystemPredicateFilter, boost::keep_all, boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter> >; Iterator = boost::detail::out_edge_iter<__gnu_cxx::__normal_iterator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >*, std::vector<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >, std::allocator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> > > > >, long unsigned int, boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>, long int>]’
/usr/local/include/boost/graph/filtered_graph.hpp:357:27:   required from ‘std::pair<typename boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>::out_edge_iterator, typename boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>::out_edge_iterator> boost::out_edges(typename boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>::vertex_descriptor, const boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>&) [with G = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >; EP = {anonymous}::GraphImpl::SystemPredicateFilter; VP = boost::keep_all; typename boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>::out_edge_iterator = boost::iterators::filter_iterator<boost::detail::out_edge_predicate<{anonymous}::GraphImpl::SystemPredicateFilter, boost::keep_all, boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter> >, boost::detail::out_edge_iter<__gnu_cxx::__normal_iterator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >*, std::vector<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >, std::allocator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> > > > >, long unsigned int, boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>, long int> >; typename boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>::vertex_descriptor = long unsigned int]’
/usr/local/include/boost/graph/breadth_first_search.hpp:80:46:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/local/include/boost/graph/dijkstra_shortest_paths.hpp:476:36:   required from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, ColorMap) [with VertexListGraph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<SystemPathing::PathFindingShortCircuitingVisitor>; PredecessorMap = int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, double, const double&, long unsigned int, const boost::property<boost::edge_weight_t, double>, boost::edge_weight_t>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, long unsigned int>; Compare = std::less<double>; Combine = std::plus<double>; DistInf = int; DistZero = int; ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, long unsigned int> >]’
/usr/local/include/boost/graph/dijkstra_shortest_paths.hpp:423:28:   required from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, const boost::bgl_named_params<T, Tag, Base>&, typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type) [with VertexListGraph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<SystemPathing::PathFindingShortCircuitingVisitor>; PredecessorMap = int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, double, const double&, long unsigned int, const boost::property<boost::edge_weight_t, double>, boost::edge_weight_t>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, long unsigned int>; Compare = std::less<double>; Combine = std::plus<double>; DistInf = int; DistZero = int; T = char; Tag = boost::detail::unused_tag_type; Base = boost::no_property; typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type = boost::graph::detail::no_parameter]’
/usr/local/include/boost/graph/dijkstra_shortest_paths.hpp:515:28:   required from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor) [with VertexListGraph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<SystemPathing::PathFindingShortCircuitingVisitor>; PredecessorMap = int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, double, const double&, long unsigned int, const boost::property<boost::edge_weight_t, double>, boost::edge_weight_t>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, long unsigned int>; Compare = std::less<double>; Combine = std::plus<double>; DistInf = int; DistZero = int]’
/usr/local/include/boost/graph/dijkstra_shortest_paths.hpp:535:28:   required from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor) [with VertexListGraph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>; DijkstraVisitor = boost::dijkstra_visitor<SystemPathing::PathFindingShortCircuitingVisitor>; PredecessorMap = int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, double, const double&, long unsigned int, const boost::property<boost::edge_weight_t, double>, boost::edge_weight_t>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, long unsigned int>; Compare = std::less<double>; Combine = std::plus<double>; DistInf = int; DistZero = int; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]’
/home/lucas/Projects/FreeOrion/freeorion/universe/Pathfinder.cpp:358:43:   required from ‘std::pair<std::__cxx11::list<int>, double> SystemPathing::ShortestPathImpl(const Graph&, int, int, double, const boost::unordered::unordered_map<int, long unsigned int>&) [with Graph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>]’
/home/lucas/Projects/FreeOrion/freeorion/universe/Pathfinder.cpp:1081:76:   required from here
/home/lucas/Projects/FreeOrion/freeorion/universe/../util/../universe/ObjectMap.h:290:49: warning: unused variable ‘ignored_id’ [-Wunused-variable]
     for ([[maybe_unused]] auto& [ignored_id, obj] : Map<mutableT>()) {
I struggle with C++ syntax (it's quite different from the little C++ I learnt during my degree 20 years ago), but this Boost library and the whole OO stuff was born in hell.

User avatar
em3
Vacuum Dragon
Posts: 630
Joined: Sun Sep 25, 2011 2:51 pm

Re: Many instances of new warnings

#5 Post by em3 »

Oberlus wrote: Sat Jan 23, 2021 1:06 pmI struggle with C++ syntax (it's quite different from the little C++ I learnt during my degree 20 years ago), but this Boost library and the whole OO stuff was born in hell.
Oh, the OO stuff is not the problem. Templates and meta-programming are. They are a powerful tool, but analyzing code that actually comes into existence during compilation is its own kind of fun. Mind you, that stuff was around 20 years ago too.
https://github.com/mmoderau
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Many instances of new warnings

#6 Post by Geoff the Medio »

Template expansion spam / vomit compiler error and warning messages are daunting to look at at first, but I find they're not usually that bad once one is used to reading them... or rather not reading most of them. The main trick for most cases is to look near the bottom or top for the relevant line in the .h or .cpp file that you actually wrote, and ignore the rest saying what other lines of some Boost header was instantiated or included.
So

Code: Select all

In file included from /home/lucas/Projects/FreeOrion/freeorion/universe/../util/../universe/Universe.h:16:0,
                 from /home/lucas/Projects/FreeOrion/freeorion/universe/../util/AppInterface.h:5,
                 from /home/lucas/Projects/FreeOrion/freeorion/universe/Fleet.h:5,
                 from /home/lucas/Projects/FreeOrion/freeorion/universe/Pathfinder.cpp:14:
/home/lucas/Projects/FreeOrion/freeorion/universe/../util/../universe/ObjectMap.h: In instantiation of ‘std::vector<std::shared_ptr<const _Tp> > ObjectMap::find(const UniverseObjectVisitor&) const [with T = UniverseObject]’:
/home/lucas/Projects/FreeOrion/freeorion/universe/Pathfinder.cpp:650:51:   required from ‘bool {anonymous}::GraphImpl::SystemPredicateFilter::operator()(const EdgeDescriptor&) const [with EdgeDescriptor = boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>]’
/usr/local/include/boost/graph/filtered_graph.hpp:76:31:   required from ‘bool boost::detail::out_edge_predicate<EdgePredicate, VertexPredicate, Graph>::operator()(const Edge&) const [with Edge = boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>; EdgePredicate = {anonymous}::GraphImpl::SystemPredicateFilter; VertexPredicate = boost::keep_all; Graph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>]’
/usr/local/include/boost/iterator/filter_iterator.hpp:101:49:   required from ‘void boost::iterators::filter_iterator<Predicate, Iterator>::satisfy_predicate() [with Predicate = boost::detail::out_edge_predicate<{anonymous}::GraphImpl::SystemPredicateFilter, boost::keep_all, boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter> >; Iterator = boost::detail::out_edge_iter<__gnu_cxx::__normal_iterator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >*, std::vector<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >, std::allocator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> > > > >, long unsigned int, boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>, long int>]’
/usr/local/include/boost/iterator/filter_iterator.hpp:60:28:   required from ‘boost::iterators::filter_iterator<Predicate, Iterator>::filter_iterator(Predicate, Iterator, Iterator) [with Predicate = boost::detail::out_edge_predicate<{anonymous}::GraphImpl::SystemPredicateFilter, boost::keep_all, boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter> >; Iterator = boost::detail::out_edge_iter<__gnu_cxx::__normal_iterator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >*, std::vector<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >, std::allocator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> > > > >, long unsigned int, boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>, long int>]’
/usr/local/include/boost/graph/filtered_graph.hpp:357:27:   required from ‘std::pair<typename boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>::out_edge_iterator, typename boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>::out_edge_iterator> boost::out_edges(typename boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>::vertex_descriptor, const boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>&) [with G = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >; EP = {anonymous}::GraphImpl::SystemPredicateFilter; VP = boost::keep_all; typename boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>::out_edge_iterator = boost::iterators::filter_iterator<boost::detail::out_edge_predicate<{anonymous}::GraphImpl::SystemPredicateFilter, boost::keep_all, boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter> >, boost::detail::out_edge_iter<__gnu_cxx::__normal_iterator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >*, std::vector<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> >, std::allocator<boost::detail::stored_edge_iter<long unsigned int, std::_List_iterator<boost::list_edge<long unsigned int, boost::property<boost::edge_weight_t, double> > >, boost::property<boost::edge_weight_t, double> > > > >, long unsigned int, boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>, long int> >; typename boost::filtered_graph<Graph, EdgePredicate, VertexPredicate>::vertex_descriptor = long unsigned int]’
/usr/local/include/boost/graph/breadth_first_search.hpp:80:46:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/local/include/boost/graph/dijkstra_shortest_paths.hpp:476:36:   required from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, ColorMap) [with VertexListGraph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<SystemPathing::PathFindingShortCircuitingVisitor>; PredecessorMap = int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, double, const double&, long unsigned int, const boost::property<boost::edge_weight_t, double>, boost::edge_weight_t>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, long unsigned int>; Compare = std::less<double>; Combine = std::plus<double>; DistInf = int; DistZero = int; ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, long unsigned int> >]’
/usr/local/include/boost/graph/dijkstra_shortest_paths.hpp:423:28:   required from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, const boost::bgl_named_params<T, Tag, Base>&, typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type) [with VertexListGraph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<SystemPathing::PathFindingShortCircuitingVisitor>; PredecessorMap = int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, double, const double&, long unsigned int, const boost::property<boost::edge_weight_t, double>, boost::edge_weight_t>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, long unsigned int>; Compare = std::less<double>; Combine = std::plus<double>; DistInf = int; DistZero = int; T = char; Tag = boost::detail::unused_tag_type; Base = boost::no_property; typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type = boost::graph::detail::no_parameter]’
/usr/local/include/boost/graph/dijkstra_shortest_paths.hpp:515:28:   required from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor) [with VertexListGraph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<SystemPathing::PathFindingShortCircuitingVisitor>; PredecessorMap = int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, double, const double&, long unsigned int, const boost::property<boost::edge_weight_t, double>, boost::edge_weight_t>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, long unsigned int>; Compare = std::less<double>; Combine = std::plus<double>; DistInf = int; DistZero = int]’
/usr/local/include/boost/graph/dijkstra_shortest_paths.hpp:535:28:   required from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor) [with VertexListGraph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>; DijkstraVisitor = boost::dijkstra_visitor<SystemPathing::PathFindingShortCircuitingVisitor>; PredecessorMap = int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, double, const double&, long unsigned int, const boost::property<boost::edge_weight_t, double>, boost::edge_weight_t>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, long unsigned int>; Compare = std::less<double>; Combine = std::plus<double>; DistInf = int; DistZero = int; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]’
/home/lucas/Projects/FreeOrion/freeorion/universe/Pathfinder.cpp:358:43:   required from ‘std::pair<std::__cxx11::list<int>, double> SystemPathing::ShortestPathImpl(const Graph&, int, int, double, const boost::unordered::unordered_map<int, long unsigned int>&) [with Graph = boost::filtered_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<SystemPathing::vertex_system_id_t, int, boost::property<boost::vertex_index_t, int> >, boost::property<boost::edge_weight_t, double> >, {anonymous}::GraphImpl::SystemPredicateFilter>]’
/home/lucas/Projects/FreeOrion/freeorion/universe/Pathfinder.cpp:1081:76:   required from here
/home/lucas/Projects/FreeOrion/freeorion/universe/../util/../universe/ObjectMap.h:290:49: warning: unused variable ‘ignored_id’ [-Wunused-variable]
     for ([[maybe_unused]] auto& [ignored_id, obj] : Map<mutableT>()) {
is really just:

Code: Select all

[stuff]
...
ObjectMap.h:290:49: warning: unused variable ‘ignored_id’ [-Wunused-variable]
     for ([[maybe_unused]] auto& [ignored_id, obj] : Map<mutableT>()) {

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Many instances of new warnings

#7 Post by Vezzra »

em3 wrote: Tue Jan 26, 2021 11:01 amOh, the OO stuff is not the problem. Templates and meta-programming are. They are a powerful tool, but analyzing code that actually comes into existence during compilation is its own kind of fun.
Yeah, erm... sure, you can call that "fun". I'd like to compare that particular kind of fun to Dwarf Fortress' HFS kind of "fun". After all, both have a lot to do with "hell"... :twisted:

User avatar
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Re: Many instances of new warnings

#8 Post by Oberlus »

Geoff the Medio wrote: Tue Jan 26, 2021 11:57 am
I for once paid some attention to the compilation warnings.

Maybe this one is relevant:

Code: Select all

UI/MapWnd.cpp:4143:17: warning: unused variable ‘radius_i’ [-Wunused-variable]
             int radius_i = static_cast<int>(radius);
                 ^~~~~~~~
At the code I find this:

Code: Select all

            int radius_i = static_cast<int>(radius);
            GG::Pt rad_pt{GG::X(radius), GG::Y(radius)};
Either radius_i is to be removed (and this is a harmless warning) or it should be used instead of radius in the following line (and this could be a bug).

This one is similar:

Code: Select all

UI/GovernmentWnd.cpp:670:22: warning: unused variable ‘avail’ [-Wunused-variable]
         Availability avail = static_cast<Availability>(n);
                      ^~~~~
Uses of Availability(no) should be avail or avail should be removed?

Code: Select all

        Availability avail = static_cast<Availability>(n);
        auto& button = m_availabilities_buttons[n];
        button = GG::Wnd::Create<CUIStateButton>(UserString(BUTTON_LABELS[n]),
                                                 GG::FORMAT_CENTER, std::make_shared<CUILabelButtonRepresenter>());
        AttachChild(button);
        button->CheckedSignal.connect(
            boost::bind(&GovernmentWnd::PolicyPalette::ToggleAvailability, this, Availability(n)));
        button->SetCheck(m_availabilities_state.GetAvailability(Availability(n)));

Most of the other unused variable warning seem to me variables that doesn't need to be declared. Geoff, is it OK if I spend some time trying to clear those out (and playtest it?) or would that mess with your ongoing changes?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Many instances of new warnings

#9 Post by Geoff the Medio »

Oberlus wrote: Sat Mar 05, 2022 4:12 pmis it OK if I spend some time trying to clear those out (and playtest it?) or would that mess with your ongoing changes?
Probably won't interfere with my current changes.

Post Reply