Boost C++ Libraries: Ticket #11722: boost::lockfree should use BOOST_LIKELY/UNLIKELY macros instead of defining likely/unlikely as inline fns https://svn.boost.org/trac10/ticket/11722 <p> 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. </p> <p> The following changes were done in boost_1_58_0, and tested to avoid a conflict case. </p> <pre class="wiki">* Comment out the following lines: (not required; those files don’t use likely/unlikely) detail/tagged_ptr_dcas.hpp:#include &lt;boost/lockfree/detail/branch_hints.hpp&gt; detail/tagged_ptr_ptrcompression.hpp:#include &lt;boost/lockfree/detail/branch_hints.hpp&gt; * Replace the following include line with “#include &lt;boost/config.hpp&gt; // for BOOST_LIKELY” spsc_queue.hpp:#include &lt;boost/lockfree/detail/branch_hints.hpp&gt; * Add “#include &lt;boost/config.hpp&gt; // 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 &gt;= max_size)) * note that this makes the branch_hints.hpp redundant. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11722 Trac 1.4.3 Sampath Tilakumara <sampath@…> Tue, 13 Oct 2015 13:38:37 GMT <link>https://svn.boost.org/trac10/ticket/11722#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11722#comment:1</guid> <description> <p> Note that the mentioned changes were done in a "local copy" of boost_1_58_0; not committed to boost. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>timblechmann</dc:creator> <pubDate>Tue, 13 Oct 2015 17:06:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11722#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11722#comment:2</guid> <description> <p> could you submit a pull request on github? </p> <p> thnx, tim </p> </description> <category>Ticket</category> </item> <item> <author>Sampath Tilakumara <sampath@…></author> <pubDate>Sat, 17 Oct 2015 11:02:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11722#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11722#comment:3</guid> <description> <p> Pull request submitted. <a class="ext-link" href="https://github.com/wolfie2x/lockfree/commit/14039a027433a0a9d6b5f7bfd7b54c157997ea90"><span class="icon">​</span>https://github.com/wolfie2x/lockfree/commit/14039a027433a0a9d6b5f7bfd7b54c157997ea90</a> </p> <p> Let me know if there's anything more I could do. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>timblechmann</dc:creator> <pubDate>Sat, 17 Oct 2015 11:25:15 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11722#comment:4 https://svn.boost.org/trac10/ticket/11722#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket