| Summary: | SDL2-2.0.1/src/video/SDL_egl.c:397: possible bad if test ? | ||
|---|---|---|---|
| Product: | SDL | Reporter: | David Binderman <dcb314> |
| Component: | video | Assignee: | Gabriel Jacobo <gabomdq> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | amaranth72, gabomdq |
| Version: | 2.0.1 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
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? 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. :) 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 |
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.