clang-format: update to latest from docs repo
Since `Cpp11` is an alias for `Latest` and we should tend towards using the
latest C++ standard, update the C++ standard to Latest.
https://github.com/llvm/llvm-project/commit/e5032567903de19962333c4bf7d2edceaf4f9824#diff-b49a097415dff2837d9626d422c58ba8R82
https://github.com/openbmc/docs/blob/master/style/cpp/.clang-format
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I6bd62f057c6881b4e931c1968d71ce5478832d73
diff --git a/.clang-format b/.clang-format
index 60ceb3c..625a0a0 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,7 +5,7 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
+AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
@@ -14,10 +14,9 @@
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: true
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
@@ -30,20 +29,28 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
+PointerAlignment: Left
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
@@ -51,17 +58,21 @@
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](gtest|gmock)'
- Priority: 5
+ Priority: 7
- Regex: '^"config.h"'
Priority: -1
- - Regex: '^".*\.hpp"'
+ - Regex: '^".*\.h"'
Priority: 1
- - Regex: '^<.*\.h>'
+ - Regex: '^".*\.hpp"'
Priority: 2
- - Regex: '^<.*'
+ - Regex: '^<.*\.h>'
Priority: 3
- - Regex: '.*'
+ - Regex: '^<.*\.hpp>'
Priority: 4
+ - Regex: '^<.*'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
@@ -79,13 +90,17 @@
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
@@ -93,7 +108,7 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
diff --git a/epoch_base.cpp b/epoch_base.cpp
index 507c5ff..96552ac 100644
--- a/epoch_base.cpp
+++ b/epoch_base.cpp
@@ -1,12 +1,13 @@
#include "epoch_base.hpp"
-#include <iomanip>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
-#include <sstream>
#include <xyz/openbmc_project/Time/error.hpp>
+#include <iomanip>
+#include <sstream>
+
namespace // anonymous
{
constexpr auto SYSTEMD_TIME_SERVICE = "org.freedesktop.timedate1";
@@ -25,8 +26,7 @@
EpochBase::EpochBase(sdbusplus::bus::bus& bus, const char* objPath) :
sdbusplus::server::object::object<EpochTime>(bus, objPath), bus(bus)
-{
-}
+{}
void EpochBase::onModeChanged(Mode mode)
{
diff --git a/epoch_base.hpp b/epoch_base.hpp
index 40025c4..89a7b85 100644
--- a/epoch_base.hpp
+++ b/epoch_base.hpp
@@ -4,10 +4,11 @@
#include "property_change_listener.hpp"
-#include <chrono>
#include <sdbusplus/bus.hpp>
#include <xyz/openbmc_project/Time/EpochTime/server.hpp>
+#include <chrono>
+
namespace phosphor
{
namespace time
@@ -18,9 +19,10 @@
* @details A base class that implements xyz.openbmc_project.Time.EpochTime
* DBus API for epoch time.
*/
-class EpochBase : public sdbusplus::server::object::object<
- sdbusplus::xyz::openbmc_project::Time::server::EpochTime>,
- public PropertyChangeListner
+class EpochBase :
+ public sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Time::server::EpochTime>,
+ public PropertyChangeListner
{
public:
friend class TestEpochBase;
diff --git a/manager.hpp b/manager.hpp
index c93c58f..8ccea4a 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -8,6 +8,7 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/bus/match.hpp>
+
#include <string>
namespace phosphor
diff --git a/property_change_listener.hpp b/property_change_listener.hpp
index d34fcf0..6439d3e 100644
--- a/property_change_listener.hpp
+++ b/property_change_listener.hpp
@@ -11,8 +11,7 @@
{
public:
virtual ~PropertyChangeListner()
- {
- }
+ {}
/** @brief Notified on time mode is changed */
virtual void onModeChanged(Mode mode) = 0;
diff --git a/settings.hpp b/settings.hpp
index b547339..61eba03 100644
--- a/settings.hpp
+++ b/settings.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <sdbusplus/bus.hpp>
+
#include <string>
namespace settings
diff --git a/test/TestBmcEpoch.cpp b/test/TestBmcEpoch.cpp
index 5ed1f3c..651e019 100644
--- a/test/TestBmcEpoch.cpp
+++ b/test/TestBmcEpoch.cpp
@@ -3,9 +3,10 @@
#include "bmc_epoch.hpp"
#include "types.hpp"
-#include <memory>
#include <sdbusplus/bus.hpp>
+#include <memory>
+
#include <gtest/gtest.h>
namespace phosphor
diff --git a/test/TestManager.cpp b/test/TestManager.cpp
index b1cf4ec..db36b42 100644
--- a/test/TestManager.cpp
+++ b/test/TestManager.cpp
@@ -20,8 +20,7 @@
Manager manager;
TestManager() : bus(sdbusplus::bus::new_default()), manager(bus)
- {
- }
+ {}
// Proxies for Manager's private members and functions
Mode getTimeMode()