clang-format: copy latest and re-format

clang-format-17 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: Ib8dfa202f1d59add43fc0d55ab2bf388c8e7c877
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d92a3f1..d43e884 100644
--- a/.clang-format
+++ b/.clang-format
@@ -14,26 +14,30 @@
 AllowShortBlocksOnASingleLine: Empty
 AllowShortCaseLabelsOnASingleLine: false
 AllowShortFunctionsOnASingleLine: Empty
-AllowShortIfStatementsOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: true
 AllowShortLoopsOnASingleLine: false
 AlwaysBreakAfterReturnType: None
 AlwaysBreakBeforeMultilineStrings: false
 AlwaysBreakTemplateDeclarations: Yes
 BinPackArguments: true
 BinPackParameters: true
+BitFieldColonSpacing: None
 BraceWrapping:
   AfterCaseLabel:  true
   AfterClass:      true
   AfterControlStatement: true
   AfterEnum:       true
+  AfterExternBlock: true
   AfterFunction:   true
   AfterNamespace:  true
   AfterObjCDeclaration: true
   AfterStruct:     true
   AfterUnion:      true
-  AfterExternBlock: true
   BeforeCatch:     true
   BeforeElse:      true
+  BeforeLambdaBody: false
+  BeforeWhile:     false
   IndentBraces:    false
   SplitEmptyFunction:   false
   SplitEmptyRecord:     false
@@ -48,17 +52,16 @@
 ColumnLimit:     80
 CommentPragmas:  '^ IWYU pragma:'
 CompactNamespaces: false
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
 ConstructorInitializerIndentWidth: 4
 ContinuationIndentWidth: 4
 Cpp11BracedListStyle: true
-DeriveLineEnding: false
 DerivePointerAlignment: false
-PointerAlignment: Left
 DisableFormat:   false
-ExperimentalAutoDetectBinPacking: false
 FixNamespaceComments: true
-ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
+ForEachMacros:
+  - foreach
+  - Q_FOREACH
+  - BOOST_FOREACH
 IncludeBlocks: Regroup
 IncludeCategories:
   - Regex:           '^[<"](gtest|gmock)'
@@ -78,6 +81,7 @@
   - Regex:           '.*'
     Priority:        6
 IndentCaseLabels: true
+IndentExternBlock: NoIndent
 IndentRequiresClause: true
 IndentWidth:     4
 IndentWrappedFunctionNames: true
@@ -92,6 +96,7 @@
 ObjCBlockIndentWidth: 2
 ObjCSpaceAfterProperty: false
 ObjCSpaceBeforeProtocolList: true
+PackConstructorInitializers: BinPack
 PenaltyBreakAssignment: 25
 PenaltyBreakBeforeFirstCallParameter: 19
 PenaltyBreakComment: 300
@@ -100,12 +105,13 @@
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
 PenaltyIndentedWhitespace: 0
+PointerAlignment: Left
 QualifierAlignment: Left
 ReferenceAlignment: Left
 ReflowComments:  true
 RequiresClausePosition: OwnLine
 RequiresExpressionIndentation: Keyword
-SortIncludes:    true
+SortIncludes: CaseSensitive
 SortUsingDeclarations: true
 SpaceAfterCStyleCast: false
 SpaceAfterTemplateKeyword: true
@@ -117,7 +123,7 @@
 SpaceBeforeRangeBasedForLoopColon: true
 SpaceInEmptyParentheses: false
 SpacesBeforeTrailingComments: 1
-SpacesInAngles:  false
+SpacesInAngles: Never
 SpacesInContainerLiterals: true
 SpacesInCStyleCastParentheses: false
 SpacesInParentheses: false
diff --git a/host-bmc/dbus_to_event_handler.cpp b/host-bmc/dbus_to_event_handler.cpp
index 2b55c6b..55a3b9f 100644
--- a/host-bmc/dbus_to_event_handler.cpp
+++ b/host-bmc/dbus_to_event_handler.cpp
@@ -155,7 +155,7 @@
                     break;
                 }
             }
-            });
+        });
         stateSensorMatchs.emplace_back(std::move(stateSensorMatch));
     }
 }
@@ -167,7 +167,7 @@
         {PLDM_STATE_SENSOR_PDR,
          [this](SensorId sensorId, const DbusObjMaps& dbusMaps) {
         this->sendStateSensorEvent(sensorId, dbusMaps);
-         }}};
+    }}};
 
     pldm_state_sensor_pdr* pdr = nullptr;
     std::unique_ptr<pldm_pdr, decltype(&pldm_pdr_destroy)> sensorPdrRepo(
diff --git a/host-bmc/dbus_to_host_effecters.cpp b/host-bmc/dbus_to_host_effecters.cpp
index b94d36a..31a1838 100644
--- a/host-bmc/dbus_to_host_effecters.cpp
+++ b/host-bmc/dbus_to_host_effecters.cpp
@@ -324,7 +324,7 @@
         msg.read(iface, props);
         processHostEffecterChangeNotification(props, effecterInfoIndex,
                                               dbusInfoIndex, effecterId);
-        }));
+    }));
 }
 
 } // namespace host_effecters
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index 7dbd4e5..99bc13d 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -159,7 +159,7 @@
                 this->mergedHostParents = false;
             }
         }
-        });
+    });
 }
 
 void HostPDRHandler::fetchPDR(PDRRecordHandles&& recordHandles)
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index e4b10c8..aea24a0 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -867,10 +867,9 @@
 
         BIOSStringTable biosStringTable(*stringTable);
         auto attrName = biosStringTable.findString(attrHeader.stringHandle);
-        auto iter = std::find_if(biosAttributes.begin(), biosAttributes.end(),
-                                 [&attrName](const auto& attr) {
-            return attr->name == attrName;
-        });
+        auto iter = std::find_if(
+            biosAttributes.begin(), biosAttributes.end(),
+            [&attrName](const auto& attr) { return attr->name == attrName; });
 
         if (iter == biosAttributes.end())
         {
@@ -1115,7 +1114,7 @@
         PendingAttributes pendingAttributes =
             std::get<PendingAttributes>(valPropMap->second);
         this->constructPendingAttribute(pendingAttributes);
-        });
+    });
 
     biosAttrMatch.emplace_back(std::move(updateBIOSMatch));
 }
diff --git a/libpldmresponder/bios_config.hpp b/libpldmresponder/bios_config.hpp
index d7e4b0c..77a0764 100644
--- a/libpldmresponder/bios_config.hpp
+++ b/libpldmresponder/bios_config.hpp
@@ -212,7 +212,7 @@
                     std::string iface;
                     msg.read(iface, props);
                     processBiosAttrChangeNotification(props, biosAttrIndex);
-                        }));
+                }));
 
                 biosAttrMatch.push_back(
                     std::make_unique<sdbusplus::bus::match_t>(
@@ -230,7 +230,7 @@
                         processBiosAttrChangeNotification(ifaceIt->second,
                                                           biosAttrIndex);
                     }
-                        }));
+                }));
             }
         }
         catch (const std::exception& e)
diff --git a/libpldmresponder/pdr_utils.cpp b/libpldmresponder/pdr_utils.cpp
index 06832a1..acaedd7 100644
--- a/libpldmresponder/pdr_utils.cpp
+++ b/libpldmresponder/pdr_utils.cpp
@@ -174,8 +174,8 @@
             reinterpret_cast<const state_sensor_possible_states*>(statesPtr);
         PossibleStates possibleStates{};
         uint8_t possibleStatesPos{};
-        auto updateStates =
-            [&possibleStates, &possibleStatesPos](const bitfield8_t& val) {
+        auto updateStates = [&possibleStates,
+                             &possibleStatesPos](const bitfield8_t& val) {
             for (int i = 0; i < CHAR_BIT; i++)
             {
                 if (val.byte & (1 << i))
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index ad8948c..5f71252 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -75,26 +75,26 @@
     // generate the PDR structures. This function iterates through the map to
     // invoke all lambdas, so that all PDR types can be created.
 
-    const std::map<Type, generatePDR>
-        generateHandlers = {{PLDM_STATE_EFFECTER_PDR,
-                             [this](const DBusHandler& dBusIntf,
-                                    const auto& json, RepoInterface& repo) {
+    const std::map<Type, generatePDR> generateHandlers = {
+        {PLDM_STATE_EFFECTER_PDR,
+         [this](const DBusHandler& dBusIntf, const auto& json,
+                RepoInterface& repo) {
         pdr_state_effecter::generateStateEffecterPDR<pldm::utils::DBusHandler,
                                                      Handler>(dBusIntf, json,
                                                               *this, repo);
-                             }},
-                            {PLDM_NUMERIC_EFFECTER_PDR,
-                             [this](const DBusHandler& dBusIntf,
-                                    const auto& json, RepoInterface& repo) {
+    }},
+        {PLDM_NUMERIC_EFFECTER_PDR,
+         [this](const DBusHandler& dBusIntf, const auto& json,
+                RepoInterface& repo) {
         pdr_numeric_effecter::generateNumericEffecterPDR<
             pldm::utils::DBusHandler, Handler>(dBusIntf, json, *this, repo);
-                             }},
+    }},
         {PLDM_STATE_SENSOR_PDR, [this](const DBusHandler& dBusIntf,
                                        const auto& json, RepoInterface& repo) {
-             pdr_state_sensor::generateStateSensorPDR<pldm::utils::DBusHandler,
-                                                      Handler>(dBusIntf, json,
-                                                               *this, repo);
-         }}};
+        pdr_state_sensor::generateStateSensorPDR<pldm::utils::DBusHandler,
+                                                 Handler>(dBusIntf, json, *this,
+                                                          repo);
+    }}};
 
     Type pdrType{};
     for (const auto& dirEntry : fs::directory_iterator(dir))
diff --git a/oem/ibm/libpldmresponder/file_io.hpp b/oem/ibm/libpldmresponder/file_io.hpp
index cd5c54b..67742af 100644
--- a/oem/ibm/libpldmresponder/file_io.hpp
+++ b/oem/ibm/libpldmresponder/file_io.hpp
@@ -262,7 +262,7 @@
                     break;
                 }
             }
-            });
+        });
         vmiCertMatcher = std::make_unique<sdbusplus::bus::match_t>(
             pldm::utils::DBusHandler::getBus(),
             sdbusplus::bus::match::rules::interfacesAdded() +
@@ -302,7 +302,7 @@
                     break;
                 }
             }
-            });
+        });
     }
 
     /** @brief Handler for readFileIntoMemory command
diff --git a/oem/ibm/libpldmresponder/inband_code_update.cpp b/oem/ibm/libpldmresponder/inband_code_update.cpp
index e4fed04..e4ab130 100644
--- a/oem/ibm/libpldmresponder/inband_code_update.cpp
+++ b/oem/ibm/libpldmresponder/inband_code_update.cpp
@@ -208,7 +208,7 @@
         std::string iface;
         msg.read(iface, props);
         processPriorityChangeNotification(props);
-            }));
+    }));
     fwUpdateMatcher.push_back(std::make_unique<sdbusplus::bus::match_t>(
         pldm::utils::DBusHandler::getBus(),
         "interface='org.freedesktop.DBus.ObjectManager',type='signal',"
@@ -288,7 +288,7 @@
                                         newImageId.clear();
                                     }
                                 }
-                                    });
+                            });
                         }
                         auto rc = setRequestedActivation();
                         if (rc != PLDM_SUCCESS)
@@ -314,7 +314,7 @@
                 }
             }
         }
-        }));
+    }));
 }
 
 void CodeUpdate::processPriorityChangeNotification(
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index db248a2..3c877d8 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -487,7 +487,7 @@
                 }
             }
         }
-        });
+    });
 }
 
 void pldm::responder::oem_ibm_platform::Handler::checkAndDisableWatchDog()
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
index 520d060..964534e 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
@@ -68,7 +68,7 @@
                     hostOff = false;
                 }
             }
-            });
+        });
     }
 
     int getOemStateSensorReadingsHandler(
diff --git a/pldmtool/pldm_base_cmd.cpp b/pldmtool/pldm_base_cmd.cpp
index c755b31..0b13ebe 100644
--- a/pldmtool/pldm_base_cmd.cpp
+++ b/pldmtool/pldm_base_cmd.cpp
@@ -127,10 +127,9 @@
             bitfield8_t b = types[i / 8];
             if (b.byte & (1 << i % 8))
             {
-                auto it = std::find_if(pldmTypes.begin(), pldmTypes.end(),
-                                       [i](const auto& typePair) {
-                    return typePair.second == i;
-                });
+                auto it = std::find_if(
+                    pldmTypes.begin(), pldmTypes.end(),
+                    [i](const auto& typePair) { return typePair.second == i; });
                 if (it != pldmTypes.end())
                 {
                     jarray["PLDM Type"] = it->first;
@@ -188,10 +187,9 @@
         char buffer[16] = {0};
         ver2str(&version, buffer, sizeof(buffer));
         ordered_json data;
-        auto it = std::find_if(pldmTypes.begin(), pldmTypes.end(),
-                               [&](const auto& typePair) {
-            return typePair.second == pldmType;
-        });
+        auto it = std::find_if(
+            pldmTypes.begin(), pldmTypes.end(),
+            [&](const auto& typePair) { return typePair.second == pldmType; });
 
         if (it != pldmTypes.end())
         {
@@ -293,10 +291,9 @@
     template <typename CommandMap>
     void printCommand(CommandMap& commandMap, int i, ordered_json& jarray)
     {
-        auto it = std::find_if(commandMap.begin(), commandMap.end(),
-                               [i](const auto& typePair) {
-            return typePair.second == i;
-        });
+        auto it = std::find_if(
+            commandMap.begin(), commandMap.end(),
+            [i](const auto& typePair) { return typePair.second == i; });
         if (it != commandMap.end())
         {
             jarray["PLDM Command Code"] = i;
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index 3135b3d..469c325 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -319,8 +319,8 @@
     }
 
     // Add a timer to the event loop, default 30s.
-    auto timerCallback =
-        [=, this](Timer& /*source*/, Timer::TimePoint /*time*/) mutable {
+    auto timerCallback = [=, this](Timer& /*source*/,
+                                   Timer::TimePoint /*time*/) mutable {
         if (!responseReceived)
         {
             instanceIdDb.free(pldmTID, instanceID);
@@ -334,8 +334,8 @@
                std::chrono::seconds{1}, std::move(timerCallback));
 
     // Add a callback to handle EPOLLIN on fd
-    auto callback =
-        [=, &pldmTransport, this](IO& io, int fd, uint32_t revents) mutable {
+    auto callback = [=, &pldmTransport, this](IO& io, int fd,
+                                              uint32_t revents) mutable {
         if (fd != pldmTransport.getEventSource())
         {
             return;
diff --git a/utilities/requester/set_state_effecter_async.cpp b/utilities/requester/set_state_effecter_async.cpp
index bf905e3..ebaa524 100644
--- a/utilities/requester/set_state_effecter_async.cpp
+++ b/utilities/requester/set_state_effecter_async.cpp
@@ -49,8 +49,8 @@
 
     // Create event loop and add a callback to handle EPOLLIN on fd
     auto event = Event::get_default();
-    auto callback =
-        [=, &pldmTransport](IO& io, int fd, uint32_t revents) mutable {
+    auto callback = [=, &pldmTransport](IO& io, int fd,
+                                        uint32_t revents) mutable {
         if (!(revents & EPOLLIN))
         {
             return;