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

Fix for "garbage" bits #355

Merged
merged 2 commits into from
Nov 12, 2024
Merged

Fix for "garbage" bits #355

merged 2 commits into from
Nov 12, 2024

Conversation

serges147
Copy link

Small fix for clang-tidy false positive about using garbage data during serialization, like following:

/home/runner/work/demos/demos/libudpard_demo/build/transpiled/nunavut/support/serialization.h:154:36: error: The left operand of '&' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult,-warnings-as-errors]
            *last_dst = (*last_dst & (uint8_t)~mask) | (*last_src & mask);
                                   ^

*last_dst = (*last_dst & (uint8_t)~mask) | (*last_src & mask);
// No lint for "The left operand of '&' is a garbage value" because
// these so called "garbage" bits of `*last_dst` won't be used during deserialization.
*last_dst = (*last_dst & (uint8_t)~mask) | (*last_src & mask); // NOLINT
Copy link
Member

Choose a reason for hiding this comment

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

it is best to add the rule ID like // NOLINT(rule-id) to avoid unintentional suppression of other diagnostics

Copy link

sonarcloud bot commented Nov 12, 2024

@thirtytwobits thirtytwobits merged commit 2bdc442 into 3.0.preview Nov 12, 2024
236 checks passed
@thirtytwobits thirtytwobits deleted the sshirokov/demos_issue_18 branch November 12, 2024 22:11
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