I agree, Clang defines __GNUC__ to value 4 for compatibility reasons. Likewise, this change doesn't handle compilers other than GCC that don't support __has_cpp_attribute (yet).
#ifndef __has_cpp_attribute #define __has_cpp_attribute(__x) 0 #endif
Also Kelvin is right that _GNUC_VER is not defined here (it's from libcxx). Maybe we should take the macros from LLVM (except the non-C++ case)? That would also give us a correct checking for gnu::fallthrough, but remove __attribute__((__fallthrough__)) completely.