anura-engine / anura

Anura Engine
Other
384 stars 78 forks source link

Fix compiler warning about condition always being true #345

Closed Vultraz closed 1 year ago

Vultraz commented 1 year ago

LLVM reports thusly:

src/kre/Texture.cpp:407:42: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
                        if((min != Texture::Filtering::LINEAR || min != Texture::Filtering::ANISOTROPIC
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/kre/Texture.cpp:395:43: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
                                if((min != Texture::Filtering::LINEAR || min != Texture::Filtering::ANISOTROPIC
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I don't know this code, but judging by the comments it feels like changing these to equality checks is the right way to go. Would like a second opinion.