bde-format 15 Release¶
bde-format-15 (based on clang release 15.0.7) has been promoted to the
unstable and is available for initial testing.
bde-format 15 Highlights¶
Based on clang-format v 15.0.7¶
bde-format 15 includes all the improvements and features added to clang-format
between 11 and 15 releases. The most notable of them relate to the new C++20
language constructs, like concepts, requires expressions, the new
“spaceship” operator (<=>), modules, etc…
Complete and safe C++20 formatting by default¶
The previous version of bde-format used C++03 language standard by default.
This caused invalid formatting for modern language features such as raw
strings, unicode string literals, user-defined string/char literal suffixes,
and the new “spaceship” operator (<=>). All this constructions are
formatted correctly now.
At the same time formatting for the new C++ language versions breaks the
formatting for the mixed code that should still compile with C++03 standard
on legacy platforms. In order to achieve that, bde-format introduces new
value for the Standard option - LatestCpp03Compatible. This option is
set by the default in BDE style and departs from the C++11 and newer
formatting in the following cases:
Adds space between closing template brackets:
> >.Adds space in
<::sequence. In C++03 it is interpreted as[:because<:is a digraph for[. Proper formatting for C++03 in this case is< ::.
In the both cases addition of one space between the tokens makes the code
valid for any C++ language mode and eliminates risks to break C++03 code.
If your project doesn’t include any C++03 code, you can disable such
C++03-compatible formatting by setting the used language mode explicitly, like
Standard: c++20 or Standard: c++17 or Standard: Latest.
DeclTypeMacro option was removed¶
bde-format-specific option DeclTypeMacro was removed from the bde-format
configuration in favor of standard clang-format’s TypenameMacros option.
Setting this option tells the formatter that some macros must be treated
as typenames not as function calls. This helps in correct function prototypes
formatting:
template <class ARG>
void construct(bslma::Allocator *basicAllocator
BSLS_COMPILERFEATURES_FORWARD_REF(ARG) arg);
By default set to
['BSLS_COMPILERFEATURES_FORWARD_REF', 'BSLMF_MOVABLEREF_DEDUCE'].
BDE-style formatting for comments inside enums¶
Formatting like this can be enabled for enums by setting
BDEFormatEnums: true in your configuration file:
enum {
EnumValue1,
// Comment 1
EnumValue2
// Comment 2
};
The feature is disabled by default because bde-format sometimes fails to
recognize what < token means - opening angle bracket or “less than”
operator. This can lead to incorrect formatting like this:
enum {
A = std::is_same < int,
T > ::value ? 0 : 1,
B = 2
};
In such situations it is possible to “help” bde-format a bit - just add parens around the initializer:
enum {
A = (std::is_same<int, T>::value ? 0 : 1),
B = 2
};
Fixed DRQSs:¶
DRQS |
Summary |
|---|---|
Update bde-format documentation for VSCode |
|
Windows exe for bde-format [{BLST /ID 6995995016689877033 <GO>}] |
|
bde-format-11 comment format error |
|
bde_format: additional indent in conditional statements |
|
bde-format doesn’t indent ‘extern C’ contracts. |
|
bde-format and bde_verify dont agree on bde_verify pragmas |
|
odd indentation caused by bde-format |
|
Do not add extra space for alignment purposes between #endif and comment |
|
bde-format enum formatting |
|
Enhance bde-format to support line-splitting in function parameter lists |
|
bde-format does not correctly formats rstring |
|
bde-format: problems with BSLMF_MOVABLEREF_DEDUCE formatting |