OpenImageIO/oiio — pull request #492 by sambler (2013-01-23 14:02:41+00:00)
Title: Change regarding USE_GCC_ATOMICS and USE_TBB

An issue was discovered when using oiio with tbb on a i386 FreeBSD machine. I then found that the cpu instructions to be able to use gcc atomics are available when arch is set to i586 or higher and adding -march=i586 to the CXXFLAGS enabled the use of gcc atomics and removed the need for tbb, thus fixing the issue. Instead of manually adding this to the environment flags this could be merged into the cmake definitions as I have done in platform.cmake to always be available. Given the age of a i586 arch machine I don't see a problem with it being the oldest supported architecture.

I also made a change to thread.h to ensure that only USE_GCC_ATOMICS or USE_TBB get defined never both. This change also allows the definition of USE_GCC_ATOMICS on FreeBSD 32bit when the minimum arch may have been the only reason to not enable it before. I find that clang honours the GCC definitions and builds under these conditions as well.

If you don't want to add the arch flag to cmake I would add a comment to the thread.h change to say that -march=i586 or higher needs to be added to the CXXFLAGS for 32bit build. There is also the possibility of testing ARCH before defining USE_GCC_ATOMICS.