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: I59041b73cc8b15c2a3800911540e1a10011f6150
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index ea71ad6..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,22 +5,24 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
-AlignOperands: true
-AlignTrailingComments: true
+AlignEscapedNewlines: Right
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: true
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
@@ -29,19 +31,28 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
+DeriveLineEnding: false
DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
@@ -51,21 +62,29 @@
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](gtest|gmock)'
- Priority: 5
+ Priority: 7
- Regex: '^"config.h"'
Priority: -1
- - Regex: '^".*\.hpp"'
+ - Regex: '^".*\.h"'
Priority: 1
- - Regex: '^<.*\.h>'
+ - Regex: '^".*\.hpp"'
Priority: 2
- - Regex: '^<.*'
+ - Regex: '^<.*\.h>'
Priority: 3
- - Regex: '.*'
+ - Regex: '^<.*\.hpp>'
Priority: 4
+ - Regex: '^<.*'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
IndentCaseLabels: true
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -73,18 +92,29 @@
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
+SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
@@ -92,7 +122,7 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
diff --git a/fru_area.cpp b/fru_area.cpp
index 97ac3bd..a5abf00 100644
--- a/fru_area.cpp
+++ b/fru_area.cpp
@@ -2,9 +2,10 @@
#include "frup.hpp"
+#include <phosphor-logging/log.hpp>
+
#include <cstdint>
#include <cstring>
-#include <phosphor-logging/log.hpp>
using namespace phosphor::logging;
diff --git a/frup.cpp b/frup.cpp
index 9ddb0f6..dddeee4 100644
--- a/frup.cpp
+++ b/frup.cpp
@@ -127,33 +127,33 @@
/* OPENBMC_VPD_KEY_BOARD_MFG_DATE, */ /* not a type/len */
"Manufacturer", /* OPENBMC_VPD_KEY_BOARD_MFR, */
"Name", /* OPENBMC_VPD_KEY_BOARD_NAME, */
- "Serial Number", /* OPENBMC_VPD_KEY_BOARD_SERIAL_NUM, */
- "Part Number", /* OPENBMC_VPD_KEY_BOARD_PART_NUM, */
- "FRU File ID", /* OPENBMC_VPD_KEY_BOARD_FRU_FILE_ID, */
- "Custom Field 1", /*OPENBMC_VPD_KEY_BOARD_CUSTOM1,*/
- "Custom Field 2", /*OPENBMC_VPD_KEY_BOARD_CUSTOM2,*/
- "Custom Field 3", /*OPENBMC_VPD_KEY_BOARD_CUSTOM3,*/
- "Custom Field 4", /*OPENBMC_VPD_KEY_BOARD_CUSTOM4,*/
- "Custom Field 5", /*OPENBMC_VPD_KEY_BOARD_CUSTOM5,*/
- "Custom Field 6", /*OPENBMC_VPD_KEY_BOARD_CUSTOM6,*/
- "Custom Field 7", /*OPENBMC_VPD_KEY_BOARD_CUSTOM7,*/
- "Custom Field 8", /*OPENBMC_VPD_KEY_BOARD_CUSTOM8,*/
+ "Serial Number", /* OPENBMC_VPD_KEY_BOARD_SERIAL_NUM, */
+ "Part Number", /* OPENBMC_VPD_KEY_BOARD_PART_NUM, */
+ "FRU File ID", /* OPENBMC_VPD_KEY_BOARD_FRU_FILE_ID, */
+ "Custom Field 1", /*OPENBMC_VPD_KEY_BOARD_CUSTOM1,*/
+ "Custom Field 2", /*OPENBMC_VPD_KEY_BOARD_CUSTOM2,*/
+ "Custom Field 3", /*OPENBMC_VPD_KEY_BOARD_CUSTOM3,*/
+ "Custom Field 4", /*OPENBMC_VPD_KEY_BOARD_CUSTOM4,*/
+ "Custom Field 5", /*OPENBMC_VPD_KEY_BOARD_CUSTOM5,*/
+ "Custom Field 6", /*OPENBMC_VPD_KEY_BOARD_CUSTOM6,*/
+ "Custom Field 7", /*OPENBMC_VPD_KEY_BOARD_CUSTOM7,*/
+ "Custom Field 8", /*OPENBMC_VPD_KEY_BOARD_CUSTOM8,*/
- "Manufacturer", /* OPENBMC_VPD_KEY_PRODUCT_MFR, */
- "Name", /* OPENBMC_VPD_KEY_PRODUCT_NAME, */
- "Model Number", /* OPENBMC_VPD_KEY_PRODUCT_PART_MODEL_NUM, */
- "Version", /* OPENBMC_VPD_KEY_PRODUCT_VER, */
- "Serial Number", /* OPENBMC_VPD_KEY_PRODUCT_SERIAL_NUM, */
- "Asset Tag", /* OPENBMC_VPD_KEY_PRODUCT_ASSET_TAG, */
- "FRU File ID", /* OPENBMC_VPD_KEY_PRODUCT_FRU_FILE_ID, */
- "Custom Field 1", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM1,*/
- "Custom Field 2", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM2,*/
- "Custom Field 3", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM3,*/
- "Custom Field 4", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM4,*/
- "Custom Field 5", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM5,*/
- "Custom Field 6", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM6,*/
- "Custom Field 7", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM7,*/
- "Custom Field 8", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM8,*/
+ "Manufacturer", /* OPENBMC_VPD_KEY_PRODUCT_MFR, */
+ "Name", /* OPENBMC_VPD_KEY_PRODUCT_NAME, */
+ "Model Number", /* OPENBMC_VPD_KEY_PRODUCT_PART_MODEL_NUM, */
+ "Version", /* OPENBMC_VPD_KEY_PRODUCT_VER, */
+ "Serial Number", /* OPENBMC_VPD_KEY_PRODUCT_SERIAL_NUM, */
+ "Asset Tag", /* OPENBMC_VPD_KEY_PRODUCT_ASSET_TAG, */
+ "FRU File ID", /* OPENBMC_VPD_KEY_PRODUCT_FRU_FILE_ID, */
+ "Custom Field 1", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM1,*/
+ "Custom Field 2", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM2,*/
+ "Custom Field 3", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM3,*/
+ "Custom Field 4", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM4,*/
+ "Custom Field 5", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM5,*/
+ "Custom Field 6", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM6,*/
+ "Custom Field 7", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM7,*/
+ "Custom Field 8", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM8,*/
"Key Names Table End" /*OPENBMC_VPD_KEY_MAX,*/
};
@@ -214,8 +214,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).
@@ -623,8 +623,8 @@
int type_length = vpd_key_val[0];
int type_code = (type_length & IPMI_FRU_TYPE_LENGTH_TYPE_CODE_MASK) >>
IPMI_FRU_TYPE_LENGTH_TYPE_CODE_SHIFT;
- int vpd_val_len =
- type_length & IPMI_FRU_TYPE_LENGTH_NUMBER_OF_DATA_BYTES_MASK;
+ int vpd_val_len = type_length &
+ IPMI_FRU_TYPE_LENGTH_NUMBER_OF_DATA_BYTES_MASK;
/* Needed to convert each uint8_t byte to a ascii */
char bin_byte[3] = {0};
@@ -668,8 +668,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:
@@ -775,8 +775,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/readeeprom.cpp b/readeeprom.cpp
index 2c74fbd..500d1d8 100644
--- a/readeeprom.cpp
+++ b/readeeprom.cpp
@@ -1,11 +1,12 @@
#include "writefrudata.hpp"
#include <CLI/CLI.hpp>
+#include <phosphor-logging/log.hpp>
+
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <memory>
-#include <phosphor-logging/log.hpp>
using namespace phosphor::logging;
diff --git a/strgfnhandler.cpp b/strgfnhandler.cpp
index e870fd6..ed3cbf4 100644
--- a/strgfnhandler.cpp
+++ b/strgfnhandler.cpp
@@ -3,11 +3,12 @@
#include <ipmid/api.h>
#include <unistd.h>
-#include <cstdio>
-#include <cstring>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
+#include <cstdio>
+#include <cstring>
+
void register_netfn_storage_write_fru() __attribute__((constructor));
sd_bus* ipmid_get_sd_bus_connection(void);
diff --git a/types.hpp b/types.hpp
index 46abfe0..933024f 100644
--- a/types.hpp
+++ b/types.hpp
@@ -1,7 +1,8 @@
#pragma once
-#include <map>
#include <sdbusplus/message.hpp>
+
+#include <map>
#include <string>
#include <variant>
diff --git a/writefrudata.cpp b/writefrudata.cpp
index 5e698c7..1394b38 100644
--- a/writefrudata.cpp
+++ b/writefrudata.cpp
@@ -7,6 +7,9 @@
#include <ipmid/api.h>
#include <unistd.h>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
+
#include <algorithm>
#include <cstdio>
#include <cstring>
@@ -15,8 +18,6 @@
#include <iostream>
#include <map>
#include <memory>
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/bus.hpp>
#include <sstream>
#include <vector>
@@ -67,7 +68,6 @@
std::string getFRUValue(const std::string& section, const std::string& key,
const std::string& delimiter, IPMIFruInfo& fruData)
{
-
auto minIndexValue = 0;
auto maxIndexValue = 0;
std::string fruValue = "";
@@ -130,10 +130,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}));
@@ -717,7 +717,6 @@
// inventory.
if (!(fruAreaVec.empty()))
{
-
#ifdef __IPMI_DEBUG__
std::printf("\n SIZE of vector is : [%d] \n", fruAreaVec.size());
#endif