According to [1] we only support gcc 5.1+. So these checks for older gcc versions are not supported.
Some gcc 5.1+ versions still don't support has_builtin, so just check GNUC__ in those cases.
Add a missing #endif for LLVM_ATTRIBUTE_UNREACHABLE.
[1] https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library
For gcc this change results in LLVM_HAS_RVALUE_REFERENCE_THIS set to 0.
That is because __ has_feature(x) is always 0 for gcc regardless of the version (I use 7.4.0).
__has_feature is not and will not be defined for gcc. (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60512). Please consider fixing or reverting this patch.