diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-04-17 13:22:13 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-04-17 13:22:36 -0400 |
commit | a63b4e3493460a2cf5b7b3275a53140895cce529 (patch) | |
tree | 8aeb355a9078817fbf73bab58a0b308caabf5b27 /src | |
parent | 58bbc5521235f0db77f1f41edd17859fd5664fca (diff) | |
parent | cd0e1e91dd6d020263433d85526a91181180471d (diff) |
Merge #12982: Fix inconsistent namespace formatting guidelines
cd0e1e91dd Fix inconsistent namespace formatting guidelines (Russell Yanofsky)
Pull request description:
Suggested formatting for namespaces in the developer guide is currently inconsistent. This commit updates the developer guide and clang-format configuration to consistently put "namespace" and opening/closing braces on the same line. Example:
```c++
namespace boost {
namespace signals2 {
class connection;
} // namespace signals2
} // namespace boost
```
Currently the [Source code organization](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#source-code-organization) section has an example like the one above, but the [Coding style](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#coding-style) section example and description put a newline between the opening "namespace foo" and brace (but oddly no newline between closing namespace and brace).
Avoiding newlines before namespace opening braces makes nested declarations less verbose and also avoids asymmetry with closing braces. It's also a common style used in our own and other codebases:
* https://google.github.io/styleguide/cppguide.html#Namespaces
* https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Classes
* https://llvm.org/docs/CodingStandards.html#namespace-indentation
Tree-SHA512: 507259478e1a7f6f96db386dd04eb25aa04294f533503fdd82368cf809c3ceaa20204b2cb6ae65322eb27446e5934c1aa1ccb6240ead12aa06b314af76f68139
Diffstat (limited to 'src')
-rw-r--r-- | src/.clang-format | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/.clang-format b/src/.clang-format index 2d2ee67035..38e19edf2c 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -12,7 +12,10 @@ AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: true BinPackParameters: false BreakBeforeBinaryOperators: false -BreakBeforeBraces: Linux +BreakBeforeBraces: Custom +BraceWrapping: + AfterClass: true + AfterFunction: true BreakBeforeTernaryOperators: false BreakConstructorInitializersBeforeComma: false ColumnLimit: 0 |