clang-format: copy latest and re-format
clang-format-17 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: Iff253307fce5ebb3dff66b87e2742919cc5b30b8
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d92a3f1..d43e884 100644
--- a/.clang-format
+++ b/.clang-format
@@ -14,26 +14,30 @@
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
-AllowShortIfStatementsOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
+BitFieldColonSpacing: None
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
+ AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
- AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
+ BeforeLambdaBody: false
+ BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
@@ -48,17 +52,16 @@
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DeriveLineEnding: false
DerivePointerAlignment: false
-PointerAlignment: Left
DisableFormat: false
-ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
-ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](gtest|gmock)'
@@ -78,6 +81,7 @@
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
+IndentExternBlock: NoIndent
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
@@ -92,6 +96,7 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
@@ -100,12 +105,13 @@
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
+PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
ReflowComments: true
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: Keyword
-SortIncludes: true
+SortIncludes: CaseSensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
@@ -117,7 +123,7 @@
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
-SpacesInAngles: false
+SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
diff --git a/src/power_control.cpp b/src/power_control.cpp
index bc30b71..2257484 100644
--- a/src/power_control.cpp
+++ b/src/power_control.cpp
@@ -212,7 +212,7 @@
"ERROR_MSG", ec.message());
return;
}
- },
+ },
"xyz.openbmc_project.BeepCode", "/xyz/openbmc_project/BeepCode",
"xyz.openbmc_project.BeepCode", "Beep", uint8_t(beepPriority));
}
@@ -685,7 +685,7 @@
{
lg2::error("failed to reset ACBoot property");
}
- },
+ },
"xyz.openbmc_project.Settings",
"/xyz/openbmc_project/control/host0/ac_boot",
"org.freedesktop.DBus.Properties", "Set",
@@ -974,7 +974,7 @@
return;
}
setProperties(properties);
- },
+ },
setingsService, powerRestorePolicyObject,
"org.freedesktop.DBus.Properties", "GetAll", powerRestorePolicyIface);
@@ -988,7 +988,7 @@
return;
}
setProperties(properties);
- },
+ },
setingsService, powerACBootObject, "org.freedesktop.DBus.Properties",
"GetAll", powerACBootIface);
#endif
@@ -1553,13 +1553,13 @@
{
lg2::error("failed to set poh counter");
}
- },
+ },
"xyz.openbmc_project.Settings",
"/xyz/openbmc_project/state/chassis0",
"org.freedesktop.DBus.Properties", "Set",
"xyz.openbmc_project.State.PowerOnHours", "POHCounter",
std::variant<uint32_t>(*pohCounter + 1));
- },
+ },
"xyz.openbmc_project.Settings",
"/xyz/openbmc_project/state/chassis0",
"org.freedesktop.DBus.Properties", "Get",
@@ -1652,7 +1652,7 @@
"PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s",
"OpenBMC.0.1.DCPowerOff", NULL);
}
- });
+ });
}
static void sioPowerGoodWatchdogTimerStart()
@@ -2083,7 +2083,7 @@
lg2::error("Failed to call chassis system reset: {ERR}", "ERR",
ec.message());
}
- },
+ },
systemdBusname, systemdPath, systemdInterface, "StartUnit",
systemTargetName, "replace");
}
@@ -2097,7 +2097,7 @@
{
lg2::error("failed to set NMI source");
}
- },
+ },
"xyz.openbmc_project.Settings",
"/xyz/openbmc_project/Chassis/Control/NMISource",
"org.freedesktop.DBus.Properties", "Set",
@@ -2173,7 +2173,7 @@
lg2::error("Unable to read NMI source: {ERROR}", "ERROR", e);
return;
}
- });
+ });
}
static void setNmiSource()
@@ -2184,7 +2184,7 @@
{
lg2::error("failed to set NMI source");
}
- },
+ },
"xyz.openbmc_project.Settings",
"/xyz/openbmc_project/Chassis/Control/NMISource",
"org.freedesktop.DBus.Properties", "Set",
@@ -2475,8 +2475,8 @@
static sdbusplus::bus::match_t
dbusGPIOMatcher(const ConfigData& cfg, std::function<void(bool)> onMatch)
{
- auto pulseEventMatcherCallback =
- [&cfg, onMatch](sdbusplus::message_t& msg) {
+ auto pulseEventMatcherCallback = [&cfg,
+ onMatch](sdbusplus::message_t& msg) {
bool value = false;
if (!getDbusMsgGPIOState(msg, cfg.lineName, value))
{
@@ -3026,7 +3026,7 @@
}
resp = requested;
return 1;
- });
+ });
hostIface->register_property("CurrentHostState",
std::string(getHostState(powerState)));
@@ -3099,7 +3099,7 @@
}
resp = requested;
return 1;
- });
+ });
chassisIface->register_property("CurrentPowerState",
std::string(getChassisState(powerState)));
chassisIface->register_property("LastStateChangeTime", getCurrentTimeMs());
@@ -3134,7 +3134,7 @@
}
resp = requested;
return 1;
- });
+ });
chassisSysIface->register_property(
"CurrentPowerState", std::string(getChassisState(powerState)));
chassisSysIface->register_property("LastStateChangeTime",
@@ -3185,7 +3185,7 @@
}
resp = requested;
return 1;
- });
+ });
chassisSlotIface->register_property(
"CurrentPowerState", std::string(getSlotState(slotPowerState)));
chassisSlotIface->register_property("LastStateChangeTime",
@@ -3205,8 +3205,7 @@
"xyz.openbmc_project.Chassis.Buttons");
powerButtonIface->register_property(
- "ButtonMasked", false,
- [](const bool requested, bool& current) {
+ "ButtonMasked", false, [](const bool requested, bool& current) {
if (requested)
{
if (powerButtonMask)
@@ -3233,7 +3232,7 @@
// Update the mask setting
current = requested;
return 1;
- });
+ });
// Check power button state
bool powerButtonPressed;
@@ -3261,8 +3260,7 @@
"xyz.openbmc_project.Chassis.Buttons");
resetButtonIface->register_property(
- "ButtonMasked", false,
- [](const bool requested, bool& current) {
+ "ButtonMasked", false, [](const bool requested, bool& current) {
if (requested)
{
if (resetButtonMask)
@@ -3289,7 +3287,7 @@
// Update the mask setting
current = requested;
return 1;
- });
+ });
// Check reset button state
bool resetButtonPressed;
@@ -3317,25 +3315,25 @@
nmiButtonIface->register_property(
"ButtonMasked", false, [](const bool requested, bool& current) {
- if (nmiButtonMasked == requested)
- {
- // NMI button mask is already set as requested, so no change
- return 1;
- }
- if (requested)
- {
- lg2::info("NMI Button Masked.");
- nmiButtonMasked = true;
- }
- else
- {
- lg2::info("NMI Button Un-masked.");
- nmiButtonMasked = false;
- }
- // Update the mask setting
- current = nmiButtonMasked;
+ if (nmiButtonMasked == requested)
+ {
+ // NMI button mask is already set as requested, so no change
return 1;
- });
+ }
+ if (requested)
+ {
+ lg2::info("NMI Button Masked.");
+ nmiButtonMasked = true;
+ }
+ else
+ {
+ lg2::info("NMI Button Un-masked.");
+ nmiButtonMasked = false;
+ }
+ // Update the mask setting
+ current = nmiButtonMasked;
+ return 1;
+ });
// Check NMI button state
bool nmiButtonPressed;
@@ -3454,7 +3452,7 @@
requested);
resp = requested;
return 1;
- });
+ });
restartCauseIface->initialize();