Fix: -header-filter='.*,-vulkan.h,-vulkan_platform.h' used to silence typedef warnings in vulkan headers, but with -header-filter='.*' there is other warnings like modernize-use-override
/tmp/build.w64/../dxvk/src/dxvk/dxvk_graphics.h:111:5: warning: annotate this function with 'override' or (rarely) 'final' [modernize-use-override]
~DxvkGraphicsPipeline();
^ ~
override
modernize-* checks it's good, but there is some warnings with general checks to be reviewed :
-checks='-*,modernize-*' removed from commandline
(nice step-by-step explanation produced after warning)
../dxvk/src/d3d11/d3d11_context_imm.cpp:192:33: warning: Access to field 'pData' results in a dereference of a null pointer (loaded from variable 'pMappedResource') [clang-analyzer-core.NullDereference]
pMappedResource->pData = physicalSlice.mapPtr(0);
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:118:9: note: Assuming the condition is false
if (pResource == nullptr) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:118:5: note: Taking false branch
if (pResource == nullptr) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:123:9: note: Assuming pointer value is null
if (pMappedResource != nullptr) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:123:5: note: Taking false branch
if (pMappedResource != nullptr) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:132:9: note: Assuming 'resourceDim' is equal to D3D11_RESOURCE_DIMENSION_BUFFER
if (resourceDim == D3D11_RESOURCE_DIMENSION_BUFFER) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:132:5: note: Taking true branch
if (resourceDim == D3D11_RESOURCE_DIMENSION_BUFFER) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:135:28: note: Passing null pointer value via 4th parameter 'pMappedResource'
MapType, MapFlags, pMappedResource);
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:133:14: note: Calling 'D3D11ImmediateContext::MapBuffer'
return MapBuffer(
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:163:9: note: Assuming the condition is false
if (!(buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:163:5: note: Taking false branch
if (!(buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:168:9: note: Assuming 'MapType' is not equal to D3D11_MAP_WRITE_DISCARD
if (MapType == D3D11_MAP_WRITE_DISCARD) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:168:5: note: Taking false branch
if (MapType == D3D11_MAP_WRITE_DISCARD) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:181:16: note: Assuming 'MapType' is equal to D3D11_MAP_WRITE_NO_OVERWRITE
} else if (MapType != D3D11_MAP_WRITE_NO_OVERWRITE) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:181:12: note: Taking false branch
} else if (MapType != D3D11_MAP_WRITE_NO_OVERWRITE) {
^
../dxvk/src/d3d11/d3d11_context_imm.cpp:192:33: note: Access to field 'pData' results in a dereference of a null pointer (loaded from variable 'pMappedResource')
pMappedResource->pData = physicalSlice.mapPtr(0);
^
It can be added as meson option. I think something like that:
https://github.com/rwengine/openrw/pull/403/files
(that's for cmake)
compile_flags.txt example, can be used by clangd (for IDE language server plugins like vscode-clangd). Can be placed to project root directory and/or any src subdir for source-specific flags (AFAIK).
-std=c++17
-DNOMINMAX
-D__WINESRC__
-isystem/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7
-isystem/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7/x86_64-pc-linux-gnu
-isystem/usr/include/wine/windows
-isystem./include
-Isrc
-Isrc/dxbc
-Isrc/dxvk
-m64
-fshort-wchar
-DWINE_UNICODE_NATIVE
-D_REENTRANT
-DWIN64
-D_WIN64
-D__WIN64
-D__WIN64__
-DWIN32
-D_WIN32
-D__WIN32
-D__WIN32__
-D__WINNT
-D__WINNT__
-D__stdcall=__attribute__((ms_abi))
-D__cdecl=__attribute__((ms_abi))
-D_stdcall=__attribute__((ms_abi))
-D_cdecl=__attribute__((ms_abi))
-D__fastcall=__attribute__((ms_abi))
-D_fastcall=__attribute__((ms_abi))
-D__declspec(x)=__declspec_##x
-D__declspec_align(x)=__attribute__((aligned(x)))
-D__declspec_allocate(x)=__attribute__((section(x)))
-D__declspec_deprecated=__attribute__((deprecated))
-D__declspec_dllimport=__attribute__((dllimport))
-D__declspec_dllexport=__attribute__((dllexport))
-D__declspec_naked=__attribute__((naked))
-D__declspec_noinline=__attribute__((noinline))
-D__declspec_noreturn=__attribute__((noreturn))
-D__declspec_nothrow=__attribute__((nothrow))
-D__declspec_novtable=__attribute__(())
-D__declspec_selectany=__attribute__((weak))
-D__declspec_thread=__thread
-D__int8=char
-D__int16=short
-D__int32=int
-D__int64=long
-D__WINE__
Final part is a dump from winegcc -m64 -v ....
Modified clang-tidy.sh script to also use this parameters:
#!/bin/sh
RUN_CLANG_TIDY_PATH=/usr/lib/llvm/7/share/clang
PROJECT_PATH=${HOME}/Projects/wine-playground/dxvk
${RUN_CLANG_TIDY_PATH}/run-clang-tidy.py \
$(for s in `cat ${PROJECT_PATH}/compile_flags.txt`; do echo -n "-extra-arg=$s "; done) \
-extra-arg="-isystem${PROJECT_PATH}/include" \
-header-filter='.*' \
-quiet
Not an issue, but info. Closing.
Nothing extracted yet.
I'm currently playing with clang-tidy, just for fun. So here is some useful (?) notes how to use it with DXVK:
/usr/lib/llvm/7/share/clang/run-clang-tidy.pyor https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/tool/run-clang-tidy.py python script, it will useninja'scompile_commands.jsonfile to analyse project filesOutput example:
To list all available modernize checks use:
$ clang-tidy --list-checks -checks='*' | grep "modernize"To let clang-tidy fix warnings use:
$ ./run-clang-tidy.py ... -checks='-*,modernize-use-nullptr' -fix