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

Test for __has_cpp_attribute before clang-specific feature #1230

Merged
merged 1 commit into from
Apr 11, 2025

Conversation

vadz
Copy link
Member

@vadz vadz commented Apr 11, 2025

Make SOCI_HAS_CLANG_FEATURE() really clang-specific, as it could also return true for gcc 14, which implements support for __has_feature() too.

And test for the standard __has_cpp_attribute and use the standard [[fallthrough]] attribute before testing for clang-specific feature and using [[clang::fallthrough]] -- standard attribute should be preferred.

This fixes the build with gcc 14.

Without testing for clang, it could also return true for gcc 14, which
implements support for __has_feature() too, resulting in errors due to
using clang-specific clang::fallthrough attribute with gcc.

Note that we can't just avoid using clang attribute because clang would
return true from __has_cpp_attribute(fallthrough) even when not using
C++17 but then would give a warning about using C++17 attribute when
actually using it.
@vadz vadz merged commit e337a09 into SOCI:master Apr 11, 2025
25 checks passed
@vadz vadz deleted the gcc14-gix branch April 11, 2025 12:49
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