I get a new warning when building cppcheck with
clang++-21 -Weverything
on Ubuntu 25.04/plucky
[ 2%] Building CXX object lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.pch
In file included from <built-in>:1:
In file included from /home/werdna/src/cppcheck/cppcheck/build/lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx:5:
In file included from /home/werdna/src/cppcheck/cppcheck/lib/precompiled.h:22:
In file included from /home/werdna/src/cppcheck/cppcheck/lib/astutils.h:39:
In file included from /home/werdna/src/cppcheck/cppcheck/lib/token.h:29:
/home/werdna/src/cppcheck/cppcheck/lib/vfvalue.h:285:19: warning: bit-field '' of type 'long long' has a different storage size than the preceding bit-field (8 vs 1 bytes) and will not be packed under the Microsoft ABI [-Wms-bitfield-padding]
285 | long long : 4; // padding
| ^
/home/werdna/src/cppcheck/cppcheck/lib/vfvalue.h:283:14: note: preceding bit-field 'defaultArg' declared here with type 'bool'
283 | bool defaultArg : 1;
| ^
1 warning generated.</built-in>
If we do not wish to be warned about this we should add:
add_compile_options_safe(-Wno-ms-bitfield-padding)
somewhere in cppcheck/cmake/compileroptions.cmake
[ I also see a lot of
warning: not eliding copy on return [-Wnrvo]
but I see that that is on the "TODO" list in compileroptions.cmake ]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Clang 21 is still in early development and won't be released until at least September.
We track the necessary changes for the upcoming Clang version and do usually not apply them until at least the RC is available so we do not have to deal with false positives and changes which might be in flux. See https://github.com/danmar/cppcheck/pull/7272 for Clang 21.
I get a new warning when building cppcheck with
clang++-21 -Weverything
on Ubuntu 25.04/plucky
[ 2%] Building CXX object lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.pch
In file included from <built-in>:1:
In file included from /home/werdna/src/cppcheck/cppcheck/build/lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx:5:
In file included from /home/werdna/src/cppcheck/cppcheck/lib/precompiled.h:22:
In file included from /home/werdna/src/cppcheck/cppcheck/lib/astutils.h:39:
In file included from /home/werdna/src/cppcheck/cppcheck/lib/token.h:29:
/home/werdna/src/cppcheck/cppcheck/lib/vfvalue.h:285:19: warning: bit-field '' of type 'long long' has a different storage size than the preceding bit-field (8 vs 1 bytes) and will not be packed under the Microsoft ABI [-Wms-bitfield-padding]
285 | long long : 4; // padding
| ^
/home/werdna/src/cppcheck/cppcheck/lib/vfvalue.h:283:14: note: preceding bit-field 'defaultArg' declared here with type 'bool'
283 | bool defaultArg : 1;
| ^
1 warning generated.</built-in>
https://clang.llvm.org/docs/ReleaseNotes.html
If we do not wish to be warned about this we should add:
add_compile_options_safe(-Wno-ms-bitfield-padding)
somewhere in cppcheck/cmake/compileroptions.cmake
[ I also see a lot of
warning: not eliding copy on return [-Wnrvo]
but I see that that is on the "TODO" list in compileroptions.cmake ]
Clang 21 is still in early development and won't be released until at least September.
We track the necessary changes for the upcoming Clang version and do usually not apply them until at least the RC is available so we do not have to deal with false positives and changes which might be in flux. See https://github.com/danmar/cppcheck/pull/7272 for Clang 21.
I made an exception for some -Wnrvo fixes as they are reasonable changes (which I partially had locally anyways) - see https://github.com/danmar/cppcheck/pull/7557