Skip to content

clang-tidy: drop some redundant conditions reported by misc-redundant-expression#20644

Closed
vszakats wants to merge 3 commits intocurl:masterfrom
vszakats:ctidy8
Closed

clang-tidy: drop some redundant conditions reported by misc-redundant-expression#20644
vszakats wants to merge 3 commits intocurl:masterfrom
vszakats:ctidy8

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Feb 20, 2026

Not enforced due to false positives, and because in cases a redundant
expression (e.g. encapsulated in a macro) may be preferred.

Ref: https://clang.llvm.org/extra/clang-tidy/checks/misc/redundant-expression.html

@vszakats vszakats marked this pull request as draft February 20, 2026 13:01
@vszakats
Copy link
Member Author

vszakats commented Feb 20, 2026

home/runner/work/curl/curl/lib/cf-socket.c:1597:52: error: operator has equivalent nested operands [misc-redundant-expression,-warnings-as-errors]
 1597 |   pfd[0].events = POLLRDNORM | POLLIN | POLLRDBAND | POLLPRI;
      |          

@testclutch

This comment was marked as resolved.

@vszakats vszakats changed the title clang-tidy: check misc-redundant-expression, fix fallouts clang-tidy: drop redundant conditions reported via misc-redundant-expression Feb 20, 2026
@vszakats vszakats marked this pull request as ready for review February 20, 2026 16:47
@vszakats vszakats changed the title clang-tidy: drop redundant conditions reported via misc-redundant-expression clang-tidy: drop redundant conditions reported by misc-redundant-expression Feb 20, 2026
@vszakats vszakats changed the title clang-tidy: drop redundant conditions reported by misc-redundant-expression clang-tidy: drop some redundant conditions reported by misc-redundant-expression Feb 20, 2026
@vszakats
Copy link
Member Author

vszakats commented Feb 21, 2026

Not applied to this case (it'd need unwrapping the macro):

curl/lib/vtls/vtls_scache.c

Lines 315 to 320 in 078b303

if(scache && !GOOD_SCACHE(scache)) {
failf(data, "transfer would use an invalid scache at %p, denied",
(void *)scache);
DEBUGASSERT(0);
return NULL;
}

@vszakats vszakats closed this in 020f48d Feb 21, 2026
@vszakats vszakats deleted the ctidy8 branch February 21, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants