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: I66785e0aa71a93f9370db0168049cd62c1f69728
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 52ac0a1..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,12 +38,13 @@
   SplitEmptyFunction:   false
   SplitEmptyRecord:     false
   SplitEmptyNamespace:  false
+BreakAfterAttributes: Never
 BreakBeforeBinaryOperators: None
 BreakBeforeBraces: Custom
 BreakBeforeTernaryOperators: true
 BreakConstructorInitializers: AfterColon
 BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
 ColumnLimit:     80
 CommentPragmas:  '^ IWYU pragma:'
 CompactNamespaces: false
@@ -49,6 +52,7 @@
 ConstructorInitializerIndentWidth: 4
 ContinuationIndentWidth: 4
 Cpp11BracedListStyle: true
+DeriveLineEnding: false
 DerivePointerAlignment: false
 PointerAlignment: Left
 DisableFormat:   false
@@ -74,9 +78,13 @@
   - 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
@@ -84,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
diff --git a/ext_interface.cpp b/ext_interface.cpp
index cc3475e..2dec009 100644
--- a/ext_interface.cpp
+++ b/ext_interface.cpp
@@ -31,7 +31,6 @@
 std::string getService(sdbusplus::bus_t& bus, const std::string& intf,
                        const std::string& path)
 {
-
     auto mapper = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
                                       MAPPER_INTERFACE, "GetObject");
 
@@ -62,8 +61,8 @@
 {
     auto bus = sdbusplus::bus::new_default();
 
-    auto rebootSvc =
-        getService(bus, REBOOTCOUNTER_INTERFACE, REBOOTCOUNTER_PATH);
+    auto rebootSvc = getService(bus, REBOOTCOUNTER_INTERFACE,
+                                REBOOTCOUNTER_PATH);
 
     auto method = bus.new_method_call(rebootSvc.c_str(), REBOOTCOUNTER_PATH,
                                       "org.freedesktop.DBus.Properties", "Get");
diff --git a/extensions/phal/clock_logger.cpp b/extensions/phal/clock_logger.cpp
index 6376988..1afdcf5 100644
--- a/extensions/phal/clock_logger.cpp
+++ b/extensions/phal/clock_logger.cpp
@@ -165,7 +165,6 @@
 void Manager::addCFAMData(struct pdbg_target* proc,
                           openpower::pel::FFDCData& clockDataLog)
 {
-
     // collect Processor CFAM register data
     const std::vector<int> procCFAMAddr = {
         0x1007, 0x2804, 0x2810, 0x2813, 0x2814, 0x2815, 0x2816, 0x281D, 0x281E};
diff --git a/extensions/phal/create_pel.cpp b/extensions/phal/create_pel.cpp
index c834419..95ee7ae 100644
--- a/extensions/phal/create_pel.cpp
+++ b/extensions/phal/create_pel.cpp
@@ -104,11 +104,11 @@
                             static_cast<uint8_t>(0xCA),
                             static_cast<uint8_t>(0x01), ffdcFile.getFileFD()));
 
-        std::string service =
-            util::getService(bus, loggingObjectPath, loggingInterface);
-        auto method =
-            bus.new_method_call(service.c_str(), loggingObjectPath,
-                                loggingInterface, "CreateWithFFDCFiles");
+        std::string service = util::getService(bus, loggingObjectPath,
+                                               loggingInterface);
+        auto method = bus.new_method_call(service.c_str(), loggingObjectPath,
+                                          loggingInterface,
+                                          "CreateWithFFDCFiles");
         auto level =
             sdbusplus::xyz::openbmc_project::Logging::server::convertForMessage(
                 severity);
@@ -204,11 +204,11 @@
 
     try
     {
-        std::string service =
-            util::getService(bus, loggingObjectPath, opLoggingInterface);
-        auto method =
-            bus.new_method_call(service.c_str(), loggingObjectPath,
-                                opLoggingInterface, "CreatePELWithFFDCFiles");
+        std::string service = util::getService(bus, loggingObjectPath,
+                                               opLoggingInterface);
+        auto method = bus.new_method_call(service.c_str(), loggingObjectPath,
+                                          opLoggingInterface,
+                                          "CreatePELWithFFDCFiles");
         auto level =
             sdbusplus::xyz::openbmc_project::Logging::server::convertForMessage(
                 severity);
@@ -253,8 +253,8 @@
 
     try
     {
-        std::string service =
-            util::getService(bus, loggingObjectPath, loggingInterface);
+        std::string service = util::getService(bus, loggingObjectPath,
+                                               loggingInterface);
         auto method = bus.new_method_call(service.c_str(), loggingObjectPath,
                                           loggingInterface, "Create");
         auto level =
diff --git a/extensions/phal/dump_utils.cpp b/extensions/phal/dump_utils.cpp
index 11051ae..61bdd92 100644
--- a/extensions/phal/dump_utils.cpp
+++ b/extensions/phal/dump_utils.cpp
@@ -73,7 +73,7 @@
             sdbusplus::bus::match::rules::propertiesChanged(
                 path.c_str(), matchInterface.c_str()),
             [&](auto& msg) {
-                return dumpStatusChanged(msg, path, inProgress);
+        return dumpStatusChanged(msg, path, inProgress);
             });
 
     // wait for dump status to be completed (complete == true)
@@ -115,8 +115,8 @@
     try
     {
         std::string service = util::getService(bus, path, interface);
-        auto method =
-            bus.new_method_call(service.c_str(), path, interface, function);
+        auto method = bus.new_method_call(service.c_str(), path, interface,
+                                          function);
 
         // dbus call arguments
         std::map<std::string, std::variant<std::string, uint64_t>> createParams;
diff --git a/extensions/phal/pdbg_utils.cpp b/extensions/phal/pdbg_utils.cpp
index 7dfc5cb..db62522 100644
--- a/extensions/phal/pdbg_utils.cpp
+++ b/extensions/phal/pdbg_utils.cpp
@@ -21,7 +21,6 @@
 
 pdbg_target* getFsiTarget(struct pdbg_target* procTarget)
 {
-
     struct pdbg_target* fsiTarget = nullptr;
     pdbg_for_each_target("fsi", procTarget, fsiTarget)
     {
@@ -68,7 +67,6 @@
 uint32_t getCFAM(struct pdbg_target* procTarget, const uint32_t reg,
                  uint32_t& val)
 {
-
     pdbg_target* fsiTarget = getFsiTarget(procTarget);
     if (nullptr == fsiTarget)
     {
diff --git a/extensions/phal/phal_error.cpp b/extensions/phal/phal_error.cpp
index b01985f..81ef6be 100644
--- a/extensions/phal/phal_error.cpp
+++ b/extensions/phal/phal_error.cpp
@@ -389,8 +389,8 @@
                      json jsonCalloutData;
                      std::string pelPriority = "L";
                      jsonCalloutData["Priority"] = pelPriority; // Not used
-                     jsonCalloutData["SymbolicFRU"] =
-                         "REFCLK" + std::to_string(clk_pos);
+                     jsonCalloutData["SymbolicFRU"] = "REFCLK" +
+                                                      std::to_string(clk_pos);
                      jsonCalloutData["Deconfigured"] = cdg_tgt.deconfigure;
                      jsonCalloutData["EntityPath"] = cdg_tgt.target_entity_path;
                      jsonCalloutDataList.emplace_back(jsonCalloutData);
@@ -928,8 +928,8 @@
     uint32_t index = pdbg_target_index(procTarget);
     pelAdditionalData.emplace_back("SRC6", std::to_string(index << 16));
     // Create SBE Error with FFDC data.
-    auto logId =
-        createSbeErrorPEL(event, sbeError, pelAdditionalData, procTarget);
+    auto logId = createSbeErrorPEL(event, sbeError, pelAdditionalData,
+                                   procTarget);
 
     if (dumpIsRequired)
     {
diff --git a/nmi_main.cpp b/nmi_main.cpp
index ccf7d3c..d470c2a 100644
--- a/nmi_main.cpp
+++ b/nmi_main.cpp
@@ -22,7 +22,6 @@
 
 int main(int, char*[])
 {
-
     constexpr auto BUSPATH_NMI = "/xyz/openbmc_project/control/host0/nmi";
     constexpr auto BUSNAME_NMI = "xyz.openbmc_project.Control.Host.NMI";
     auto bus = sdbusplus::bus::new_default();
diff --git a/procedures/common/cfam_reset.cpp b/procedures/common/cfam_reset.cpp
index 5427381..4de7dff 100644
--- a/procedures/common/cfam_reset.cpp
+++ b/procedures/common/cfam_reset.cpp
@@ -24,7 +24,6 @@
  */
 void cfamReset()
 {
-
     // First look if system supports kernel sysfs based cfam reset
     // If it does then write a 1 and let the kernel handle the reset
     std::ofstream file;
diff --git a/procedures/phal/reinit_devtree.cpp b/procedures/phal/reinit_devtree.cpp
index c5ae058..29b85c0 100644
--- a/procedures/phal/reinit_devtree.cpp
+++ b/procedures/phal/reinit_devtree.cpp
@@ -155,9 +155,9 @@
             }
 
             // Step 1: export devtree data based on the reinit attribute list.
-            auto ret =
-                dtree_cronus_export(CEC_DEVTREE_RW_PATH, CEC_INFODB_PATH,
-                                    DEVTREE_REINIT_ATTRS_LIST, fpExport.get());
+            auto ret = dtree_cronus_export(CEC_DEVTREE_RW_PATH, CEC_INFODB_PATH,
+                                           DEVTREE_REINIT_ATTRS_LIST,
+                                           fpExport.get());
             if (ret)
             {
                 log<level::ERR>(
diff --git a/procedures/phal/start_host.cpp b/procedures/phal/start_host.cpp
index 2be25f4..c0c0fd6 100644
--- a/procedures/phal/start_host.cpp
+++ b/procedures/phal/start_host.cpp
@@ -157,7 +157,6 @@
     struct pdbg_target* procTarget;
     pdbg_for_each_class_target("proc", procTarget)
     {
-
         if (DT_SET_PROP(ATTR_SYS_CLK_NE_TERMINATION_SITE, procTarget,
                         clockTerm))
         {
diff --git a/targeting.hpp b/targeting.hpp
index 466cb7e..2f025ec 100644
--- a/targeting.hpp
+++ b/targeting.hpp
@@ -90,8 +90,7 @@
      */
     Targeting(const std::string& fsiMasterDev, const std::string& fsiSlaveDir);
 
-    Targeting() : Targeting(fsiMasterDevPath, fsiSlaveBaseDir)
-    {}
+    Targeting() : Targeting(fsiMasterDevPath, fsiSlaveBaseDir) {}
 
     ~Targeting() = default;
     Targeting(const Targeting&) = default;
diff --git a/temporary_file.cpp b/temporary_file.cpp
index 34a18ca..885b5ff 100644
--- a/temporary_file.cpp
+++ b/temporary_file.cpp
@@ -17,8 +17,8 @@
 TemporaryFile::TemporaryFile()
 {
     // Build template path required by mkstemp()
-    std::string templatePath =
-        fs::temp_directory_path() / "openpower-proc-control-XXXXXX";
+    std::string templatePath = fs::temp_directory_path() /
+                               "openpower-proc-control-XXXXXX";
 
     // Generate unique file name, create file, and open it.  The XXXXXX
     // characters are replaced by mkstemp() to make the file name unique.
diff --git a/test/utest.cpp b/test/utest.cpp
index 81aae58..cf41224 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -58,7 +58,6 @@
 
 TEST_F(TargetingTest, CreateTargets)
 {
-
     // Test that we always create the first Target
     {
         Targeting targets{masterDir, _slaveDir};