In poking around at bson-compat.h, I noticed this section of code:
#if defined(__GNUC__)
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
#define bson_sync_synchronize() __sync_synchronize ()
#elif defined(__i386__) || defined(__i486__) || defined(__i586__) || \
defined(__i686__) || defined(__x86_64__)
#define bson_sync_synchronize() asm volatile("mfence" ::: "memory")
#else
#define bson_sync_synchronize() asm volatile("sync" ::: "memory")
#endif
#elif defined(_MSC_VER)
#define bson_sync_synchronize() MemoryBarrier ()
#endif
The conditional around whether or not to use __sync_synchronize () is based on a GCC version of 4.1. However, the oldest GCC version we use (e.g., for building/testing in Evergreen) is 4.4 on RHEL 6 and 4.8 on Ubuntu 14.04. That would make most of this conditional obsolete and we should consider removal of the dead branches.