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: I014bacc34b5a3a7a2a6de6a29b81a3b147eb6ed9
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/src/entity_manager.cpp b/src/entity_manager.cpp
index db1dfb8..6a4580d 100644
--- a/src/entity_manager.cpp
+++ b/src/entity_manager.cpp
@@ -198,7 +198,7 @@
                 return -1;
             }
             return 1;
-            });
+        });
     }
 }
 
@@ -231,7 +231,7 @@
             return -1;
         }
         return 1;
-        });
+    });
 }
 
 void createDeleteObjectMethod(
@@ -466,7 +466,7 @@
             std::visit(
                 [&newJson](auto&& val) {
                 newJson = std::forward<decltype(val)>(val);
-                },
+            },
                 item.second);
         }
 
@@ -558,7 +558,7 @@
             jsonPointerPath + "/Exposes/" + std::to_string(lastIndex),
             interface, newData, objServer,
             sdbusplus::asio::PropertyPermission::readWrite);
-        });
+    });
     iface->initialize();
 }
 
@@ -1113,7 +1113,7 @@
                                     count, std::ref(timer),
                                     std::ref(systemConfiguration),
                                     newConfiguration, std::ref(objServer)));
-            });
+        });
         perfScan->run();
     });
 }
@@ -1263,7 +1263,7 @@
         }
 
         propertiesChangedCallback(systemConfiguration, objServer);
-        });
+    });
     // We also need a poke from DBus when new interfaces are created or
     // destroyed.
     sdbusplus::bus::match_t interfacesAddedMatch(
@@ -1274,7 +1274,7 @@
         {
             propertiesChangedCallback(systemConfiguration, objServer);
         }
-        });
+    });
     sdbusplus::bus::match_t interfacesRemovedMatch(
         static_cast<sdbusplus::bus_t&>(*systemBus),
         sdbusplus::bus::match::rules::interfacesRemoved(),
@@ -1283,7 +1283,7 @@
         {
             propertiesChangedCallback(systemConfiguration, objServer);
         }
-        });
+    });
 
     boost::asio::post(io, [&]() {
         propertiesChangedCallback(systemConfiguration, objServer);
diff --git a/src/fru_device.cpp b/src/fru_device.cpp
index 6644d93..60ab7ef 100644
--- a/src/fru_device.cpp
+++ b/src/fru_device.cpp
@@ -817,7 +817,7 @@
                     }
                 }
                 return 1;
-                });
+            });
         }
         else if (!iface->register_property(key, property.second + '\0'))
         {
@@ -1026,7 +1026,7 @@
                                unknownBusObjectCount, powerIsOn, objServer,
                                systemBus);
         }
-        });
+    });
     scan->run();
 }
 
@@ -1079,34 +1079,34 @@
 
         auto scan = std::make_shared<FindDevicesWithCallback>(
             i2cBuses, busmap, powerIsOn, objServer, [&]() {
-                for (auto& busIface : dbusInterfaceMap)
-                {
-                    objServer.remove_interface(busIface.second);
-                }
+            for (auto& busIface : dbusInterfaceMap)
+            {
+                objServer.remove_interface(busIface.second);
+            }
 
-                dbusInterfaceMap.clear();
-                unknownBusObjectCount = 0;
+            dbusInterfaceMap.clear();
+            unknownBusObjectCount = 0;
 
-                // todo, get this from a more sensable place
-                std::vector<uint8_t> baseboardFRU;
-                if (readBaseboardFRU(baseboardFRU))
+            // todo, get this from a more sensable place
+            std::vector<uint8_t> baseboardFRU;
+            if (readBaseboardFRU(baseboardFRU))
+            {
+                // If no device on i2c bus 0, the insertion will happen.
+                auto bus0 = busmap.try_emplace(0,
+                                               std::make_shared<DeviceMap>());
+                bus0.first->second->emplace(0, baseboardFRU);
+            }
+            for (auto& devicemap : busmap)
+            {
+                for (auto& device : *devicemap.second)
                 {
-                    // If no device on i2c bus 0, the insertion will happen.
-                    auto bus0 =
-                        busmap.try_emplace(0, std::make_shared<DeviceMap>());
-                    bus0.first->second->emplace(0, baseboardFRU);
+                    addFruObjectToDbus(device.second, dbusInterfaceMap,
+                                       devicemap.first, device.first,
+                                       unknownBusObjectCount, powerIsOn,
+                                       objServer, systemBus);
                 }
-                for (auto& devicemap : busmap)
-                {
-                    for (auto& device : *devicemap.second)
-                    {
-                        addFruObjectToDbus(device.second, dbusInterfaceMap,
-                                           devicemap.first, device.first,
-                                           unknownBusObjectCount, powerIsOn,
-                                           objServer, systemBus);
-                    }
-                }
-            });
+            }
+        });
         scan->run();
     });
 }
@@ -1387,9 +1387,8 @@
     // monitor for new i2c devices
     boost::asio::posix::stream_descriptor dirWatch(io, fd);
     std::function<void(const boost::system::error_code, std::size_t)>
-        watchI2cBusses =
-            [&](const boost::system::error_code& ec,
-                std::size_t bytesTransferred) {
+        watchI2cBusses = [&](const boost::system::error_code& ec,
+                             std::size_t bytesTransferred) {
         if (ec)
         {
             std::cout << "Callback Error " << ec << "\n";
diff --git a/src/fru_utils.cpp b/src/fru_utils.cpp
index efae675..ee04ecb 100644
--- a/src/fru_utils.cpp
+++ b/src/fru_utils.cpp
@@ -522,8 +522,9 @@
             {
                 // Strip non null characters from the end
                 value.erase(std::find_if(value.rbegin(), value.rend(),
-                                         [](char ch) { return ch != 0; })
-                                .base(),
+                                         [](char ch) {
+                    return ch != 0;
+                }).base(),
                             value.end());
 
                 result[name] = std::move(value);
diff --git a/src/perform_scan.cpp b/src/perform_scan.cpp
index 2be6477..5e5b715 100644
--- a/src/perform_scan.cpp
+++ b/src/perform_scan.cpp
@@ -76,7 +76,7 @@
         }
 
         scan->dbusProbeObjects[instance.path][instance.interface] = resp;
-        },
+    },
         instance.busName, instance.path, "org.freedesktop.DBus.Properties",
         "GetAll", instance.interface);
 
@@ -191,7 +191,7 @@
         }
 
         processDbusObjects(probeVector, scan, interfaceSubtree);
-        },
+    },
         "xyz.openbmc_project.ObjectMapper",
         "/xyz/openbmc_project/object_mapper",
         "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", maxMapperDepth,
diff --git a/src/utils.cpp b/src/utils.cpp
index 8fbbcd1..c0b3d20 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -166,7 +166,7 @@
             powerStatusOn = boost::ends_with(
                 std::get<std::string>(findState->second), "Running");
         }
-        });
+    });
 
     conn->async_method_call(
         [](boost::system::error_code ec,
@@ -177,7 +177,7 @@
         }
         powerStatusOn = boost::ends_with(std::get<std::string>(state),
                                          "Running");
-        },
+    },
         power::busname, power::path, properties::interface, properties::get,
         power::interface, power::property);
 }