Boost C++ Libraries: Ticket #12941: MinGW- Ignore return value from BOOST_INTERLOCKED_EXCHANGE https://svn.boost.org/trac10/ticket/12941 <p> Warnings are created by MinGW for ignoring the return value in <code>boost::detail::interlocked_read_acquire</code>: </p> <pre class="wiki">namespace boost { namespace detail { inline long interlocked_read_acquire(long volatile* x) BOOST_NOEXCEPT { return BOOST_INTERLOCKED_COMPARE_EXCHANGE(x,0,0); } inline void* interlocked_read_acquire(void* volatile* x) BOOST_NOEXCEPT { return BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(x,0,0); } inline void interlocked_write_release(long volatile* x,long value) BOOST_NOEXCEPT { BOOST_INTERLOCKED_EXCHANGE(x,value); } inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT { BOOST_INTERLOCKED_EXCHANGE_POINTER(x,value); } } } </pre><p> My proposed fix it to cast the return value to <code>void</code>: </p> <pre class="wiki">namespace boost { namespace detail { inline long interlocked_read_acquire(long volatile* x) BOOST_NOEXCEPT { return BOOST_INTERLOCKED_COMPARE_EXCHANGE(x,0,0); } inline void* interlocked_read_acquire(void* volatile* x) BOOST_NOEXCEPT { return BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(x,0,0); } inline void interlocked_write_release(long volatile* x,long value) BOOST_NOEXCEPT { (void)BOOST_INTERLOCKED_EXCHANGE(x,value); } inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT { (void)BOOST_INTERLOCKED_EXCHANGE_POINTER(x,value); } } } </pre><p> It would also be possible to use <code>static_cast&lt;void&gt;(...)</code>: </p> <pre class="wiki">namespace boost { namespace detail { inline long interlocked_read_acquire(long volatile* x) BOOST_NOEXCEPT { return BOOST_INTERLOCKED_COMPARE_EXCHANGE(x,0,0); } inline void* interlocked_read_acquire(void* volatile* x) BOOST_NOEXCEPT { return BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(x,0,0); } inline void interlocked_write_release(long volatile* x,long value) BOOST_NOEXCEPT { static_cast&lt;void&gt;(BOOST_INTERLOCKED_EXCHANGE(x,value)); } inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT { static_cast&lt;void&gt;(BOOST_INTERLOCKED_EXCHANGE_POINTER(x,value)); } } } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12941 Trac 1.4.3 mattyclarkson@… Thu, 30 Mar 2017 10:04:42 GMT attachment set https://svn.boost.org/trac10/ticket/12941 https://svn.boost.org/trac10/ticket/12941 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">0001-Ignore-EXCHANGE-return-value.patch</span> </li> </ul> <p> Proposed cast to (void) patch </p> Ticket viboes Sat, 29 Apr 2017 01:59:58 GMT owner, status, summary changed https://svn.boost.org/trac10/ticket/12941#comment:1 https://svn.boost.org/trac10/ticket/12941#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>summary</strong> <span class="trac-field-old">Ignore return value from BOOST_INTERLOCKED_EXCHANGE</span> → <span class="trac-field-new">MinGW- Ignore return value from BOOST_INTERLOCKED_EXCHANGE</span> </li> </ul> <p> This code doesn't exists anymore. </p> <p> From which version is the patch? </p> Ticket viboes Sat, 29 Apr 2017 16:05:58 GMT type changed https://svn.boost.org/trac10/ticket/12941#comment:2 https://svn.boost.org/trac10/ticket/12941#comment:2 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Support Requests</span> </li> </ul> Ticket mattyclarkson@… Sun, 30 Apr 2017 17:53:32 GMT <link>https://svn.boost.org/trac10/ticket/12941#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12941#comment:3</guid> <description> <p> It was from 1.63 but the code has had a cast added to the pointer. The patch is now: </p> <pre class="wiki">--- boost/thread/win32/interlocked_read.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boost/thread/win32/interlocked_read.hpp b/boost/thread/win32/interlocked_read.hpp index 2ad3fe9..0a16407 100644 --- a/boost/thread/win32/interlocked_read.hpp +++ b/boost/thread/win32/interlocked_read.hpp @@ -61,11 +61,11 @@ namespace boost } inline void interlocked_write_release(long volatile* x,long value) BOOST_NOEXCEPT { - BOOST_INTERLOCKED_EXCHANGE((long*)x,value); + (void)BOOST_INTERLOCKED_EXCHANGE((long*)x,value); } inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT { - BOOST_INTERLOCKED_EXCHANGE_POINTER((void**)x,value); + (void)BOOST_INTERLOCKED_EXCHANGE_POINTER((void**)x,value); } } } -- 1.7.10.4 </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 16 Sep 2017 16:46:04 GMT</pubDate> <title>status changed; resolution set; milestone deleted https://svn.boost.org/trac10/ticket/12941#comment:4 https://svn.boost.org/trac10/ticket/12941#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> <li><strong>milestone</strong> <span class="trac-field-deleted">To Be Determined</span> </li> </ul> <p> Closed as the code is not there anymore. </p> Ticket