Assortment of compiler warning cleanups #238
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I built the project with
-Dwarning_level=2(-Wall -Wextra) with Clang and went over warnings in a few files.This doesn't comprehensively clean up all of them, only a few, but also a few tiny logic bugs I noticed. Kind of mostly looking for input on this, because I imagine there might be disagreements to some of those.
For instance:
if (var = MightReturnNull()) …because the intent might have been to use==instead, and advises to use double parentheses around the function as a way to explicitly denote the intent of assignment. I did that a bunch of times.Vector(which uses floats). I switched those around too.SceneMan.cppruns a function that returns astd::vectorand then doesstd::moveon that, which had Clang warnMoving a temporary object prevents copy elisionand suggest just removing it, so, yeah lolGetRoundNameusing a too smallnumStrbuffer, so I expanded it lolVector, so I gave it an explicit copy constructor. There was also a vice-versa of that warning forTimerso I gave it an explicit copy assignment operator lolWith this patch the game still compiles just fine. I played a few scenarios and a metagame and everything seems dandy.
But yeah, looking for input.