baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.86k stars 1.33k forks source link

When compiling on Linux, a static check warning is reported #1964

Closed mimijava closed 4 years ago

mimijava commented 4 years ago

Description

renderdoc/core/resource_manager.h:219:24: warning: comparison of 0 > unsigned enum expression is always false [-Wtautological-unsigned-enum-zero-compare] if(eFrameRef_Minimum > refType || refType > eFrameRef_Maximum)

When compiling on Linux, a static check warning is reported.

Steps to reproduce

Build on linux.

Environment

baldurk commented 4 years ago

This bug report is missing the critical information of which compiler and version you are using, as well as which linux distribution and version which may be relevant. It should not surprise you that "build on linux" is not enough of a description of the steps to reproduce, given that nightly builds are produced by building on linux and every pull request and push is built with automatic CI four different times on linux against different compilers and versions.

mimijava commented 4 years ago

-- The CXX compiler identification is GNU 5.4.0 -- The C compiler identification is GNU 5.4.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works

Enum is begin of 0, so the experssion enum type (unsigned int) < 0 is may be used incorrectly. If you enter a negative number, it is reversed. So I think you can remove the expression " eFrameRef_Minimum > refType".

baldurk commented 4 years ago

I don't understand why you decided to provide less information about your compiler version than on the other issue. I assume you're using a slightly different compiler version here, because when compiling with the exact gcc version from ubuntu 16.04 on the other issue I don't get this warning.

I assume like that other issue that this is a compiler bug since the warning is invalid as that enum is not necessarily unsigned. If you upgrade to a recent compiler version I expect it will be fixed.

mimijava commented 4 years ago

-- Using JAVA_HOME = /opt/jdk1.8.0_242 -- Java in JAVA_HOME is 1.8 -- Using Android SDK found in /opt/android -- Using Android NDK found in /opt/android/ndk-bundle/android-ndk-r17b -- Check for working CXX compiler: /opt/android/ndk-bundle/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- Check for working CXX compiler: /opt/android/ndk-bundle/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /opt/android/ndk-bundle/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- Check for working C compiler: /opt/android/ndk-bundle/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Calculating version -- Building RenderDoc version 1.9 -- Disabling GL driver on android -- Disabling qrenderdoc for android build -- Disabling renderdoc python modules for android build -- Using Android ABI armeabi-v7a -- Using Android native API level 21 -- Interceptor-lib not enabled (USE_INTERCEPTOR_LIB) - android hooking will use sometimes less reliable PLT-interception method. -- Found Java: /usr/bin/java (found version "11.0.7") -- Using Java of version 11.0.7 -- Using Android build-tools version 28.0.1 -- Using android.jar from platform android-26 -- Building APK versionCode 19, versionName eabfb9b0743794f75508ebabd636f1bdef758400

open_source/renderdoc/renderdoc/core/resource_manager.cpp:134:24: error: comparison of 0 <= unsigned enum expression is always true [-Werror,-Wtautological-unsigned-enum-zero-compare] if(eFrameRef_Minimum <= first && first <= eFrameRef_Maximum)

mimijava commented 4 years ago

It may be due to the android-clang in r17 only considers enum as unsigned.

baldurk commented 4 years ago

Do not comment on closed bugs.