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: Iad285e60cad29e025a02d0c0cabcb76fe593b5cf
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/inc/button_factory.hpp b/inc/button_factory.hpp
index 69e05a9..faf948d 100644
--- a/inc/button_factory.hpp
+++ b/inc/button_factory.hpp
@@ -38,9 +38,9 @@
buttonIfaceRegistry[std::string(T::getFormFactorName())] =
[](sdbusplus::bus_t& bus, EventPtr& event,
buttonConfig& buttonCfg) {
- return std::make_unique<T>(bus, T::getDbusObjectPath(), event,
- buttonCfg);
- };
+ return std::make_unique<T>(bus, T::getDbusObjectPath(), event,
+ buttonCfg);
+ };
}
/**
* @brief this method returns the button interface object
@@ -77,4 +77,4 @@
// register the class factory function
ButtonFactory::instance().addToRegistry<T>();
}
-};
\ No newline at end of file
+};
diff --git a/inc/button_interface.hpp b/inc/button_interface.hpp
index f05beb9..9905304 100644
--- a/inc/button_interface.hpp
+++ b/inc/button_interface.hpp
@@ -28,8 +28,7 @@
IOError();
}
}
- virtual ~ButtonIface()
- {}
+ virtual ~ButtonIface() {}
/**
* @brief This method is called from sd-event provided callback function
diff --git a/inc/serial_uart_mux.hpp b/inc/serial_uart_mux.hpp
index 5c506b9..c1ad166 100644
--- a/inc/serial_uart_mux.hpp
+++ b/inc/serial_uart_mux.hpp
@@ -72,8 +72,7 @@
void configSerialConsoleMux(size_t position);
bool isOCPDebugCardPresent();
- void handleEvent(sd_event_source*, int, uint32_t)
- {}
+ void handleEvent(sd_event_source*, int, uint32_t) {}
protected:
size_t gpioLineCount;
diff --git a/src/debugHostSelector_button.cpp b/src/debugHostSelector_button.cpp
index 6f078f2..d4de9c2 100644
--- a/src/debugHostSelector_button.cpp
+++ b/src/debugHostSelector_button.cpp
@@ -63,4 +63,4 @@
// emit released signal
released();
}
-}
\ No newline at end of file
+}
diff --git a/src/hostSelector_switch.cpp b/src/hostSelector_switch.cpp
index efbccd2..ce168d0 100644
--- a/src/hostSelector_switch.cpp
+++ b/src/hostSelector_switch.cpp
@@ -60,8 +60,8 @@
throw sdbusplus::xyz::openbmc_project::Chassis::Common::Error::
IOError();
}
- GpioState gpioState =
- (buf == '0') ? (GpioState::deassert) : (GpioState::assert);
+ GpioState gpioState = (buf == '0') ? (GpioState::deassert)
+ : (GpioState::assert);
setHostSelectorValue(config.gpios[index].fd, gpioState);
size_t hsPosMapped = getMappedHSConfig(hostSelectorPosition);
if (hsPosMapped != INVALID_INDEX)
@@ -120,8 +120,8 @@
}
// read the gpio state for the io event received
- GpioState gpioState =
- (buf == '0') ? (GpioState::deassert) : (GpioState::assert);
+ GpioState gpioState = (buf == '0') ? (GpioState::deassert)
+ : (GpioState::assert);
setHostSelectorValue(fd, gpioState);
@@ -131,4 +131,4 @@
{
position(hsPosMapped);
}
-}
\ No newline at end of file
+}
diff --git a/src/serial_uart_mux.cpp b/src/serial_uart_mux.cpp
index 00724dd..31c2051 100644
--- a/src/serial_uart_mux.cpp
+++ b/src/serial_uart_mux.cpp
@@ -41,8 +41,8 @@
// check the debug card present pin
bool SerialUartMux::isOCPDebugCardPresent()
{
- auto gpioState =
- getGpioState(debugCardPresentGpio.fd, debugCardPresentGpio.polarity);
+ auto gpioState = getGpioState(debugCardPresentGpio.fd,
+ debugCardPresentGpio.polarity);
return (gpioState == GpioState::assert);
}
// set the serial uart MUX to select the console w.r.t host selector position
@@ -66,8 +66,8 @@
if (gpioConfig.name == SERIAL_UART_RX_GPIO)
{
- gpioState =
- debugCardPresent ? GpioState::assert : GpioState::deassert;
+ gpioState = debugCardPresent ? GpioState::assert
+ : GpioState::deassert;
}
else
{