Skip to content

lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp:509: Pointless test ? #91223

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

Closed
dcb314 opened this issue May 6, 2024 · 1 comment · Fixed by #94842
Closed

Comments

@dcb314
Copy link

dcb314 commented May 6, 2024

Static analyser cppcheck says:

lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp:509:25: style: Expression is always true because 'else if' condition is opposite to previous condition at line 505. [multiCondition]

Source code is

if (watch_mask > 0x04)
....
else if (watch_mask <= 0x04)

@llvmbot
Copy link
Member

llvmbot commented May 6, 2024

@llvm/issue-subscribers-lldb

Author: None (dcb314)

Static analyser cppcheck says:

lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp:509:25: style: Expression is always true because 'else if' condition is opposite to previous condition at line 505. [multiCondition]

Source code is

if (watch_mask > 0x04)
....
else if (watch_mask <= 0x04)

xgupta added a commit to xgupta/llvm-project that referenced this issue Jun 8, 2024
This issue is reported by cppcheck as a pointless test in the watch mask check.
The `else if` condition is opposite to the previous `if` condition, making the expression always true.

Caught by cppcheck -
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp:509:25: style: Expression is always true because 'else if' condition is opposite to previous condition at line 505. [multiCondition]

Fix llvm#91223
xgupta added a commit that referenced this issue Jun 10, 2024
This issue is reported by cppcheck as a pointless test in the watch mask
check. The `else if` condition is opposite to the previous `if`
condition, making the expression always true.

Caught by cppcheck -

lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp:509:25:
style: Expression is always true because 'else if' condition is opposite
to previous condition at line 505. [multiCondition]

Fix #91223
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants