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

Clang 16 warning: Bitwise operation between different enumeration types is deprecated #774

Closed
St0wy opened this issue Sep 24, 2023 · 3 comments · Fixed by #806
Closed

Clang 16 warning: Bitwise operation between different enumeration types is deprecated #774

St0wy opened this issue Sep 24, 2023 · 3 comments · Fixed by #806

Comments

@St0wy
Copy link

St0wy commented Sep 24, 2023

I am using this library in a C++23 project and it seems like this error prevents me from building.

[862/942] Building CXX object _deps/ktx-software-build/CMakeFiles/ktx.dir/Release/lib/basis_encode.cpp.o
FAILED: _deps/ktx-software-build/CMakeFiles/ktx.dir/Release/lib/basis_encode.cpp.o 
/usr/bin/c++ -DBASISD_SUPPORT_FXT1=0 -DBASISD_SUPPORT_KTX2=1 -DBASISD_SUPPORT_KTX2_ZSTD=0 -DBASISU_SUPPORT_OPENCL=0 -DBASISU_SUPPORT_SSE=1 -DKHRONOS_STATIC -DKTX_FEATURE_KTX1 -DKTX_FEATURE_KTX2 -DKTX_FEATURE_WRITE -DLIBKTX -DCMAKE_INTDIR=\"Release\" -I/home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/include -I/home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/lib/basisu/transcoder -I/home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/lib/basisu/zstd -I/home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/other_include -I/home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/utils -I/home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/lib/dfdutils -I/home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/lib/basisu -I/home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/lib/astc-encoder/Source -O3 -DNDEBUG -std=gnu++23 -Wall -Wextra -Werror -O3 -Wno-cast-function-type -Wno-pedantic -msse4.1 -MD -MT _deps/ktx-software-build/CMakeFiles/ktx.dir/Release/lib/basis_encode.cpp.o -MF _deps/ktx-software-build/CMakeFiles/ktx.dir/Release/lib/basis_encode.cpp.o.d -o _deps/ktx-software-build/CMakeFiles/ktx.dir/Release/lib/basis_encode.cpp.o -c /home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/lib/basis_encode.cpp
In file included from /home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/lib/basis_encode.cpp:24:
/home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/lib/basis_encode.cpp: In function ‘ktx_error_code_e ktxTexture2_rewriteDfd4BasisLzETC1S(ktxTexture2*, alpha_content_e, bool, swizzle_e*)’:
/home/stowy/dev/opengl-scene/build/_deps/ktx-software-src/include/KHR/khr_df.h:104:14: error: bitwise operation between different enumeration types ‘_khr_df_vendorid_e’ and ‘_khr_df_mask_e’ is deprecated [-Werror=deprecated-enum-enum-conversion]
  104 |      (((val) & (KHR_DF_MASK_ ## X)) << (KHR_DF_SHIFT_ ## X)))
      |        ~~~~~~^~~~~~~~~~~~~~~~~~~~~
// ...

cc1plus: all warnings being treated as errors

I'm on Linux with clang version 16.0.6, CMake version 3.27.4 and I downloaded the library with CPM.

@MarkCallow
Copy link
Collaborator

In the latest version of the source, since about 2 months ago, warnings as errors is a CMake config option that is off by default. This version has not been released yet, which is probably why you didn't get it from CPM. I won't have time to fix this until the beginning of October. Even then there are a couple of other items needed before I can publish a release. I suggest you either get the latest source or attempt a fix yourself. I am sorry for the delay.

@St0wy
Copy link
Author

St0wy commented Sep 25, 2023

I'll use the source then. Thanks a lot !

@MarkCallow
Copy link
Collaborator

@St0wy when you build the library is it being built with std=C++23? That might explain why you see the warnings and we don't even when building with clang 16. We might need to explicitly specify which std to use when compiling the library so parent projects can't affect it.

MarkCallow added a commit that referenced this issue Nov 28, 2023
MarkCallow added a commit that referenced this issue Nov 29, 2023
Avoid inadvertent compilation with a later standard
when included in another project. Later standards may
raise warnings or even errors on the library code. 

Fixes #774 and #656.
KaperD pushed a commit to KaperD/KTX-Software that referenced this issue Feb 22, 2024
Avoid inadvertent compilation with a later standard
when included in another project. Later standards may
raise warnings or even errors on the library code. 

Fixes KhronosGroup#774 and KhronosGroup#656.
KaperD pushed a commit to KaperD/KTX-Software that referenced this issue Feb 22, 2024
Avoid inadvertent compilation with a later standard
when included in another project. Later standards may
raise warnings or even errors on the library code. 

Fixes KhronosGroup#774 and KhronosGroup#656.
KaperD pushed a commit to KaperD/KTX-Software that referenced this issue Feb 22, 2024
Avoid inadvertent compilation with a later standard
when included in another project. Later standards may
raise warnings or even errors on the library code. 

Fixes KhronosGroup#774 and KhronosGroup#656.
KaperD pushed a commit to KaperD/KTX-Software that referenced this issue Feb 22, 2024
Avoid inadvertent compilation with a later standard
when included in another project. Later standards may
raise warnings or even errors on the library code. 

Fixes KhronosGroup#774 and KhronosGroup#656.
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 a pull request may close this issue.

2 participants