Ticket #12773: win32_shared_mutex.patch

File win32_shared_mutex.patch, 1.3 KB (added by Alexandre Pereira Nunes <alexandre.nunes@…>, 6 years ago)

Path fixing the warning/potential misbehavior

  • boost/thread/win32/shared_mutex.hpp

    diff -pru include/boost/thread/win32/shared_mutex.hpp /mnt/misc/win64/mingw64-x-boost/boost_1_63_0/boost/thread/win32/shared_mutex.hpp
    old new namespace boost  
    4747        T interlocked_compare_exchange(T* target,T new_value,T comparand)
    4848        {
    4949            BOOST_STATIC_ASSERT(sizeof(T)==sizeof(long));
    50             long const res=BOOST_INTERLOCKED_COMPARE_EXCHANGE(reinterpret_cast<long*>(target),
    51                                                               *reinterpret_cast<long*>(&new_value),
    52                                                               *reinterpret_cast<long*>(&comparand));
     50#ifdef __GNUC__
     51            typedef long __attribute__((__may_alias__)) long_a;
     52#else
     53            typedef long long_a;
     54#endif           
     55            long const res=BOOST_INTERLOCKED_COMPARE_EXCHANGE(reinterpret_cast<long_a*>(target),
     56                                                              *reinterpret_cast<long_a*>(&new_value),
     57                                                              *reinterpret_cast<long_a*>(&comparand));
    5358            return *reinterpret_cast<T const*>(&res);
    5459        }
    5560