Add GCC's "-Wuninitialized" workaround. When initializing the pointer of flags part of an uninitialized pointer plus bit object, the other part is used uninitialized. It's harmless warning but annoying for the user.

This commit is contained in:
Ion Gaztañaga
2017-12-09 13:01:02 +01:00
parent 4f9e77acfe
commit 71317671ec
2 changed files with 22 additions and 0 deletions

View File

@@ -3870,6 +3870,13 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std
[section:release_notes Release Notes]
[section:release_notes_boost_1_67_00 Boost 1.67 Release]
* Fixed bugs:
* [@https://github.com/boostorg/intrusive/issues/29 GitHub Issues #29: ['Uninitialized variable warning pointer_plus_bits.hpp]]
[endsect]
[section:release_notes_boost_1_65_00 Boost 1.65 Release]
* Fixed bugs:

View File

@@ -22,6 +22,17 @@
# pragma once
#endif
//GCC reports uninitialized values when an uninitialized pointer plus bits type
//is asigned some bits or some pointer value, but that's ok, because we don't want
//to default initialize parts that are not being updated.
#if defined(BOOST_GCC)
# if (BOOST_GCC >= 40600)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuninitialized"
# endif
#endif
namespace boost {
namespace intrusive {
@@ -89,6 +100,10 @@ struct pointer_plus_bits<T*, NumBits>
} //namespace intrusive
} //namespace boost
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
# pragma GCC diagnostic pop
#endif
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_POINTER_PLUS_BITS_HPP