-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Add clarifying parenthesis around non-trivial conditions in ternary expressions. #90391
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3802,7 +3802,7 @@ bool X86AsmParser::validateInstruction(MCInst &Inst, const OperandVector &Ops) { | |
// VFMULCPHZrr Dest, Src1, Src2 | ||
// VFMULCPHZrrk Dest, Dest, Mask, Src1, Src2 | ||
// VFMULCPHZrrkz Dest, Mask, Src1, Src2 | ||
for (unsigned i = TSFlags & X86II::EVEX_K ? 2 : 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know it's subjective, but the new code with two levels of parens decreases readability. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The second level seems like a bug, it's not consistent with how |
||
for (unsigned i = ((TSFlags & X86II::EVEX_K) ? 2 : 1); | ||
i < Inst.getNumOperands(); i++) | ||
if (Inst.getOperand(i).isReg() && Dest == Inst.getOperand(i).getReg()) | ||
return Warning(Ops[0]->getStartLoc(), "Destination register should be " | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is random change made to lld/ELF?
[-+*%] \w+ \?'
is extensively used and I don't see we add)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @MaskRay ,
the PR modifies all the files with non-trivial ternary operators given by Cppcheck (issue).
You can find the Cppcheck report inside the comments thread of the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A CppCheck issue may or may not be useful for the project. Projects have different code styles. Applying a random static analyzer report may not be useful.