Skip to content

Conversation

@aaronliu0130
Copy link
Member

Immunize lines with &(struct in them

Should fix #201

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a false positive in the trailing semicolon checker that incorrectly flagged compound literal references (address-of expressions with struct compound literals like &(struct name){}) as having unnecessary semicolons. The fix adds a condition to skip the warning when the code contains the pattern of an ampersand followed by a struct compound literal.

  • Adds logic to detect and exempt &(struct ...){} patterns from semicolon warnings
  • Includes a test case to verify the fix

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cpplint.py Adds check to suppress semicolon warnings for struct compound literal references by detecting & before (struct pattern
cpplint_unittest.py Adds test case verifying &(struct mount_attr){} doesn't trigger false positive

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

aaronliu0130 and others added 2 commits November 28, 2025 15:19
let's see if the \s makes the tests fail

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@aaronliu0130 aaronliu0130 changed the title fix(braces): false positive for ; after {} in struct reference fix(braces): false positive for ; after {} in &struct/union Nov 28, 2025
@aaronliu0130 aaronliu0130 changed the title fix(braces): false positive for ; after {} in &struct/union fix(braces): F+ for ; after {} in struct/union reference Nov 28, 2025
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.

[readability/braces] False positive for ; after {} in struct reference

1 participant