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: I08b5be09aa8fdf8a9f2c814f2f84f6ddbb345bd3
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index ce06cfd..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
@@ -108,7 +122,8 @@
 SpacesInCStyleCastParentheses: false
 SpacesInParentheses: false
 SpacesInSquareBrackets: false
-Standard:        Cpp11
+Standard:        Latest
 TabWidth:        4
 UseTab:          Never
 ...
+
diff --git a/include/pciDeviceClass.hpp b/include/pciDeviceClass.hpp
index 3c08f65..24e0db5 100644
--- a/include/pciDeviceClass.hpp
+++ b/include/pciDeviceClass.hpp
@@ -19,8 +19,8 @@
 
 #include <string>
 
-static constexpr char const* coprocessorSubClass = "Coprocessor";
-static constexpr char const* otherClass = "Other";
+static constexpr const char* coprocessorSubClass = "Coprocessor";
+static constexpr const char* otherClass = "Other";
 
 static boost::container::flat_map<int, std::string> pciDeviceClasses{
     {0x00, "UnclassifiedDevice"},
diff --git a/include/pciVendors.hpp b/include/pciVendors.hpp
index 0354f8d..2c56fbd 100644
--- a/include/pciVendors.hpp
+++ b/include/pciVendors.hpp
@@ -17,7 +17,7 @@
 #pragma once
 #include <boost/container/flat_map.hpp>
 
-static constexpr char const* otherVendor = "Other";
+static constexpr const char* otherVendor = "Other";
 
 // This list of Vendors is extracted from the PCI-SIG member-companies page
 // ('https://pcisig.com/membership/member-companies') using
diff --git a/include/peci_pcie.hpp b/include/peci_pcie.hpp
index 19c8d9c..9053392 100644
--- a/include/peci_pcie.hpp
+++ b/include/peci_pcie.hpp
@@ -22,10 +22,10 @@
 
 namespace peci_pcie
 {
-static constexpr char const* peciPCIeObject = "xyz.openbmc_project.PCIe";
-static constexpr char const* peciPCIePath =
+static constexpr const char* peciPCIeObject = "xyz.openbmc_project.PCIe";
+static constexpr const char* peciPCIePath =
     "/xyz/openbmc_project/inventory/pcie";
-static constexpr char const* peciPCIeDeviceInterface =
+static constexpr const char* peciPCIeDeviceInterface =
     "xyz.openbmc_project.Inventory.Item.PCIeDevice";
 
 static constexpr const int maxPCIBuses = 256;
diff --git a/src/peci_pcie.cpp b/src/peci_pcie.cpp
index 2538ab4..73b0001 100644
--- a/src/peci_pcie.cpp
+++ b/src/peci_pcie.cpp
@@ -47,14 +47,14 @@
 
 namespace function
 {
-static constexpr char const* functionTypeName = "FunctionType";
-static constexpr char const* deviceClassName = "DeviceClass";
-static constexpr char const* vendorIdName = "VendorId";
-static constexpr char const* deviceIdName = "DeviceId";
-static constexpr char const* classCodeName = "ClassCode";
-static constexpr char const* revisionIdName = "RevisionId";
-static constexpr char const* subsystemIdName = "SubsystemId";
-static constexpr char const* subsystemVendorIdName = "SubsystemVendorId";
+static constexpr const char* functionTypeName = "FunctionType";
+static constexpr const char* deviceClassName = "DeviceClass";
+static constexpr const char* vendorIdName = "VendorId";
+static constexpr const char* deviceIdName = "DeviceId";
+static constexpr const char* classCodeName = "ClassCode";
+static constexpr const char* revisionIdName = "RevisionId";
+static constexpr const char* subsystemIdName = "SubsystemId";
+static constexpr const char* subsystemVendorIdName = "SubsystemVendorId";
 } // namespace function
 
 static constexpr const std::array pciConfigInfo{
@@ -529,7 +529,7 @@
     setPCIeProperty(clientAddr, bus, dev, "Manufacturer", manuf);
 
     // Set the device type
-    constexpr char const* deviceTypeName = "DeviceType";
+    constexpr const char* deviceTypeName = "DeviceType";
     bool multiFunc;
     error = isMultiFunction(clientAddr, bus, dev, multiFunc);
     if (error != resCode::resOk)
@@ -546,7 +546,7 @@
     }
 
     // Set PCIe Generation
-    constexpr char const* generationInUseName = "GenerationInUse";
+    constexpr const char* generationInUseName = "GenerationInUse";
     std::string generationInUse;
     error = getGenerationInUse(clientAddr, bus, dev, generationInUse);
     if (error == resCode::resErr)
@@ -875,18 +875,18 @@
 
     osStandbyTimer.async_wait(
         [&io, &objServer, &cpuInfo](const boost::system::error_code& ec) {
-            if (ec == boost::asio::error::operation_aborted)
-            {
-                return; // we're being canceled
-            }
-            else if (ec)
-            {
-                std::cerr << "OS Standby async_wait failed: " << ec.value()
-                          << ": " << ec.message() << "\n";
-                return;
-            }
-            startPCIeScan(io, objServer, cpuInfo);
-        });
+        if (ec == boost::asio::error::operation_aborted)
+        {
+            return; // we're being canceled
+        }
+        else if (ec)
+        {
+            std::cerr << "OS Standby async_wait failed: " << ec.value() << ": "
+                      << ec.message() << "\n";
+            return;
+        }
+        startPCIeScan(io, objServer, cpuInfo);
+    });
 }
 
 static void monitorOSStandby(boost::asio::io_context& io,
@@ -904,42 +904,41 @@
         "Status'",
         [&io, &objServer, &osStandbyTimer,
          &cpuInfo](sdbusplus::message_t& msg) {
-            // Get the OS State from the message
-            std::string osStateInterface;
-            boost::container::flat_map<std::string, std::variant<std::string>>
-                propertiesChanged;
-            msg.read(osStateInterface, propertiesChanged);
+        // Get the OS State from the message
+        std::string osStateInterface;
+        boost::container::flat_map<std::string, std::variant<std::string>>
+            propertiesChanged;
+        msg.read(osStateInterface, propertiesChanged);
 
-            for (const auto& [name, value] : propertiesChanged)
+        for (const auto& [name, value] : propertiesChanged)
+        {
+            if (name == "OperatingSystemState")
             {
-                if (name == "OperatingSystemState")
+                const std::string* state = std::get_if<std::string>(&value);
+                if (state == nullptr)
                 {
-                    const std::string* state = std::get_if<std::string>(&value);
-                    if (state == nullptr)
-                    {
-                        std::cerr << "Unable to read OS state value\n";
-                        return;
-                    }
-                    // Note: Short version of OperatingSystemState value is
-                    // deprecated and would be removed in the future
-                    if ((*state == "Standby") ||
-                        (*state == "xyz.openbmc_project.State.OperatingSystem."
-                                   "Status.OSStatus.Standby"))
-                    {
-                        peci_pcie::abortScan = false;
-                        waitForOSStandbyDelay(io, objServer, osStandbyTimer,
-                                              cpuInfo);
-                    }
-                    else if ((*state == "Inactive") ||
-                             (*state ==
-                              "xyz.openbmc_project.State.OperatingSystem."
-                              "Status.OSStatus.Inactive"))
-                    {
-                        peci_pcie::abortScan = true;
-                        osStandbyTimer.cancel();
-                    }
+                    std::cerr << "Unable to read OS state value\n";
+                    return;
+                }
+                // Note: Short version of OperatingSystemState value is
+                // deprecated and would be removed in the future
+                if ((*state == "Standby") ||
+                    (*state == "xyz.openbmc_project.State.OperatingSystem."
+                               "Status.OSStatus.Standby"))
+                {
+                    peci_pcie::abortScan = false;
+                    waitForOSStandbyDelay(io, objServer, osStandbyTimer,
+                                          cpuInfo);
+                }
+                else if ((*state == "Inactive") ||
+                         (*state == "xyz.openbmc_project.State.OperatingSystem."
+                                    "Status.OSStatus.Inactive"))
+                {
+                    peci_pcie::abortScan = true;
+                    osStandbyTimer.cancel();
                 }
             }
+        }
         });
 
     // Check if the OS state is already available
@@ -947,30 +946,30 @@
         [&io, &objServer, &osStandbyTimer,
          &cpuInfo](boost::system::error_code ec,
                    const std::variant<std::string>& property) {
-            if (ec)
-            {
-                std::cerr << "error with OS state async_method_call\n";
-                return;
-            }
+        if (ec)
+        {
+            std::cerr << "error with OS state async_method_call\n";
+            return;
+        }
 
-            const std::string* state = std::get_if<std::string>(&property);
-            if (state == nullptr)
-            {
-                std::cerr << "Unable to read OS state value\n";
-                return;
-            }
+        const std::string* state = std::get_if<std::string>(&property);
+        if (state == nullptr)
+        {
+            std::cerr << "Unable to read OS state value\n";
+            return;
+        }
 
-            // If the OS state is in Standby, then BIOS is done and we can
-            // continue.  Otherwise, we just wait for the match
-            // Note: Short version of OperatingSystemState value is deprecated
-            // and would be removed in the future
+        // If the OS state is in Standby, then BIOS is done and we can
+        // continue.  Otherwise, we just wait for the match
+        // Note: Short version of OperatingSystemState value is deprecated
+        // and would be removed in the future
 
-            if ((*state == "Standby") ||
-                (*state == "xyz.openbmc_project.State.OperatingSystem.Status."
-                           "OSStatus.Standby"))
-            {
-                waitForOSStandbyDelay(io, objServer, osStandbyTimer, cpuInfo);
-            }
+        if ((*state == "Standby") ||
+            (*state == "xyz.openbmc_project.State.OperatingSystem.Status."
+                       "OSStatus.Standby"))
+        {
+            waitForOSStandbyDelay(io, objServer, osStandbyTimer, cpuInfo);
+        }
         },
         "xyz.openbmc_project.State.OperatingSystem",
         "/xyz/openbmc_project/state/os", "org.freedesktop.DBus.Properties",