style: update clang-format
Pull the most recent OpenBMC style rules and run clang-format.
Change-Id: Ifecce87b6aa64a2800dab3ba1e09ae415accb548
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.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/activation.cpp b/activation.cpp
index d024d07..e7a6714 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -4,7 +4,6 @@
#include "item_updater.hpp"
-#include <experimental/filesystem>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
@@ -12,6 +11,8 @@
#include <sdbusplus/server.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <experimental/filesystem>
+
#ifdef WANT_SIGNATURE_VERIFY
#include "image_verify.hpp"
#endif
diff --git a/activation.hpp b/activation.hpp
index c236c9b..0622545 100644
--- a/activation.hpp
+++ b/activation.hpp
@@ -8,11 +8,12 @@
#include "xyz/openbmc_project/Software/RedundancyPriority/server.hpp"
#include <sdbusplus/server.hpp>
-#include <string>
#include <xyz/openbmc_project/Association/Definitions/server.hpp>
#include <xyz/openbmc_project/Software/Activation/server.hpp>
#include <xyz/openbmc_project/Software/ActivationBlocksTransition/server.hpp>
+#include <string>
+
namespace openpower
{
namespace software
@@ -114,8 +115,7 @@
ActivationBlocksTransitionInherit(bus, path.c_str(),
action::emit_interface_added)
- {
- }
+ {}
};
class ActivationProgress : public ActivationProgressInherit
diff --git a/image_verify.cpp b/image_verify.cpp
index 4fb2d9c..cf955d7 100644
--- a/image_verify.cpp
+++ b/image_verify.cpp
@@ -8,13 +8,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 openpower
{
namespace software
diff --git a/image_verify.hpp b/image_verify.hpp
index d4f0930..3e3f4d4 100644
--- a/image_verify.hpp
+++ b/image_verify.hpp
@@ -49,8 +49,7 @@
* @param[in] fd - File descriptor
*/
explicit 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 6fe2702..d8cf45f 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -4,10 +4,11 @@
#include "xyz/openbmc_project/Common/error.hpp"
-#include <filesystem>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
+#include <filesystem>
+
namespace openpower
{
namespace software
diff --git a/item_updater.hpp b/item_updater.hpp
index 1fcb2d0..b1e676b 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -5,11 +5,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/Object/Enable/server.hpp>
+#include <string>
+
namespace openpower
{
namespace software
@@ -89,8 +90,7 @@
MatchRules::path("/xyz/openbmc_project/software"),
std::bind(std::mem_fn(&ItemUpdater::createActivation),
this, std::placeholders::_1))
- {
- }
+ {}
virtual ~ItemUpdater() = default;
diff --git a/item_updater_main.cpp b/item_updater_main.cpp
index e2b5793..e5991f3 100644
--- a/item_updater_main.cpp
+++ b/item_updater_main.cpp
@@ -12,6 +12,7 @@
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/manager.hpp>
+
#include <system_error>
int main(int argc, char* argv[])
diff --git a/mmc/activation_mmc.cpp b/mmc/activation_mmc.cpp
index 67ad55a..84a1e98 100644
--- a/mmc/activation_mmc.cpp
+++ b/mmc/activation_mmc.cpp
@@ -14,16 +14,13 @@
}
void ActivationMMC::startActivation()
-{
-}
+{}
void ActivationMMC::unitStateChange(sdbusplus::message::message& msg)
-{
-}
+{}
void ActivationMMC::finishActivation()
-{
-}
+{}
} // namespace updater
} // namespace software
diff --git a/mmc/item_updater_mmc.cpp b/mmc/item_updater_mmc.cpp
index 5671a61..4d70ccf 100644
--- a/mmc/item_updater_mmc.cpp
+++ b/mmc/item_updater_mmc.cpp
@@ -48,12 +48,10 @@
}
void ItemUpdaterMMC::processPNORImage()
-{
-}
+{}
void ItemUpdaterMMC::reset()
-{
-}
+{}
bool ItemUpdaterMMC::isVersionFunctional(const std::string& versionId)
{
@@ -61,12 +59,10 @@
}
void ItemUpdaterMMC::freePriority(uint8_t value, const std::string& versionId)
-{
-}
+{}
void ItemUpdaterMMC::deleteAll()
-{
-}
+{}
bool ItemUpdaterMMC::freeSpace()
{
@@ -74,12 +70,10 @@
}
void ItemUpdaterMMC::updateFunctionalAssociation(const std::string& versionId)
-{
-}
+{}
void GardResetMMC::reset()
-{
-}
+{}
} // namespace updater
} // namespace software
diff --git a/msl_verify.cpp b/msl_verify.cpp
index d6b2ff7..f80e179 100644
--- a/msl_verify.cpp
+++ b/msl_verify.cpp
@@ -2,9 +2,10 @@
#include "msl_verify.hpp"
+#include <phosphor-logging/log.hpp>
+
#include <experimental/filesystem>
#include <fstream>
-#include <phosphor-logging/log.hpp>
#include <regex>
namespace openpower
diff --git a/static/item_updater_static.cpp b/static/item_updater_static.cpp
index 21b418c..ea9b7b8 100644
--- a/static/item_updater_static.cpp
+++ b/static/item_updater_static.cpp
@@ -6,16 +6,17 @@
#include "utils.hpp"
#include "version.hpp"
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/log.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+
#include <array>
#include <cstring>
#include <filesystem>
#include <fstream>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
#include <sstream>
#include <string>
#include <tuple>
-#include <xyz/openbmc_project/Common/error.hpp>
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
using namespace phosphor::logging;
@@ -328,8 +329,7 @@
void ItemUpdaterStatic::freePriority(uint8_t value,
const std::string& versionId)
-{
-}
+{}
void ItemUpdaterStatic::deleteAll()
{
diff --git a/ubi/activation_ubi.cpp b/ubi/activation_ubi.cpp
index 383dc51..97358e8 100644
--- a/ubi/activation_ubi.cpp
+++ b/ubi/activation_ubi.cpp
@@ -3,9 +3,10 @@
#include "item_updater.hpp"
#include "serialize.hpp"
-#include <experimental/filesystem>
#include <phosphor-logging/log.hpp>
+#include <experimental/filesystem>
+
namespace openpower
{
namespace software
diff --git a/ubi/item_updater_ubi.cpp b/ubi/item_updater_ubi.cpp
index ae6b3fd..ee87965 100644
--- a/ubi/item_updater_ubi.cpp
+++ b/ubi/item_updater_ubi.cpp
@@ -8,13 +8,14 @@
#include "version.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
-#include <experimental/filesystem>
-#include <fstream>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
+#include <xyz/openbmc_project/Software/Version/server.hpp>
+
+#include <experimental/filesystem>
+#include <fstream>
#include <queue>
#include <string>
-#include <xyz/openbmc_project/Software/Version/server.hpp>
namespace openpower
{
diff --git a/ubi/serialize.cpp b/ubi/serialize.cpp
index a40925a..e047b87 100644
--- a/ubi/serialize.cpp
+++ b/ubi/serialize.cpp
@@ -3,9 +3,10 @@
#include "serialize.hpp"
#include <cereal/archives/json.hpp>
+#include <sdbusplus/server.hpp>
+
#include <experimental/filesystem>
#include <fstream>
-#include <sdbusplus/server.hpp>
namespace openpower
{
@@ -107,8 +108,7 @@
}
}
catch (const std::exception& e)
- {
- }
+ {}
return false;
}
diff --git a/ubi/watch.cpp b/ubi/watch.cpp
index 60d0014..fd2cad2 100644
--- a/ubi/watch.cpp
+++ b/ubi/watch.cpp
@@ -7,11 +7,12 @@
#include <sys/inotify.h>
#include <unistd.h>
+#include <phosphor-logging/log.hpp>
+
#include <cstddef>
#include <cstring>
#include <experimental/filesystem>
#include <functional>
-#include <phosphor-logging/log.hpp>
#include <stdexcept>
#include <string>
diff --git a/ubi/watch.hpp b/ubi/watch.hpp
index 2e0ec17..2628e93 100644
--- a/ubi/watch.hpp
+++ b/ubi/watch.hpp
@@ -42,8 +42,7 @@
* @param[in] fd - File descriptor
*/
explicit CustomFd(int fd) : fd(fd)
- {
- }
+ {}
~CustomFd()
{
diff --git a/utils.hpp b/utils.hpp
index 6bd8d97..acb44ca 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -8,11 +8,13 @@
#include <openssl/evp.h>
#include <sdbusplus/bus.hpp>
+
#include <string>
-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);
}
namespace utils
diff --git a/version.cpp b/version.cpp
index f7471c2..ec23955 100644
--- a/version.cpp
+++ b/version.cpp
@@ -5,10 +5,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 c7d2b03..51a7024 100644
--- a/version.hpp
+++ b/version.hpp
@@ -7,6 +7,7 @@
#include "xyz/openbmc_project/Software/Version/server.hpp"
#include <sdbusplus/bus.hpp>
+
#include <string>
namespace openpower
@@ -48,8 +49,7 @@
Delete(sdbusplus::bus::bus& bus, const std::string& path, Version& parent) :
DeleteInherit(bus, path.c_str(), action::emit_interface_added),
parent(parent)
- {
- }
+ {}
/**
* @brief Delete the D-Bus object.