clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I2612058799afbcd10f98bd32d2e191b0be7e437b
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 79a474d..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,12 +6,14 @@
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
-AlignOperands: true
-AlignTrailingComments: true
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
@@ -36,6 +38,7 @@
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
@@ -75,9 +78,13 @@
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
+InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -85,13 +92,19 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
ReflowComments: true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
@@ -111,6 +124,6 @@
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 4
-UseCRLF: false
UseTab: Never
...
+
diff --git a/chassis_state_manager_main.cpp b/chassis_state_manager_main.cpp
index 96542b9..af572f1 100644
--- a/chassis_state_manager_main.cpp
+++ b/chassis_state_manager_main.cpp
@@ -41,8 +41,8 @@
auto bus = sdbusplus::bus::new_default();
- auto chassisBusName =
- std::string{CHASSIS_BUSNAME} + std::to_string(chassisId);
+ auto chassisBusName = std::string{CHASSIS_BUSNAME} +
+ std::to_string(chassisId);
auto objPathInst = std::string{CHASSIS_OBJPATH} + std::to_string(chassisId);
if (chassisId == 0)
diff --git a/discover_system_state.cpp b/discover_system_state.cpp
index 8dfe004..baa8ff2 100644
--- a/discover_system_state.cpp
+++ b/discover_system_state.cpp
@@ -57,8 +57,8 @@
{
case 'h':
hostId = std::stoul(optarg);
- hostPath =
- std::string("/xyz/openbmc_project/state/host") + optarg;
+ hostPath = std::string("/xyz/openbmc_project/state/host") +
+ optarg;
break;
default:
break;
diff --git a/hypervisor_state_manager.hpp b/hypervisor_state_manager.hpp
index 8fffbe0..6253c38 100644
--- a/hypervisor_state_manager.hpp
+++ b/hypervisor_state_manager.hpp
@@ -44,12 +44,13 @@
HypervisorInherit(bus, objPath,
HypervisorInherit::action::emit_object_added),
bus(bus),
- bootProgressChangeSignal(
- bus,
- sdbusRule::propertiesChanged(
- "/xyz/openbmc_project/state/host0",
- "xyz.openbmc_project.State.Boot.Progress"),
- [this](sdbusplus::message_t& m) { bootProgressChangeEvent(m); })
+ bootProgressChangeSignal(bus,
+ sdbusRule::propertiesChanged(
+ "/xyz/openbmc_project/state/host0",
+ "xyz.openbmc_project.State.Boot.Progress"),
+ [this](sdbusplus::message_t& m) {
+ bootProgressChangeEvent(m);
+ })
{}
/** @brief Set value of HostTransition */
diff --git a/scheduled_host_transition.hpp b/scheduled_host_transition.hpp
index 19736e6..a272217 100644
--- a/scheduled_host_transition.hpp
+++ b/scheduled_host_transition.hpp
@@ -106,11 +106,11 @@
/** @brief The deleter of sd_event_source */
std::function<void(sd_event_source*)> sdEventSourceDeleter =
[](sd_event_source* p) {
- if (p)
- {
- sd_event_source_unref(p);
- }
- };
+ if (p)
+ {
+ sd_event_source_unref(p);
+ }
+ };
using SdEventSource =
std::unique_ptr<sd_event_source, decltype(sdEventSourceDeleter)>;
diff --git a/settings.cpp b/settings.cpp
index ac99660..2e2e70a 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -100,8 +100,8 @@
Service Objects::service(const Path& path, const Interface& interface) const
{
using Interfaces = std::vector<Interface>;
- auto mapperCall =
- bus.new_method_call(mapperService, mapperPath, mapperIntf, "GetObject");
+ auto mapperCall = bus.new_method_call(mapperService, mapperPath, mapperIntf,
+ "GetObject");
mapperCall.append(path);
mapperCall.append(Interfaces({interface}));
diff --git a/systemd_target_parser.cpp b/systemd_target_parser.cpp
index 7015c00..fe51d1a 100644
--- a/systemd_target_parser.cpp
+++ b/systemd_target_parser.cpp
@@ -19,8 +19,8 @@
}
}
// See if default was in the errors to monitor, if so replace with defaults
- auto errorItr =
- std::find(errorsToMonitor.begin(), errorsToMonitor.end(), "default");
+ auto errorItr = std::find(errorsToMonitor.begin(), errorsToMonitor.end(),
+ "default");
if (errorItr != errorsToMonitor.end())
{
// Verify default is the only entry
diff --git a/utils.cpp b/utils.cpp
index 38e1290..20ebc4b 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -219,8 +219,8 @@
bool checkACLoss(size_t& chassisId)
{
- std::string chassisLostPowerFileFmt =
- fmt::sprintf(CHASSIS_LOST_POWER_FILE, chassisId);
+ std::string chassisLostPowerFileFmt = fmt::sprintf(CHASSIS_LOST_POWER_FILE,
+ chassisId);
std::filesystem::path chassisPowerLossFile{chassisLostPowerFileFmt};
if (std::filesystem::exists(chassisPowerLossFile))