[Boost-bugs] [Boost C++ Libraries] #7140: asio fenced_block should use gcc builtin atomics when available on ARM

Subject: [Boost-bugs] [Boost C++ Libraries] #7140: asio fenced_block should use gcc builtin atomics when available on ARM
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-07-17 11:18:11


#7140: asio fenced_block should use gcc builtin atomics when available on ARM
-------------------------------+--------------------------------------------
 Reporter: lars@… | Owner: chris_kohlhoff
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
  Version: Boost 1.51.0 | Severity: Problem
 Keywords: |
-------------------------------+--------------------------------------------
 I am the lucky owner of a Raspberry Pi, and I have been trying to compile
 some code that uses boost asio on it (with the Raspbian armhf distro with
 boost 1.49 and gcc 4.6.3).

 I get a lot of "Warning: swp{b} use is deprecated for this architecture",
 some of which originate from gcc_arm_fenced_block.hpp.

 After a bit of looking around I realized that gcc 4.6.3 actually has
 support for the builtin atomics on this platform, so that
 gcc_sync_fenced_block.hpp could be used intead of trying to fix the
 assembler stuff in gcc_arm_fenced_block.hpp.

 So I propose the following fix to fenced_block.hpp:

 {{{
 28c28
 < #elif defined(__GNUC__) && defined(__arm__)
 ---
> #elif defined(__GNUC__) && defined(__arm__) &&
 !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
 57c57
 < #elif defined(__GNUC__) && defined(__arm__)
 ---
> #elif defined(__GNUC__) && defined(__arm__) &&
 !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
 }}}
 Basically just skips using the gcc_arm_fenced_block if
 !__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 is defined, and lets the _sync_ one
 get used instead.

 Of course I know that the !__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 is actually
 not defined for all gcc versions where the builtins are available, but
 here we at least will use them when that symbol is defined, rather than
 not at all.

 I will write a similar ticket for boost smart_ptr, which suffers the same
 problem.

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