Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HEDLEY_HAS_CPP_ATTRIBUTE_NS macro
Several compilers (at least PGI and MSVC < 2019) have trouble with namespaced C++ attributes (e.g., clang::fallthrough instead of fallthrough). This macro is defined to (0) for such compilers, while it passes ns::attribute through to __has_cpp_attribute for compilers which do support namespaced attributes. IIRC namespaced attributes are mentioned in C++17, so compilers should stop having this problem soon. This patch also migrates the HEDLEY_FALL_THROUGH checks to use this macro, which does simplify it somewhat. I also dropped the gnu::fallthrough since AFAICT it doesn't really add anything, but clang::fallthrough is preferred to fallthrough when available since it avoids a possible warning on clang in C++ < C++17 about falllthrough being a C++17 feature. Finally, the GCC-style attribute is preferred for similar reasons.
- Loading branch information