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

Fix some warnings #45

Closed
wants to merge 14 commits into from
Closed

Fix some warnings #45

wants to merge 14 commits into from

Conversation

emlai
Copy link

@emlai emlai commented Apr 23, 2016

No description provided.

emlai added 14 commits April 23, 2016 03:08
…ons but non-virtual destructor" [-Wdelete-non-virtual-dtor]

CButtonAction isn't a base class or derived class so having those
functions be virtual didn't achieve anything.
That would never trigger the ASSERT. Now they always do.
…ogical-operand]

There is this other line which uses &:

if (litPacketIter->pa_ubReliable & UDP_PACKET_CONNECT_RESPONSE) {

which is very likely what was intended.
Thanks @SLAwww

(The first parameter to _assert is actually the message, not the
expression to evaluate, so "false &&" doesn't belong in there.)
Also changed all "if (this==NULL) return;"s.

Fixes some -Wtautological-undefined-compare warnings.

Quoting Clang:
"'this' pointer cannot be null in well-defined C++ code; comparison may
be assumed to always evaluate to false"
Quoting Clang:
"reference cannot be bound to dereferenced null pointer in well-defined
C++ code; comparison may be assumed to always evaluate to false"
(I didn't receive any warnings after enabling -Wsign-compare.)
@DanielGibson
Copy link

oh.. looks like we might have done some duplicate work: #44

@emlai
Copy link
Author

emlai commented Apr 23, 2016

Wow, how is it possible that we opened the PRs only 2 seconds apart 😮

Anyway, I saw you fixed -Wreorder while I was working on my branch so I didn't touch that, but there's still some overlap. And we fixed some things differently. But overall I think the overlap seems to be relatively small.

@@ -268,7 +268,7 @@ procedures:
// declare yourself as a model
InitAsModel();
// fish must not go upstairs, or it will get out of water
SetPhysicsFlags((EPF_MODEL_WALKING|EPF_HASGILLS)&~EPF_ONBLOCK_CLIMBORSLIDE|EPF_ONBLOCK_SLIDE);
SetPhysicsFlags(((EPF_MODEL_WALKING|EPF_HASGILLS)&~EPF_ONBLOCK_CLIMBORSLIDE)|EPF_ONBLOCK_SLIDE);

Choose a reason for hiding this comment

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

are you sure this was intended and not (EPF_MODEL_WALKING|EPF_HASGILLS) & ~(EPF_ONBLOCK_CLIMBORSLIDE|EPF_ONBLOCK_SLIDE)?

(I wasn't so I didn't change this in my fix-warnings-branch)

Copy link

Choose a reason for hiding this comment

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

This seems correct to me.
(EPF_MODEL_WALKING|EPF_HASGILLS) & ~EPF_ONBLOCK_CLIMBORSLIDE
removes "climb or slide" from physical flags, and then we re-add "slide" flag with |EPF_ONBLOCK_SLIDE

Choose a reason for hiding this comment

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

Ok

It's awesome that you look at what the community is doing with your code and clarify issues like this, thanks a lot!

@icculus
Copy link
Owner

icculus commented May 9, 2016

There were two competing PRs for this before; @DanielGibson, did we decide this PR should go in, too? Let me know and I'll accept it.

@DanielGibson
Copy link

DanielGibson commented May 9, 2016

I'd suggest merging my PR first and then cherry-picking the parts of this which aren't duplicates of my fixes - thankfully it seems like @emlai split up the fixes into meaningful commits, like a professional :-)

(I can do the cherry picking etc, I could create a new PR with the remaining commits of this one then)

@DanielGibson
Copy link

I also wonder why all those if(this != NULL) checks were there if that doesn't really happen anyway?

@DanielGibson
Copy link

I can do the cherry picking etc, I could create a new PR with the remaining commits of this one then

seeing my stuff is merged now, unless someone beats me to it I plan to do the merging/cherry-picking this weekend

@DanielGibson
Copy link

I created a new pull request with all the still relevant fixes from this one, see #54

@icculus
Copy link
Owner

icculus commented May 29, 2016

Merged #54, closing this one. Thanks, everyone!

@icculus icculus closed this May 29, 2016
@DanielGibson
Copy link

wow, that was fast, thanks a lot :)

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.

4 participants