[Boost-bugs] [Boost C++ Libraries] #8726: GCC 4.8 warns of variable set but not used

Subject: [Boost-bugs] [Boost C++ Libraries] #8726: GCC 4.8 warns of variable set but not used
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-24 19:46:21


#8726: GCC 4.8 warns of variable set but not used
-------------------------------------------+---------------------------
 Reporter: Chris Stylianou <chris5287@…> | Owner: ramey
     Type: Bugs | Status: new
Milestone: Boost 1.54.0 | Component: serialization
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-------------------------------------------+---------------------------
 When compiling with -Wall (GCC 4.8.0) the following warning is raised as
 an error:

 {{{
 libs/serialization/src/basic_iarchive.cpp: In member function ‘const
 boost::archive::detail::basic_pointer_iserializer*
 boost::archive::detail::basic_iarchive_impl::load_pointer(boost::archive::detail::basic_iarchive&,
 void*&, const boost::archive::detail::basic_pointer_iserializer*, const
 boost::archive::detail::basic_pointer_iserializer* (*)(const
 boost::serialization::extended_type_info&))’:
 libs/serialization/src/basic_iarchive.cpp:455:23: error: variable
 â€˜new_cid’ set but not used [-Werror=unused-but-set-variable]
          class_id_type new_cid =
 register_type(bpis_ptr->get_basic_serializer());
 }}}

 ''new_cid'' is only used to perform a BOOST_ASSERT, maybe this could be
 collapsed into one line?

 {{{
 Index: libs/serialization/src/basic_iarchive.cpp
 ===================================================================
 --- libs/serialization/src/basic_iarchive.cpp (revision 84899)
 +++ libs/serialization/src/basic_iarchive.cpp (working copy)
 @@ -452,10 +452,9 @@
              bpis_ptr = (*finder)(*eti);
          }
          BOOST_ASSERT(NULL != bpis_ptr);
 - class_id_type new_cid =
 register_type(bpis_ptr->get_basic_serializer());
 + BOOST_ASSERT(register_type(bpis_ptr->get_basic_serializer()) ==
 cid);
          int i = cid;
          cobject_id_vector[i].bpis_ptr = bpis_ptr;
 - BOOST_ASSERT(new_cid == cid);
      }
      int i = cid;
      cobject_id & co = cobject_id_vector[i];
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8726>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC