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

Sonarqube flagging on #1

Open
peter-toft-greve opened this issue Jul 8, 2022 · 0 comments
Open

Sonarqube flagging on #1

peter-toft-greve opened this issue Jul 8, 2022 · 0 comments

Comments

@peter-toft-greve
Copy link

https://github.com/eblot/newlib/blob/master/newlib/libc/string/strtok_r.c#L44 is being flagged by Sonarqube with these references

MISRA C:2004, 12.4 - The right-hand operand of a logical && or || operator shall not contain side effects.
MISRA C++:2008, 5-14-1 - The right hand operand of a logical && or || operator shall not contain side effects.
MISRA C:2012, 13.5 - The right hand operand of a logical && or || operator shall not contain persistent side effects
CERT, EXP02-C. - Be aware of the short-circuit behavior of the logical AND and OR operators

I see their point - the right hand side of the expression may or may not be run
if (s == NULL && (s = *lasts) == NULL)

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

No branches or pull requests

1 participant