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

Various minor code cleanups found by scan-build #6948

Merged
merged 6 commits into from Oct 31, 2018

Conversation

LordAro
Copy link
Member

@LordAro LordAro commented Oct 28, 2018

Various things found by running scan-build sh -c './configure && make' with all checkers turned on. Mostly missing null checks and dead code. Vast numbers of false positives that were ignored.

Documentation fixes were found by going through the output of doxygen, ignoring missing documentation warnings. Nearly all fixed, but some left that aren't clear how to be fixed (usually related to attributes being referred to before they're declared? Maybe the explicit # could be removed)

Commits are almost entirely self-contained, so probably best to review individually

src/town_cmd.cpp Outdated Show resolved Hide resolved
src/viewport.cpp Outdated Show resolved Hide resolved
src/viewport.cpp Outdated Show resolved Hide resolved
@@ -154,6 +154,7 @@ static uint32 RotateRight(uint32 val, uint32 rot)
{
/* Do not rotate more than necessary */
rot %= 32;
assert(rot > 0);
Copy link
Member

Choose a reason for hiding this comment

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

Is "== 0" valid?

Copy link
Member Author

Choose a reason for hiding this comment

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

The point it that it shouldn't be, as then you're doing val << 32, which isn't defined all that well. If we want to just assume that it should be 0, that's a bit different.

That said, not sure why this exists at all, when ROR in bitmath_func.hpp exists.

src/window.cpp Outdated Show resolved Hide resolved
Doxyfile Outdated Show resolved Hide resolved
src/cargopacket.cpp Outdated Show resolved Hide resolved
src/station_base.h Outdated Show resolved Hide resolved
@nielsmh
Copy link
Contributor

nielsmh commented Oct 30, 2018

The Doxygen config changes should probably be moved to a separate PR from the code cleanup.

@LordAro LordAro changed the title Doxygen improvements and various scan-build findings Various minor code cleanups found by scan-build Oct 30, 2018
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.

None yet

3 participants