MFC r239960:

  Properly enable Clang-style atomics when available.

  In addition to testing against cxx_atomic, we must check c_atomic. The
  former is only set when building C++ code. Also use __has_extension
  instead of __has_feature. This allows us to use the atomics outside of
  C11.

PR:	threads/170073
MFC r240970:

  - Make C11 atomic macros usable in expressions:
    - Replace do-while statements with void expressions.
    - Wrap __asm statements in statement expressions.
  - Make the macros function-like:
    - Evaluate all arguments exactly once.
    - Make sure there's a sequence point between evaluation of the
      arguments and the function body. Arguments should be evaluated
      before any memory barriers.
  - Fix use of __atomic_is_lock_free built-in. It requires the address
    of an atomic variable as second argument. Use this built-in on clang
    as well because clang's __c11_atomic_is_lock_free only takes the size
    of the variable into account.
  - In atomic_exchange_explicit put the barrier before instead of after
    the __sync_lock_test_and_set call.
Merge remote-tracking branch 'upstream-github/stable/9' into stable/9