clang-format: update to latest from docs repo
The openbmc/docs/style/cpp/.clang-format has been updated to support
clang-format10, take this opportunity to update it in this repo.
Change-Id: I9e6b9853bf4cd7399b1ae504ea3be5093d763fee
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/.clang-format b/.clang-format
index 8c5278e..52ac0a1 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,13 +14,13 @@
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: true
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
@@ -29,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
@@ -50,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
@@ -78,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
@@ -92,7 +108,8 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
+
diff --git a/download_manager.cpp b/download_manager.cpp
index a3811dd..06f4c78 100644
--- a/download_manager.cpp
+++ b/download_manager.cpp
@@ -7,12 +7,13 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <algorithm>
-#include <filesystem>
-#include <iostream>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
+
+#include <algorithm>
+#include <filesystem>
+#include <iostream>
#include <string>
namespace phosphor
diff --git a/download_manager.hpp b/download_manager.hpp
index b53fc2b..9f7d1cf 100644
--- a/download_manager.hpp
+++ b/download_manager.hpp
@@ -3,6 +3,7 @@
#include "xyz/openbmc_project/Common/TFTP/server.hpp"
#include <sdbusplus/bus.hpp>
+
#include <string>
namespace phosphor
diff --git a/elog-errors.hpp b/elog-errors.hpp
index 2888f0d..aba1b6a 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>
diff --git a/image_manager.cpp b/image_manager.cpp
index 226199c..f11d124 100644
--- a/image_manager.cpp
+++ b/image_manager.cpp
@@ -11,15 +11,16 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <algorithm>
-#include <cstring>
#include <elog-errors.hpp>
-#include <filesystem>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
-#include <string>
#include <xyz/openbmc_project/Software/Image/error.hpp>
+#include <algorithm>
+#include <cstring>
+#include <filesystem>
+#include <string>
+
namespace phosphor
{
namespace software
@@ -40,8 +41,7 @@
fs::path path;
RemovablePath(const fs::path& path) : path(path)
- {
- }
+ {}
~RemovablePath()
{
if (!path.empty())
diff --git a/image_manager.hpp b/image_manager.hpp
index 4f2b206..6dc80cf 100644
--- a/image_manager.hpp
+++ b/image_manager.hpp
@@ -2,6 +2,7 @@
#include "version.hpp"
#include <sdbusplus/server.hpp>
+
#include <string>
namespace phosphor
diff --git a/image_manager_main.cpp b/image_manager_main.cpp
index 867a960..7b4e18e 100644
--- a/image_manager_main.cpp
+++ b/image_manager_main.cpp
@@ -3,11 +3,12 @@
#include "image_manager.hpp"
#include "watch.hpp"
-#include <cstdlib>
-#include <exception>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
+#include <cstdlib>
+#include <exception>
+
int main()
{
using namespace phosphor::software::manager;
diff --git a/image_verify.cpp b/image_verify.cpp
index 7f0bca7..6057653 100644
--- a/image_verify.cpp
+++ b/image_verify.cpp
@@ -9,13 +9,14 @@
#include <openssl/err.h>
#include <sys/stat.h>
-#include <fstream>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
-#include <set>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <fstream>
+#include <set>
+
namespace phosphor
{
namespace software
diff --git a/image_verify.hpp b/image_verify.hpp
index 7ec0661..f5acbb9 100644
--- a/image_verify.hpp
+++ b/image_verify.hpp
@@ -49,8 +49,7 @@
* @param[in] fd - File descriptor
*/
CustomFd(int fd) : fd(fd)
- {
- }
+ {}
~CustomFd()
{
@@ -96,8 +95,7 @@
* @param[in] length - length of the map
*/
CustomMap(void* addr, size_t length) : addr(addr), length(length)
- {
- }
+ {}
~CustomMap()
{
diff --git a/item_updater.cpp b/item_updater.cpp
index 52b60b1..7c9a202 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -7,17 +7,18 @@
#include "version.hpp"
#include "xyz/openbmc_project/Software/Version/server.hpp"
-#include <filesystem>
-#include <fstream>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/Software/Image/error.hpp>
+
+#include <filesystem>
+#include <fstream>
#include <queue>
#include <set>
#include <string>
#include <thread>
-#include <xyz/openbmc_project/Common/error.hpp>
-#include <xyz/openbmc_project/Software/Image/error.hpp>
namespace phosphor
{
diff --git a/item_updater.hpp b/item_updater.hpp
index 313c568..b1d1c63 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -6,11 +6,12 @@
#include "xyz/openbmc_project/Collection/DeleteAll/server.hpp"
#include <sdbusplus/server.hpp>
-#include <string>
#include <xyz/openbmc_project/Association/Definitions/server.hpp>
#include <xyz/openbmc_project/Common/FactoryReset/server.hpp>
#include <xyz/openbmc_project/Control/FieldMode/server.hpp>
+#include <string>
+
namespace phosphor
{
namespace software
diff --git a/item_updater_helper.hpp b/item_updater_helper.hpp
index 13b98da..2aeeb23 100644
--- a/item_updater_helper.hpp
+++ b/item_updater_helper.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <sdbusplus/bus.hpp>
+
#include <string>
namespace phosphor
diff --git a/openssl_alloc.hpp b/openssl_alloc.hpp
index 90569bf..542db55 100644
--- a/openssl_alloc.hpp
+++ b/openssl_alloc.hpp
@@ -7,9 +7,10 @@
#include <openssl/evp.h>
-extern "C" {
-EVP_MD_CTX* EVP_MD_CTX_new(void);
-void EVP_MD_CTX_free(EVP_MD_CTX* ctx);
+extern "C"
+{
+ EVP_MD_CTX* EVP_MD_CTX_new(void);
+ void EVP_MD_CTX_free(EVP_MD_CTX* ctx);
}
#endif // OPENSSL_VERSION_NUMBER < 0x10100000L
diff --git a/serialize.cpp b/serialize.cpp
index f5aeb11..a6956c2 100644
--- a/serialize.cpp
+++ b/serialize.cpp
@@ -3,11 +3,12 @@
#include "serialize.hpp"
#include <cereal/archives/json.hpp>
-#include <filesystem>
-#include <fstream>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/server.hpp>
+#include <filesystem>
+#include <fstream>
+
namespace phosphor
{
namespace software
@@ -116,8 +117,7 @@
}
}
catch (const std::exception& e)
- {
- }
+ {}
return false;
}
diff --git a/sync_manager.cpp b/sync_manager.cpp
index d44a81b..bdf8ac4 100644
--- a/sync_manager.cpp
+++ b/sync_manager.cpp
@@ -6,9 +6,10 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <filesystem>
#include <phosphor-logging/log.hpp>
+#include <filesystem>
+
namespace phosphor
{
namespace software
diff --git a/sync_manager_main.cpp b/sync_manager_main.cpp
index a808702..ee2ce83 100644
--- a/sync_manager_main.cpp
+++ b/sync_manager_main.cpp
@@ -5,11 +5,12 @@
#include <systemd/sd-event.h>
-#include <exception>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/manager.hpp>
+#include <exception>
+
int main()
{
auto bus = sdbusplus::bus::new_default();
diff --git a/sync_watch.cpp b/sync_watch.cpp
index e4942fd..7f1f970 100644
--- a/sync_watch.cpp
+++ b/sync_watch.cpp
@@ -5,9 +5,10 @@
#include <sys/inotify.h>
#include <unistd.h>
+#include <phosphor-logging/log.hpp>
+
#include <filesystem>
#include <fstream>
-#include <phosphor-logging/log.hpp>
namespace phosphor
{
diff --git a/utils.hpp b/utils.hpp
index 67c4998..7a4150d 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -1,7 +1,8 @@
#include "config.h"
-#include <map>
#include <sdbusplus/server.hpp>
+
+#include <map>
#include <string>
namespace utils
diff --git a/version.cpp b/version.cpp
index f50500a..18f3f4f 100644
--- a/version.cpp
+++ b/version.cpp
@@ -6,10 +6,11 @@
#include <openssl/sha.h>
-#include <fstream>
-#include <iostream>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
+
+#include <fstream>
+#include <iostream>
#include <sstream>
#include <stdexcept>
#include <string>
diff --git a/version.hpp b/version.hpp
index 5827c8a..9cf76da 100644
--- a/version.hpp
+++ b/version.hpp
@@ -4,8 +4,9 @@
#include "xyz/openbmc_project/Object/Delete/server.hpp"
#include "xyz/openbmc_project/Software/Version/server.hpp"
-#include <functional>
#include <sdbusplus/bus.hpp>
+
+#include <functional>
#include <string>
namespace phosphor
diff --git a/watch.cpp b/watch.cpp
index 33d5ec0..90f75a7 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -7,10 +7,11 @@
#include <sys/inotify.h>
#include <unistd.h>
+#include <phosphor-logging/log.hpp>
+
#include <cstddef>
#include <cstring>
#include <filesystem>
-#include <phosphor-logging/log.hpp>
#include <stdexcept>
#include <string>