[Boost-bugs] [Boost C++ Libraries] #11722: boost::lockfree should use BOOST_LIKELY/UNLIKELY macros instead of defining likely/unlikely as inline fns

Subject: [Boost-bugs] [Boost C++ Libraries] #11722: boost::lockfree should use BOOST_LIKELY/UNLIKELY macros instead of defining likely/unlikely as inline fns
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-10-13 13:30:44


#11722: boost::lockfree should use BOOST_LIKELY/UNLIKELY macros instead of defining
likely/unlikely as inline fns
--------------------------------------------+--------------------------
 Reporter: Sampath Tilakumara <sampath@…> | Owner: timblechmann
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: lockfree
  Version: Boost 1.58.0 | Severity: Problem
 Keywords: likely, BOOST_LIKELY |
--------------------------------------------+--------------------------
 Currently boost::lockfree defines unlikely/unlikely inline functions in
 branch_hints.hpp. This name is generic and causes conflicts with other
 (external) libs which also defines likely/unlikely. (linux kernel also
 defines them the same).
 boost already has macros defined for this as BOOST_LIKELY/UNLIKELY in
 boost/config.hpp, and lockfree should use these to avoid conflicts and to
 be consistent.

 The following changes were done in boost_1_58_0, and tested to avoid a
 conflict case.

 {{{
 * Comment out the following lines: (not required; those files don’t use
 likely/unlikely)
 detail/tagged_ptr_dcas.hpp:#include
 <boost/lockfree/detail/branch_hints.hpp>
 detail/tagged_ptr_ptrcompression.hpp:#include
 <boost/lockfree/detail/branch_hints.hpp>

 * Replace the following include line with “#include <boost/config.hpp> //
 for BOOST_LIKELY”
 spsc_queue.hpp:#include <boost/lockfree/detail/branch_hints.hpp>

 * Add “#include <boost/config.hpp> // for BOOST_LIKELY” to queue.hpp

 * Change the following likely/unlikely to BOOST_LIKELY/BOOST_UNLIKELY
 queue.hpp: using detail::likely;
 queue.hpp: if (likely(tail == tail2)) {
 queue.hpp: using detail::likely;
 queue.hpp: if (likely(head == head2)) {
 spsc_queue.hpp: while (unlikely(ret >= max_size))

 * note that this makes the branch_hints.hpp redundant.
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11722>
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:19 UTC