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: I8f5382f5868ca19781c2327a3e69f02118975a25
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 1ab2c09..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,17 +1,19 @@
 ---
-Language: Cpp
+Language:        Cpp
 # BasedOnStyle:  LLVM
 AccessModifierOffset: -2
 AlignAfterOpenBracket: Align
 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
@@ -20,30 +22,31 @@
 BinPackArguments: true
 BinPackParameters: true
 BraceWrapping:
-  AfterCaseLabel: true
-  AfterClass: true
+  AfterCaseLabel:  true
+  AfterClass:      true
   AfterControlStatement: true
-  AfterEnum: true
-  AfterFunction: true
-  AfterNamespace: true
+  AfterEnum:       true
+  AfterFunction:   true
+  AfterNamespace:  true
   AfterObjCDeclaration: true
-  AfterStruct: true
-  AfterUnion: true
+  AfterStruct:     true
+  AfterUnion:      true
   AfterExternBlock: true
-  BeforeCatch: true
-  BeforeElse: true
-  IndentBraces: false
-  SplitEmptyFunction: false
-  SplitEmptyRecord: false
-  SplitEmptyNamespace: false
+  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:"
+ColumnLimit:     80
+CommentPragmas:  '^ IWYU pragma:'
 CompactNamespaces: false
 ConstructorInitializerAllOnOneLineOrOnePerLine: false
 ConstructorInitializerIndentWidth: 4
@@ -52,47 +55,57 @@
 DeriveLineEnding: false
 DerivePointerAlignment: false
 PointerAlignment: Left
-DisableFormat: false
+DisableFormat:   false
 ExperimentalAutoDetectBinPacking: false
 FixNamespaceComments: true
-ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH]
+ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
 IncludeBlocks: Regroup
 IncludeCategories:
-  - Regex: '^[<"](gtest|gmock)'
-    Priority: 7
-  - Regex: '^"config.h"'
-    Priority: -1
-  - Regex: '^".*\.h"'
-    Priority: 1
-  - Regex: '^".*\.hpp"'
-    Priority: 2
-  - Regex: '^<.*\.h>'
-    Priority: 3
-  - Regex: '^<.*\.hpp>'
-    Priority: 4
-  - Regex: "^<.*"
-    Priority: 5
-  - Regex: ".*"
-    Priority: 6
+  - Regex:           '^[<"](gtest|gmock)'
+    Priority:        7
+  - Regex:           '^"config.h"'
+    Priority:        -1
+  - Regex:           '^".*\.h"'
+    Priority:        1
+  - Regex:           '^".*\.hpp"'
+    Priority:        2
+  - Regex:           '^<.*\.h>'
+    Priority:        3
+  - Regex:           '^<.*\.hpp>'
+    Priority:        4
+  - Regex:           '^<.*'
+    Priority:        5
+  - Regex:           '.*'
+    Priority:        6
 IndentCaseLabels: true
-IndentWidth: 4
+IndentRequiresClause: true
+IndentWidth:     4
 IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
-MacroBlockBegin: ""
-MacroBlockEnd: ""
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
 MaxEmptyLinesToKeep: 1
 NamespaceIndentation: None
 ObjCBlockIndentWidth: 2
 ObjCSpaceAfterProperty: false
 ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
 PenaltyBreakBeforeFirstCallParameter: 19
 PenaltyBreakComment: 300
 PenaltyBreakFirstLessLess: 120
 PenaltyBreakString: 1000
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
-ReflowComments: true
-SortIncludes: true
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
+ReflowComments:  true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
+SortIncludes:    true
 SortUsingDeclarations: true
 SpaceAfterCStyleCast: false
 SpaceAfterTemplateKeyword: true
@@ -104,12 +117,13 @@
 SpaceBeforeRangeBasedForLoopColon: true
 SpaceInEmptyParentheses: false
 SpacesBeforeTrailingComments: 1
-SpacesInAngles: false
+SpacesInAngles:  false
 SpacesInContainerLiterals: true
 SpacesInCStyleCastParentheses: false
 SpacesInParentheses: false
 SpacesInSquareBrackets: false
-Standard: Latest
-TabWidth: 4
-UseCRLF: false
-UseTab: Never
+Standard:        Latest
+TabWidth:        4
+UseTab:          Never
+...
+
diff --git a/src/buffer.cpp b/src/buffer.cpp
index 4f1812d..b38862e 100644
--- a/src/buffer.cpp
+++ b/src/buffer.cpp
@@ -75,8 +75,8 @@
 void BufferImpl::readBufferHeader()
 {
     size_t headerSize = sizeof(struct CircularBufferHeader);
-    std::vector<uint8_t> bytesRead =
-        dataInterface->read(/*offset=*/0, headerSize);
+    std::vector<uint8_t> bytesRead = dataInterface->read(/*offset=*/0,
+                                                         headerSize);
 
     if (bytesRead.size() != headerSize)
     {
@@ -96,8 +96,8 @@
 
 void BufferImpl::updateReadPtr(const uint32_t newReadPtr)
 {
-    constexpr uint8_t bmcReadPtrOffset =
-        offsetof(struct CircularBufferHeader, bmcReadPtr);
+    constexpr uint8_t bmcReadPtrOffset = offsetof(struct CircularBufferHeader,
+                                                  bmcReadPtr);
 
     little_uint24_t truncatedReadPtr =
         boost::endian::native_to_little(newReadPtr & 0xffffff);
@@ -119,8 +119,8 @@
 
 void BufferImpl::updateBmcFlags(const uint32_t newBmcFlag)
 {
-    constexpr uint8_t bmcFlagsPtrOffset =
-        offsetof(struct CircularBufferHeader, bmcFlags);
+    constexpr uint8_t bmcFlagsPtrOffset = offsetof(struct CircularBufferHeader,
+                                                   bmcFlags);
 
     little_uint32_t littleNewBmcFlag =
         boost::endian::native_to_little(newBmcFlag);
diff --git a/src/pci_handler.cpp b/src/pci_handler.cpp
index 9ccb550..201be8f 100644
--- a/src/pci_handler.cpp
+++ b/src/pci_handler.cpp
@@ -37,8 +37,8 @@
     }
 
     // Read up to regionSize in case the offset + length overflowed
-    uint32_t finalLength =
-        (offset + length < regionSize) ? length : regionSize - offset;
+    uint32_t finalLength = (offset + length < regionSize) ? length
+                                                          : regionSize - offset;
     std::vector<uint8_t> results(finalLength);
 
     std::memcpy(results.data(), mmap.get().data() + offset, finalLength);
@@ -59,8 +59,8 @@
     }
 
     // Write up to regionSize in case the offset + length overflowed
-    uint16_t finalLength =
-        (offset + length < regionSize) ? length : regionSize - offset;
+    uint16_t finalLength = (offset + length < regionSize) ? length
+                                                          : regionSize - offset;
     std::memcpy(mmap.get().data() + offset, bytes.data(), finalLength);
     return finalLength;
 }
diff --git a/src/rde/rde_dictionary_manager.cpp b/src/rde/rde_dictionary_manager.cpp
index a71114c..c3567fb 100644
--- a/src/rde/rde_dictionary_manager.cpp
+++ b/src/rde/rde_dictionary_manager.cpp
@@ -7,8 +7,7 @@
 namespace rde
 {
 
-DictionaryManager::DictionaryManager() : validDictionaryCount(0)
-{}
+DictionaryManager::DictionaryManager() : validDictionaryCount(0) {}
 
 void DictionaryManager::startDictionaryEntry(
     uint32_t resourceId, const std::span<const uint8_t> data)
@@ -17,8 +16,8 @@
     auto itemIt = dictionaries.find(resourceId);
     if (itemIt == dictionaries.end())
     {
-        dictionaries[resourceId] =
-            std::make_unique<DictionaryEntry>(false, data);
+        dictionaries[resourceId] = std::make_unique<DictionaryEntry>(false,
+                                                                     data);
         return;
     }
 
diff --git a/test/buffer_test.cpp b/test/buffer_test.cpp
index a78897a..2856e8c 100644
--- a/test/buffer_test.cpp
+++ b/test/buffer_test.cpp
@@ -268,8 +268,8 @@
     static constexpr uint8_t expectedBmcReadPtrOffset = 0x21;
     static constexpr size_t expectedqueueOffset = 0x30 + testUeRegionSize;
 
-    static constexpr size_t testMaxOffset =
-        testQueueSize - testUeRegionSize - sizeof(struct CircularBufferHeader);
+    static constexpr size_t testMaxOffset = testQueueSize - testUeRegionSize -
+                                            sizeof(struct CircularBufferHeader);
     uint8_t* testInitializationHeaderPtr =
         reinterpret_cast<uint8_t*>(&testInitializationHeader);
 };