Update .clang-format to latest version from docs
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: Ie6e7f43e7554429704dca86b21320c90aed18791
diff --git a/.clang-format b/.clang-format
index ea71ad6..2806478 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:
@@ -29,15 +28,22 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+ SplitEmptyNamespace: true
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
@@ -51,17 +57,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
@@ -83,8 +93,13 @@
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
@@ -96,4 +111,3 @@
TabWidth: 4
UseTab: Never
...
-
diff --git a/elog-errors.hpp b/elog-errors.hpp
index 44bc5eb..187e3de 100644
--- a/elog-errors.hpp
+++ b/elog-errors.hpp
@@ -5,6 +5,7 @@
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/exception.hpp>
+
#include <string>
#include <tuple>
#include <type_traits>
@@ -1033,7 +1034,6 @@
{
namespace _Shutdown
{
-
} // namespace _Shutdown
struct Shutdown
@@ -1069,7 +1069,6 @@
{
namespace _PowerOnFailure
{
-
} // namespace _PowerOnFailure
struct PowerOnFailure
diff --git a/gpio.cpp b/gpio.cpp
index 6adee9c..81bc4f5 100644
--- a/gpio.cpp
+++ b/gpio.cpp
@@ -18,12 +18,13 @@
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <cassert>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <cassert>
+
namespace phosphor
{
namespace gpio
diff --git a/pmbus.cpp b/pmbus.cpp
index b0de16d..5c16624 100644
--- a/pmbus.cpp
+++ b/pmbus.cpp
@@ -15,13 +15,14 @@
*/
#include "pmbus.hpp"
-#include <filesystem>
-#include <fstream>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <xyz/openbmc_project/Common/Device/error.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <filesystem>
+#include <fstream>
+
namespace phosphor
{
namespace pmbus
diff --git a/power-sequencer/main.cpp b/power-sequencer/main.cpp
index aa9b772..b9fa53e 100644
--- a/power-sequencer/main.cpp
+++ b/power-sequencer/main.cpp
@@ -18,11 +18,12 @@
#include "runtime_monitor.hpp"
#include "ucd90160.hpp"
-#include <chrono>
-#include <iostream>
#include <phosphor-logging/log.hpp>
#include <sdeventplus/event.hpp>
+#include <chrono>
+#include <iostream>
+
using namespace phosphor::power;
using namespace phosphor::logging;
diff --git a/power-sequencer/ucd90160.cpp b/power-sequencer/ucd90160.cpp
index eaaad56..8d28a32 100644
--- a/power-sequencer/ucd90160.cpp
+++ b/power-sequencer/ucd90160.cpp
@@ -19,13 +19,14 @@
#include "utility.hpp"
#include <elog-errors.hpp>
-#include <map>
-#include <memory>
#include <org/open_power/Witherspoon/Fault/error.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Common/Device/error.hpp>
+#include <map>
+#include <memory>
+
namespace phosphor
{
namespace power
diff --git a/power-sequencer/ucd90160.hpp b/power-sequencer/ucd90160.hpp
index 8e17622..7cfd809 100644
--- a/power-sequencer/ucd90160.hpp
+++ b/power-sequencer/ucd90160.hpp
@@ -5,10 +5,11 @@
#include "pmbus.hpp"
#include "types.hpp"
+#include <sdbusplus/bus.hpp>
+
#include <algorithm>
#include <filesystem>
#include <map>
-#include <sdbusplus/bus.hpp>
#include <vector>
namespace phosphor
diff --git a/power-supply/average.hpp b/power-supply/average.hpp
index 5fdf0b8..bbbda54 100644
--- a/power-supply/average.hpp
+++ b/power-supply/average.hpp
@@ -1,7 +1,8 @@
#pragma once
-#include <functional>
#include <org/open_power/Sensor/Aggregation/History/Average/server.hpp>
+#include <functional>
+
namespace phosphor
{
namespace power
diff --git a/power-supply/main.cpp b/power-supply/main.cpp
index ccb56e7..00dae73 100644
--- a/power-supply/main.cpp
+++ b/power-supply/main.cpp
@@ -19,10 +19,11 @@
#include "device_monitor.hpp"
#include "power_supply.hpp"
-#include <iostream>
#include <phosphor-logging/log.hpp>
#include <sdeventplus/event.hpp>
+#include <iostream>
+
using namespace phosphor::power;
using namespace phosphor::logging;
diff --git a/power-supply/maximum.hpp b/power-supply/maximum.hpp
index 68d3d03..2056510 100644
--- a/power-supply/maximum.hpp
+++ b/power-supply/maximum.hpp
@@ -1,7 +1,8 @@
#pragma once
-#include <functional>
#include <org/open_power/Sensor/Aggregation/History/Maximum/server.hpp>
+#include <functional>
+
namespace phosphor
{
namespace power
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index 981435f..c10fdf7 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -24,12 +24,13 @@
#include "types.hpp"
#include "utility.hpp"
-#include <functional>
#include <org/open_power/Witherspoon/Fault/error.hpp>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Common/Device/error.hpp>
#include <xyz/openbmc_project/Software/Version/server.hpp>
+#include <functional>
+
namespace phosphor
{
namespace power
diff --git a/power-supply/record_manager.cpp b/power-supply/record_manager.cpp
index 3ff655b..53e8fe3 100644
--- a/power-supply/record_manager.cpp
+++ b/power-supply/record_manager.cpp
@@ -17,9 +17,10 @@
#include <math.h>
-#include <chrono>
#include <phosphor-logging/log.hpp>
+#include <chrono>
+
namespace phosphor
{
namespace power
diff --git a/tools/i2c/i2c.cpp b/tools/i2c/i2c.cpp
index bad5b89..4715c6e 100644
--- a/tools/i2c/i2c.cpp
+++ b/tools/i2c/i2c.cpp
@@ -8,7 +8,8 @@
#include <cassert>
#include <cerrno>
-extern "C" {
+extern "C"
+{
#include <i2c/smbus.h>
#include <linux/i2c-dev.h>
#include <linux/i2c.h>
diff --git a/tools/power-utils/main.cpp b/tools/power-utils/main.cpp
index 3142bc6..f93272c 100644
--- a/tools/power-utils/main.cpp
+++ b/tools/power-utils/main.cpp
@@ -17,9 +17,10 @@
#include "version.hpp"
#include <CLI/CLI.hpp>
-#include <cassert>
#include <phosphor-logging/log.hpp>
+#include <cassert>
+
using namespace phosphor::logging;
int main(int argc, char** argv)
diff --git a/tools/power-utils/updater.cpp b/tools/power-utils/updater.cpp
index 4c6ed72..1ddde12 100644
--- a/tools/power-utils/updater.cpp
+++ b/tools/power-utils/updater.cpp
@@ -21,9 +21,10 @@
#include "types.hpp"
#include "utility.hpp"
+#include <phosphor-logging/log.hpp>
+
#include <chrono>
#include <fstream>
-#include <phosphor-logging/log.hpp>
#include <thread>
using namespace phosphor::logging;
diff --git a/tools/power-utils/updater.hpp b/tools/power-utils/updater.hpp
index f22f663..fae9d24 100644
--- a/tools/power-utils/updater.hpp
+++ b/tools/power-utils/updater.hpp
@@ -17,8 +17,9 @@
#include "i2c_interface.hpp"
-#include <filesystem>
#include <sdbusplus/bus.hpp>
+
+#include <filesystem>
#include <string>
class TestUpdater;
diff --git a/tools/power-utils/version.cpp b/tools/power-utils/version.cpp
index 12bb7c9..c5c1f5f 100644
--- a/tools/power-utils/version.cpp
+++ b/tools/power-utils/version.cpp
@@ -21,6 +21,7 @@
#include "utility.hpp"
#include <phosphor-logging/log.hpp>
+
#include <tuple>
using json = nlohmann::json;
diff --git a/utility.hpp b/utility.hpp
index 0326cac..8084782 100644
--- a/utility.hpp
+++ b/utility.hpp
@@ -6,6 +6,7 @@
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
+
#include <string>
namespace phosphor