clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: Ia9dd4aed00238b28839b86dfe4ca93155a521766
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
IndentWrappedFunctionNames: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -98,13 +98,14 @@
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
diff --git a/evdev.hpp b/evdev.hpp
index 2cb1dde..c60022b 100644
--- a/evdev.hpp
+++ b/evdev.hpp
@@ -80,8 +80,8 @@
*/
Evdev(const std::string& path, const unsigned int key, EventPtr& event,
sd_event_io_handler_t handler, bool useEvDev = true) :
- path(path),
- key(key), event(event), callbackHandler(handler), fd(openDevice())
+ path(path), key(key), event(event), callbackHandler(handler),
+ fd(openDevice())
{
if (useEvDev)
diff --git a/gpioMon.cpp b/gpioMon.cpp
index 56cf6f7..3648556 100644
--- a/gpioMon.cpp
+++ b/gpioMon.cpp
@@ -37,14 +37,14 @@
gpioEventDescriptor.async_wait(
boost::asio::posix::stream_descriptor::wait_read,
[this](const boost::system::error_code& ec) {
- if (ec)
- {
- lg2::error("{GPIO} event handler error: {ERROR}", "GPIO",
- gpioLineMsg, "ERROR", ec.message());
- return;
- }
- gpioEventHandler();
- });
+ if (ec)
+ {
+ lg2::error("{GPIO} event handler error: {ERROR}", "GPIO",
+ gpioLineMsg, "ERROR", ec.message());
+ return;
+ }
+ gpioEventHandler();
+ });
}
void GpioMonitor::gpioEventHandler()
diff --git a/gpioMon.hpp b/gpioMon.hpp
index a645e02..9f059f0 100644
--- a/gpioMon.hpp
+++ b/gpioMon.hpp
@@ -43,9 +43,9 @@
boost::asio::io_context& io, const std::string& target,
const std::map<std::string, std::vector<std::string>>& targets,
const std::string& lineMsg, bool continueRun) :
- gpioLine(line),
- gpioConfig(config), gpioEventDescriptor(io), target(target),
- targets(targets), gpioLineMsg(lineMsg), continueAfterEvent(continueRun)
+ gpioLine(line), gpioConfig(config), gpioEventDescriptor(io),
+ target(target), targets(targets), gpioLineMsg(lineMsg),
+ continueAfterEvent(continueRun)
{
requestGPIOEvents();
};
diff --git a/monitor.hpp b/monitor.hpp
index 7578d9d..8efd68b 100644
--- a/monitor.hpp
+++ b/monitor.hpp
@@ -47,9 +47,8 @@
EventPtr& event, bool continueRun,
sd_event_io_handler_t handler = Monitor::processEvents,
bool useEvDev = true) :
- Evdev(path, key, event, handler, useEvDev),
- polarity(polarity), target(target),
- continueAfterKeyPress(continueRun){};
+ Evdev(path, key, event, handler, useEvDev), polarity(polarity),
+ target(target), continueAfterKeyPress(continueRun) {};
/** @brief Callback handler when the FD has some activity on it
*
diff --git a/multi-presence/gpio_presence.cpp b/multi-presence/gpio_presence.cpp
index 1a2b45c..809a342 100644
--- a/multi-presence/gpio_presence.cpp
+++ b/multi-presence/gpio_presence.cpp
@@ -119,19 +119,19 @@
gpioEventDescriptor.async_wait(
boost::asio::posix::stream_descriptor::wait_read,
[this, gpio](const boost::system::error_code& ec) {
- if (ec == boost::asio::error::operation_aborted)
- {
- // we were cancelled
- return;
- }
- if (ec)
- {
- lg2::error("{GPIO} event handler error: {ERROR}", "GPIO", gpio,
- "ERROR", ec.message());
- return;
- }
- gpioEventHandler();
- });
+ if (ec == boost::asio::error::operation_aborted)
+ {
+ // we were cancelled
+ return;
+ }
+ if (ec)
+ {
+ lg2::error("{GPIO} event handler error: {ERROR}", "GPIO", gpio,
+ "ERROR", ec.message());
+ return;
+ }
+ gpioEventHandler();
+ });
}
void GpioPresence::cancelEventHandler()
diff --git a/multi-presence/gpio_presence.hpp b/multi-presence/gpio_presence.hpp
index abc4b63..c34ed75 100644
--- a/multi-presence/gpio_presence.hpp
+++ b/multi-presence/gpio_presence.hpp
@@ -64,9 +64,9 @@
boost::asio::io_context& io, const std::string& inventory,
const std::vector<std::string>& extraInterfaces,
const std::string& name, const std::string& lineMsg) :
- gpioLine(line),
- gpioConfig(config), gpioEventDescriptor(io), inventory(inventory),
- interfaces(extraInterfaces), name(name), gpioLineMsg(lineMsg)
+ gpioLine(line), gpioConfig(config), gpioEventDescriptor(io),
+ inventory(inventory), interfaces(extraInterfaces), name(name),
+ gpioLineMsg(lineMsg)
{
requestGPIOEvents();
};
diff --git a/presence/gpio_presence.cpp b/presence/gpio_presence.cpp
index fd1fc8c..ce27d4c 100644
--- a/presence/gpio_presence.cpp
+++ b/presence/gpio_presence.cpp
@@ -58,8 +58,8 @@
{
auto present = false;
auto value = static_cast<int>(0);
- auto fetch_rc = libevdev_fetch_event_value(devicePtr.get(), EV_KEY, key,
- &value);
+ auto fetch_rc =
+ libevdev_fetch_event_value(devicePtr.get(), EV_KEY, key, &value);
if (0 == fetch_rc)
{
lg2::error("Device does not support event type, key: {KEYCODE}",
diff --git a/presence/gpio_presence.hpp b/presence/gpio_presence.hpp
index b6ea47a..3125ba2 100644
--- a/presence/gpio_presence.hpp
+++ b/presence/gpio_presence.hpp
@@ -71,9 +71,8 @@
const std::vector<Driver>& drivers,
const std::vector<Interface>& ifaces,
sd_event_io_handler_t handler = Presence::processEvents) :
- Evdev(path, key, event, handler, true),
- bus(bus), inventory(inventory), name(name), drivers(drivers),
- ifaces(ifaces)
+ Evdev(path, key, event, handler, true), bus(bus), inventory(inventory),
+ name(name), drivers(drivers), ifaces(ifaces)
{
// See if the environment (from configuration file?) has a
// DRIVER_BIND_DELAY_MS set.