Hello C and C++ folks,
We brought quite some care and love to our C and C++ analyzers.
A lot of false negatives for several rules with various versions of the C++ STL (MS, GNU, CLANG) were fixed.
Configuring the analysis with a compilation database as an alternative way to build-wrapper is now supported. It has been a very requested feature for some time. In some cases, it can help to analyze the code without building it. It is also an alternative to the build-wrapper in cases it cannot support the build system in use.
At last but not least, we are happy to announce that things have been moving on the C++20 front.
Initial C++20 support is here. It includes:
- compatibility with many new language features while parsing the code
- previous rules adapted to make sense with C++20 code/features
- 18 new rules specific to C++20
- S6214: “std::cmp_*” functions must be used to compare signed and unsigned values
- S6169: Call to “std::is_constant_evaluated” should not be gratuitous
- S6190: “std::source_location” should be used instead of “FILE”, “LINE”, and “func” macros
- S6189: Function template parameters should be named if reused
- S6186: Redundant comparison operators should not be defined
- S6181: “std::bit_cast” should be used to reinterpret binary representation instead of “std::memcpy”
- S6180: “[[likely]]” and “[[unlikely]]” should be used instead of compiler built-ins
- S6178: “starts_with” and “ends_with” should be used for prefix and postfix checks
- S6168: “std::jthread” should be used instead of “std::thread”
- S6165: Elements in a container should be erased with “std::erase” or “std::erase_if”
- S6164: Mathematical constants should not be hardcoded
- S6197: STL constrained algorithms with range parameter should be used when iterating over the entire range
- S6188: “std::span” should be used for a uniform sequence of elements contiguous in memory
- S6187: Operator spaceship “<=>” should be used to define comparable types
- S6179: “std::midpoint” and “std::lerp” should be used for midpoint computation and linear interpolation
- S6171: “contains” should be used to check if a key exists in a container
- S6183: “std::cmp_*” functions should be used to compare signed and unsigned values
- S6166: “nodiscard” attributes on functions should include explanations
All this is already available on SonarCloud.io and will be available with SonarQube 9.0 starting from Developer Edition.
Geoffray