Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct misuses of __has_cpp_attribute #4812

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CaseyCarter
Copy link

Pull Request Prelude

Changes Proposed

__has_cpp_attribute is for detecting support for attribute-tokens like fallthrough or unlikely. These queries with feature-test macro names are always going to fail since no implementation will ever support an attribute-token with the same name as a feature-test macro. Given the conditional use of library facilities, the intent here is clearly to test the feature-test macros to determine support for those facilities, so let's do that instead.

I've also fixed the using-declaration for std::to_underlying.

Drive-by: Removed extraneous inline in the definition of the constexpr fallback for to_underlying; constexpr functions are implicitly inline.

Issues addressed: None

`__has_cpp_attribute` is for detecting support for attribute-tokens like `fallthrough` or `unlikely`. This queries with feature-test macro names are always going to fail: no implementation will ever support an attribute-token with the same name as a feature-test macro. Given the conditional use of library facilities, the intent here was clearly to test the feature-test macros to determine support for those facilities, so let's do that instead.

I've also fixed the using-declaration for `std::to_underlying`.

Drive-by: Removed extraneous `inline` in the definition of the `constexpr` `to_underlying` fallback; `constexpr` functions are implicitly inline.
src/tools.h Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant