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: I729d80cbcef16e9603f881163b54cc8b8f60b36f
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/hiomap.cpp b/hiomap.cpp
index d20fda7..7e616ae 100644
--- a/hiomap.cpp
+++ b/hiomap.cpp
@@ -422,8 +422,8 @@
static bus::match_t hiomap_match_properties(struct hiomap* ctx)
{
- auto properties = bus::match::rules::propertiesChanged(HIOMAPD_OBJECT,
- HIOMAPD_IFACE_V2);
+ auto properties =
+ bus::match::rules::propertiesChanged(HIOMAPD_OBJECT, HIOMAPD_IFACE_V2);
bus::match_t match(
*ctx->bus, properties,
@@ -454,10 +454,9 @@
return IPMI_CC_OK;
}
-static ipmi_ret_t hiomap_get_info(ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t data_len,
- ipmi_context_t context)
+static ipmi_ret_t
+ hiomap_get_info(ipmi_request_t request, ipmi_response_t response,
+ ipmi_data_len_t data_len, ipmi_context_t context)
{
struct hiomap* ctx = static_cast<struct hiomap*>(context);
@@ -497,10 +496,9 @@
return IPMI_CC_OK;
}
-static ipmi_ret_t hiomap_get_flash_info([[maybe_unused]] ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t data_len,
- ipmi_context_t context)
+static ipmi_ret_t hiomap_get_flash_info(
+ [[maybe_unused]] ipmi_request_t request, ipmi_response_t response,
+ ipmi_data_len_t data_len, ipmi_context_t context)
{
struct hiomap* ctx = static_cast<struct hiomap*>(context);
@@ -527,10 +525,9 @@
return IPMI_CC_OK;
}
-static ipmi_ret_t hiomap_create_window(struct hiomap* ctx, bool ro,
- ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t data_len)
+static ipmi_ret_t
+ hiomap_create_window(struct hiomap* ctx, bool ro, ipmi_request_t request,
+ ipmi_response_t response, ipmi_data_len_t data_len)
{
if (*data_len < 4)
{
@@ -569,30 +566,27 @@
return IPMI_CC_OK;
}
-static ipmi_ret_t hiomap_create_read_window(ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t data_len,
- ipmi_context_t context)
+static ipmi_ret_t
+ hiomap_create_read_window(ipmi_request_t request, ipmi_response_t response,
+ ipmi_data_len_t data_len, ipmi_context_t context)
{
struct hiomap* ctx = static_cast<struct hiomap*>(context);
return hiomap_create_window(ctx, true, request, response, data_len);
}
-static ipmi_ret_t hiomap_create_write_window(ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t data_len,
- ipmi_context_t context)
+static ipmi_ret_t
+ hiomap_create_write_window(ipmi_request_t request, ipmi_response_t response,
+ ipmi_data_len_t data_len, ipmi_context_t context)
{
struct hiomap* ctx = static_cast<struct hiomap*>(context);
return hiomap_create_window(ctx, false, request, response, data_len);
}
-static ipmi_ret_t hiomap_close_window(ipmi_request_t request,
- [[maybe_unused]] ipmi_response_t response,
- ipmi_data_len_t data_len,
- ipmi_context_t context)
+static ipmi_ret_t hiomap_close_window(
+ ipmi_request_t request, [[maybe_unused]] ipmi_response_t response,
+ ipmi_data_len_t data_len, ipmi_context_t context)
{
struct hiomap* ctx = static_cast<struct hiomap*>(context);
@@ -620,10 +614,9 @@
return IPMI_CC_OK;
}
-static ipmi_ret_t hiomap_mark_dirty(ipmi_request_t request,
- [[maybe_unused]] ipmi_response_t response,
- ipmi_data_len_t data_len,
- ipmi_context_t context)
+static ipmi_ret_t hiomap_mark_dirty(
+ ipmi_request_t request, [[maybe_unused]] ipmi_response_t response,
+ ipmi_data_len_t data_len, ipmi_context_t context)
{
struct hiomap* ctx = static_cast<struct hiomap*>(context);
@@ -769,12 +762,10 @@
/* FIXME: Double evaluation */
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-static ipmi_ret_t hiomap_dispatch([[maybe_unused]] ipmi_netfn_t netfn,
- [[maybe_unused]] ipmi_cmd_t cmd,
- ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t data_len,
- ipmi_context_t context)
+static ipmi_ret_t hiomap_dispatch(
+ [[maybe_unused]] ipmi_netfn_t netfn, [[maybe_unused]] ipmi_cmd_t cmd,
+ ipmi_request_t request, ipmi_response_t response, ipmi_data_len_t data_len,
+ ipmi_context_t context)
{
struct hiomap* ctx = static_cast<struct hiomap*>(context);
@@ -794,9 +785,9 @@
return IPMI_CC_PARM_OUT_OF_RANGE;
}
- bool is_unversioned = (hiomap_cmd == HIOMAP_C_RESET ||
- hiomap_cmd == HIOMAP_C_GET_INFO ||
- hiomap_cmd == HIOMAP_C_ACK);
+ bool is_unversioned =
+ (hiomap_cmd == HIOMAP_C_RESET || hiomap_cmd == HIOMAP_C_GET_INFO ||
+ hiomap_cmd == HIOMAP_C_ACK);
if (!is_unversioned && ctx->seq == ipmi_req[1])
{
*data_len = 0;
@@ -858,9 +849,9 @@
std::function<SignalResponse(int)> shutdownHandler =
[ctx]([[maybe_unused]] int signalNumber) {
- hiomap_protocol_reset(ctx);
- return sigtermResponse;
- };
+ hiomap_protocol_reset(ctx);
+ return sigtermResponse;
+ };
registerSignalHandler(ipmi::prioMax, SIGTERM, shutdownHandler);
ipmi_register_callback(NETFUN_IBM_OEM, IPMI_CMD_HIOMAP, ctx,