We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2191 - SDL2-2.0.1/src/video/SDL_egl.c:397: possible bad if test ?
Summary: SDL2-2.0.1/src/video/SDL_egl.c:397: possible bad if test ?
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Gabriel Jacobo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-28 16:59 UTC by David Binderman
Modified: 2013-10-31 13:04 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2013-10-28 16:59:55 UTC
I just compiled SDL2-2.0.1 with gcc compiler flag -Wlogical-op

It said

/home/dcb/rpmbuild/BUILD/SDL2-2.0.1/src/video/SDL_egl.c:397:5: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]

Source code is

    if (!egl_context && egl_context != EGL_NO_CONTEXT) {

Suggest code rework.
Comment 1 Gabriel Jacobo 2013-10-30 12:40:16 UTC
I may be still jet lagged, but I don't understand the warning...the test is "if egl_context is not null and it is not EGL_NO_CONTEXT then...", they are not mutually exclusive, why does GCC think it is?
Comment 2 Alex Szpakowski 2013-10-30 21:32:29 UTC
The test is "if egl_context *is* null and it is not EGL_NO_CONTEXT", which I suspect was not the intention when that was written. :)
Comment 3 Gabriel Jacobo 2013-10-31 13:04:31 UTC
You learn new things every day, today I learned to not make a fool of myself by not getting enough rest before doubting GCC :)

Thanks guys!

http://hg.libsdl.org/SDL/rev/0bca3fe7c03f