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: Ie54441d565a3b72e24382929becc9101d7611510
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 8c5278e..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,20 +31,30 @@
   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
 ExperimentalAutoDetectBinPacking: false
 FixNamespaceComments: true
@@ -50,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
@@ -72,19 +92,29 @@
 ObjCBlockIndentWidth: 2
 ObjCSpaceAfterProperty: false
 ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
 PenaltyBreakBeforeFirstCallParameter: 19
 PenaltyBreakComment: 300
 PenaltyBreakFirstLessLess: 120
 PenaltyBreakString: 1000
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Left
+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,8 @@
 SpacesInCStyleCastParentheses: false
 SpacesInParentheses: false
 SpacesInSquareBrackets: false
-Standard:        Cpp11
+Standard:        Latest
 TabWidth:        4
 UseTab:          Never
 ...
+
diff --git a/nvme_main.cpp b/nvme_main.cpp
index c9e3a96..b6c9b87 100644
--- a/nvme_main.cpp
+++ b/nvme_main.cpp
@@ -2,17 +2,17 @@
 
 #include <string.h>
 
-#include <fstream>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/sdbus.hpp>
 #include <sdbusplus/server/manager.hpp>
+
+#include <fstream>
 using namespace phosphor::logging;
 
 int main(void)
 {
-
     sdbusplus::bus_t bus = sdbusplus::bus::new_default();
 
     sd_event* event = nullptr;
@@ -40,4 +40,4 @@
     bus.detach_event();
 
     return 0;
-}
\ No newline at end of file
+}
diff --git a/nvme_manager.cpp b/nvme_manager.cpp
index a70a842..d10d1d0 100644
--- a/nvme_manager.cpp
+++ b/nvme_manager.cpp
@@ -1,18 +1,19 @@
 #include "nvme_manager.hpp"
 
+#include "i2c.h"
+
 #include "smbus.hpp"
 
-#include <filesystem>
-#include <map>
 #include <nlohmann/json.hpp>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/message.hpp>
-#include <sstream>
-#include <string>
 #include <xyz/openbmc_project/Led/Physical/server.hpp>
 
-#include "i2c.h"
+#include <filesystem>
+#include <map>
+#include <sstream>
+#include <string>
 #define MONITOR_INTERVAL_SECONDS 1
 #define MAX_SMBUS_ERROR_RETRY 0
 #define NVME_SSD_SLAVE_ADDRESS 0x6a
@@ -185,7 +186,6 @@
                          bool success,
                          const phosphor::nvme::Nvme::NVMeData& nvmeData)
 {
-
     if (success)
     {
         if (!nvmeData.smartWarnings.empty())
@@ -306,8 +306,8 @@
         return nvmeData.present;
     }
 
-    nvmeData.vendor =
-        intToHex(rsp_data_command_8[1]) + " " + intToHex(rsp_data_command_8[2]);
+    nvmeData.vendor = intToHex(rsp_data_command_8[1]) + " " +
+                      intToHex(rsp_data_command_8[2]);
 
     for (auto iter = map_vendor.begin(); iter != map_vendor.end(); iter++)
     {
@@ -406,7 +406,6 @@
 /** @brief Obtain the initial configuration value of NVMe  */
 std::vector<phosphor::nvme::Nvme::NVMeConfig> Nvme::getNvmeConfig()
 {
-
     phosphor::nvme::Nvme::NVMeConfig nvmeConfig;
     std::vector<phosphor::nvme::Nvme::NVMeConfig> nvmeConfigs;
     int8_t criticalHigh = 0;
@@ -422,10 +421,10 @@
         static const std::vector<Json> empty{};
         std::vector<Json> readings = data.value("config", empty);
         std::vector<Json> thresholds = data.value("threshold", empty);
-        monitorIntervalSec =
-            data.value("monitorIntervalSec", MONITOR_INTERVAL_SECONDS);
-        maxSmbusErrorRetry =
-            data.value("maxSmbusErrorRetry", MAX_SMBUS_ERROR_RETRY);
+        monitorIntervalSec = data.value("monitorIntervalSec",
+                                        MONITOR_INTERVAL_SECONDS);
+        maxSmbusErrorRetry = data.value("maxSmbusErrorRetry",
+                                        MAX_SMBUS_ERROR_RETRY);
 
         if (!thresholds.empty())
         {
@@ -647,10 +646,10 @@
         NVMeData nvmeData;
 
         inventoryPath = NVME_INVENTORY_PATH + config.index;
-        devPresentPath =
-            GPIO_BASE_PATH + std::to_string(config.presentPin) + "/value";
-        devPwrGoodPath =
-            GPIO_BASE_PATH + std::to_string(config.pwrGoodPin) + "/value";
+        devPresentPath = GPIO_BASE_PATH + std::to_string(config.presentPin) +
+                         "/value";
+        devPwrGoodPath = GPIO_BASE_PATH + std::to_string(config.pwrGoodPin) +
+                         "/value";
 
         auto presentPinValStr = (config.presentPin)
                                     ? getGPIOValueOfNvme(devPresentPath)
diff --git a/nvme_manager.hpp b/nvme_manager.hpp
index e837961..74baccc 100644
--- a/nvme_manager.hpp
+++ b/nvme_manager.hpp
@@ -5,7 +5,6 @@
 #include "nvmes.hpp"
 #include "sdbusplus.hpp"
 
-#include <fstream>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server.hpp>
 #include <sdbusplus/server/object.hpp>
@@ -13,6 +12,8 @@
 #include <sdeventplus/event.hpp>
 #include <sdeventplus/utility/timer.hpp>
 
+#include <fstream>
+
 namespace phosphor
 {
 namespace nvme
diff --git a/sdbusplus.hpp b/sdbusplus.hpp
index c0a1848..1f54c49 100644
--- a/sdbusplus.hpp
+++ b/sdbusplus.hpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/elog.hpp>
 #include <phosphor-logging/log.hpp>
@@ -7,6 +6,8 @@
 #include <sdbusplus/message.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
+#include <iostream>
+
 namespace phosphor
 {
 namespace nvme
diff --git a/smbus.cpp b/smbus.cpp
index a015714..de4a668 100644
--- a/smbus.cpp
+++ b/smbus.cpp
@@ -1,5 +1,7 @@
 #include "smbus.hpp"
 
+#include "i2c.h"
+
 #include <errno.h>
 #include <fcntl.h>
 #include <stdint.h>
@@ -12,8 +14,6 @@
 #include <iostream>
 #include <mutex>
 
-#include "i2c.h"
-
 #define MAX_I2C_BUS 30
 static constexpr bool DEBUG = false;
 
diff --git a/smbus.hpp b/smbus.hpp
index 4dc44f0..c452ee7 100644
--- a/smbus.hpp
+++ b/smbus.hpp
@@ -30,4 +30,4 @@
 };
 
 } // namespace smbus
-} // namespace phosphor
\ No newline at end of file
+} // namespace phosphor