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: I98f262c24e427f4228b184715d7ad88b0d7060f6
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/fru_area.cpp b/fru_area.cpp
index a5abf00..328ebad 100644
--- a/fru_area.cpp
+++ b/fru_area.cpp
@@ -11,8 +11,7 @@
IPMIFruArea::IPMIFruArea(const uint8_t fruID, const ipmi_fru_area_type type,
bool bmcOnlyFru) :
- fruID(fruID),
- type(type), bmcOnlyFru(bmcOnlyFru)
+ fruID(fruID), type(type), bmcOnlyFru(bmcOnlyFru)
{
if (type == IPMI_FRU_AREA_INTERNAL_USE)
{
diff --git a/frup.cpp b/frup.cpp
index 8f66a3b..00fcda8 100644
--- a/frup.cpp
+++ b/frup.cpp
@@ -216,8 +216,8 @@
type_code = (type_length & IPMI_FRU_TYPE_LENGTH_TYPE_CODE_MASK) >>
IPMI_FRU_TYPE_LENGTH_TYPE_CODE_SHIFT;
- (*number_of_data_bytes) = type_length &
- IPMI_FRU_TYPE_LENGTH_NUMBER_OF_DATA_BYTES_MASK;
+ (*number_of_data_bytes) =
+ type_length & IPMI_FRU_TYPE_LENGTH_NUMBER_OF_DATA_BYTES_MASK;
/* special case: this shouldn't be a length of 0x01 (see type/length
* byte format in fru information storage definition).
@@ -245,12 +245,12 @@
return (0);
}
-int ipmi_fru_chassis_info_area(const void* areabuf, unsigned int areabuflen,
- uint8_t* chassis_type,
- ipmi_fru_field_t* chassis_part_number,
- ipmi_fru_field_t* chassis_serial_number,
- ipmi_fru_field_t* chassis_custom_fields,
- unsigned int chassis_custom_fields_len)
+int ipmi_fru_chassis_info_area(
+ const void* areabuf, unsigned int areabuflen, uint8_t* chassis_type,
+ ipmi_fru_field_t* chassis_part_number,
+ ipmi_fru_field_t* chassis_serial_number,
+ ipmi_fru_field_t* chassis_custom_fields,
+ unsigned int chassis_custom_fields_len)
{
const uint8_t* areabufptr = (const uint8_t*)areabuf;
unsigned int area_offset = 0;
@@ -497,8 +497,8 @@
goto out;
if (_parse_type_length(areabufptr, areabuflen, area_offset,
- &number_of_data_bytes,
- product_manufacturer_name) < 0)
+ &number_of_data_bytes, product_manufacturer_name) <
+ 0)
goto cleanup;
area_offset += 1; /* type/length byte */
area_offset += number_of_data_bytes;
@@ -516,8 +516,8 @@
goto out;
if (_parse_type_length(areabufptr, areabuflen, area_offset,
- &number_of_data_bytes,
- product_part_model_number) < 0)
+ &number_of_data_bytes, product_part_model_number) <
+ 0)
goto cleanup;
area_offset += 1; /* type/length byte */
area_offset += number_of_data_bytes;
@@ -643,8 +643,8 @@
" Len = [%d] : Val = [%s]\n",
vpd_key_names[vpd_key_id], vpd_val_len, bin_in_ascii);
#endif
- info[vpd_key_id] = std::make_pair(vpd_key_names[vpd_key_id],
- bin_in_ascii);
+ info[vpd_key_id] =
+ std::make_pair(vpd_key_names[vpd_key_id], bin_in_ascii);
break;
case 3:
@@ -750,8 +750,8 @@
printf("Board : Appending [%s] = [%s]\n", vpd_key_names[i],
timestr);
#endif
- info[i] = std::make_pair(vpd_key_names[i],
- std::string(timestr));
+ info[i] =
+ std::make_pair(vpd_key_names[i], std::string(timestr));
continue;
}
_append_to_dict(i, vpd_info[i].type_length_field, info);
diff --git a/strgfnhandler.cpp b/strgfnhandler.cpp
index ea60642..bf56096 100644
--- a/strgfnhandler.cpp
+++ b/strgfnhandler.cpp
@@ -18,11 +18,10 @@
///-------------------------------------------------------
// Called by IPMI netfn router for write fru data command
//--------------------------------------------------------
-ipmi_ret_t ipmiStorageWriteFruData(ipmi_netfn_t /*netfn*/, ipmi_cmd_t /*cmd*/,
- ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t dataLen,
- ipmi_context_t /*context*/)
+ipmi_ret_t
+ ipmiStorageWriteFruData(ipmi_netfn_t /*netfn*/, ipmi_cmd_t /*cmd*/,
+ ipmi_request_t request, ipmi_response_t response,
+ ipmi_data_len_t dataLen, ipmi_context_t /*context*/)
{
FILE* fp = NULL;
char fruFilename[16] = {0};
diff --git a/writefrudata.cpp b/writefrudata.cpp
index 50fa2d0..44117ae 100644
--- a/writefrudata.cpp
+++ b/writefrudata.cpp
@@ -93,8 +93,9 @@
auto first = fruData.cbegin() + minIndexValue;
auto last = first + (maxIndexValue - minIndexValue) + 1;
- auto itr = std::find_if(first, last,
- [&key](const auto& e) { return key == e.first; });
+ auto itr = std::find_if(first, last, [&key](const auto& e) {
+ return key == e.first;
+ });
if (itr != last)
{
@@ -132,10 +133,10 @@
auto getService(sdbusplus::bus_t& bus, const std::string& intf,
const std::string& path)
{
- auto mapperCall = bus.new_method_call("xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper",
- "GetObject");
+ auto mapperCall =
+ bus.new_method_call("xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetObject");
mapperCall.append(path);
mapperCall.append(std::vector<std::string>({intf}));
@@ -539,10 +540,10 @@
return rc;
}
- auto fruDataView = std::span<uint8_t>(&fruData[areaOffset],
- areaLen);
- auto areaData = std::vector<uint8_t>(fruDataView.begin(),
- fruDataView.end());
+ auto fruDataView =
+ std::span<uint8_t>(&fruData[areaOffset], areaLen);
+ auto areaData =
+ std::vector<uint8_t>(fruDataView.begin(), fruDataView.end());
// Validate the CRC, but not for the internal use area, since its
// contents beyond the first byte are not defined in the spec and
@@ -581,7 +582,7 @@
}
}
} // If we have FRU data present
- } // Walk struct common_header
+ } // Walk struct common_header
// Not all the fields will be populated in a FRU data. Mostly all cases will
// not have more than 2 or 3.