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

Ignore knownConditionTrueFalse in static assertions #7098

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mptre
Copy link
Contributor

@mptre mptre commented Dec 12, 2024

_Static_assert (deprecated in C23) should be treated like static_assert.

lib/checkother.cpp Outdated Show resolved Hide resolved
@mptre
Copy link
Contributor Author

mptre commented Dec 12, 2024 via email

@@ -2700,7 +2706,7 @@ void CheckOther::checkDuplicateExpression()
while (parent && parent->astParent()) {
parent = parent->astParent();
}
if (parent && parent->previous() && parent->strAt(-1) == "static_assert") {
if (parent && parent->previous() && isStaticAssert(parent->previous())) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. technically the && parent->previous() is redundant. I could live with a redundant condition but I prefer that it's removed. Token::Match is well-known to check the parameter imho.

_Static_assert (deprecated in C23) should be treated like static_assert.
@mptre
Copy link
Contributor Author

mptre commented Dec 15, 2024 via email

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.

3 participants