Opened 6 years ago
Closed 5 years ago
#12941 closed Support Requests (worksforme)
MinGW- Ignore return value from BOOST_INTERLOCKED_EXCHANGE
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Component: | thread | |
Version: | Boost 1.63.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Warnings are created by MinGW for ignoring the return value in boost::detail::interlocked_read_acquire
:
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); } } }
My proposed fix it to cast the return value to void
:
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); } } }
It would also be possible to use static_cast<void>(...)
:
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<void>(BOOST_INTERLOCKED_EXCHANGE(x,value)); } inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT { static_cast<void>(BOOST_INTERLOCKED_EXCHANGE_POINTER(x,value)); } } }
Attachments (1)
Change History (5)
by , 6 years ago
Attachment: | 0001-Ignore-EXCHANGE-return-value.patch added |
---|
comment:1 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Summary: | Ignore return value from BOOST_INTERLOCKED_EXCHANGE → MinGW- Ignore return value from BOOST_INTERLOCKED_EXCHANGE |
This code doesn't exists anymore.
From which version is the patch?
comment:2 by , 5 years ago
Type: | Bugs → Support Requests |
---|
comment:3 by , 5 years ago
It was from 1.63 but the code has had a cast added to the pointer. The patch is now:
--- 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
comment:4 by , 5 years ago
Milestone: | To Be Determined |
---|---|
Resolution: | → worksforme |
Status: | assigned → closed |
Closed as the code is not there anymore.
Note:
See TracTickets
for help on using tickets.
Proposed cast to (void) patch